-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about time to write Data to IT8951 Framebuffer. #2
Comments
From my experiences, the size and detail of the image seems to make a difference. Converting the image to a C-file before or using the IT8951 bmp-conversion function doesn't seem to make too much of a difference. For now, designing for e-ink screens still seems to require thinking around the limited refresh rate. But curious if waveshare has any suggestions too! |
Thank you for your reply. |
I'm not part of waveshare, so I'm not sure... We've also noticed that the Windows application seems faster. |
I made it ~10 times faster by not using LCDWriteData but writing my own function that internally send all the data in one call. I also switched to 4BPP instead of 8 and made it again 2x faster. @tobiasaska |
That sounds amazing @naluhh! |
I made a quick test yesterday. I'm trying to make it even faster by extracting the picture directly into a 4bpp texture. I'm only planning on doing full screen updates. I'll share some code this week |
@naluhh Thank you very much for this piece of information. Thats exacly what i was looking for. I am pretty new to coding. Would you mind sharing your code with me/us? |
It's a work in progress. But you can try like this:
|
Thank you! I will try this 👍 |
Tried it just now. Very noticeable speed boost! Awesome! Thank you! |
@JorgosCoenen 4BPP is the maximum these screens can do anyway. Right now it's decoding the BMP in 8bpp and I then translate it to 4bpp. It would be much faster (less allocation, smaller file etc) to have a 4bpp image (png support it). I'm sure other optimizations could be done. |
Could you try to replace this line:
by
|
Sure! Seems this makes the "interlacing" more pronounced. |
What's the resolution of your screen? |
Ah, I'm using the 9.7" screen, so 1200x825. My images or also this resolution. |
I'm using the 10.3" one. Odd number of pixels (y axis) might be the problem with your screen. Without access to the hardware it'll be hard for me to fix it. It was working well for me, probably an alignment thing. Meanwhile you can go back to 8BPP. (You'll need to comment the loop, remove the / 2 on buffer size, and switch 4BPP to 8BPP) |
Oh wow, hadn't seen that one, looks pretty great. |
A good chunk of the time goes into turning on the screen, and decoding the bmp image. Both of them could be reduced. Pre-uploading image you want might help too. (the buffer is big enough to store several images) |
Yeah, I keep the screen turned on in my application (added freeing the buffer to the bmp-function, instead of always using the cancel-function). Does the library include anything to upload multiple images and switch between them? Would definitely also be an interesting hack. |
the library doesn't support that. Be carefull, don't leave it on too long, you might reduce the lifespan of your screen/controller |
Thanks for the heads-up! We have had them running for some long periods without noticeable impact so far. The only thing I've noticed is that sometimes the frame we built behind the screen become visible on the display if it's powered off (especially when in sun light). As if it's shining through. |
No doubt that you'll reduce your screen lifespan and greatly increase the consumption by doing so |
By decoding the image directly into the buffer, allocating only what's needed and optimizing and merging a few spi calls I was able to increase the speed even further. Depending on the raspberry pi you are using you might be even able to change the clock rate doing a 2x or 4x on the upload speed. |
Impressive! We've been using both Pi zero's and 3B+'s, depending on the processing/battery required. On the zero's this is probably not possible? |
Wow! You are solving all my problems I had working with the IT8951. You must have a lot of experience on this field. Thank you for sharing your improvements with us! |
Can you try to replace BCM2835_SPI_CLOCK_DIVIDER_32 by |
Anything below 16 doesn't work on my Pi Zero (just a flicker in the top left corner). Edit: this is still with the loop commented out and the 8bpp |
I'm curious about the result on the 3B+. Could you give me back the results you get? |
Also, if you don't care about accuracy, you could switch to 1 bpp buffer, which would divide the transfer duration by ~8 in your case |
Ok, did manage to test on a 3B+. Getting the same result as on the Zero, only a flickering rectangle in the top left corner with clock_divider below 16. This rectangle flickers and goes away , the previous image stays on screen. |
You could also remove the line
if you don't plan on showing partials image |
Yeah, thanks so much, this has been really helpful! Do you think having the images converted into arrays and using the EPD_DrawMatrix() function would be faster than the Show_bmp() function? I didn't see much of an improvement when we did this on the original code, but maybe with your changes? |
I don't know, I personally switched to 4bpp png for performance/size reasons. (You can see the tip of my branch with libpng) |
I optimized the maximum I could. I think someone with more knowledge on the subject could go even further. For my resolution (1872*1404) I'm able to reach 0.9 sec / image. For 1200x825 I reached 0.63 sec / image. The buffer upload takes 60% of the time, so if you are able to pre-upload your images, or upload severals images at the same time you could reach higher speed (the other part, IT8951LoadImgStart, takes 40% of the time but I don't have any clue on how to increase it's speed). |
Really terrific results! Thanks again! Could you say a little more about using png's instead of bmp's? I want to keep the same image quality (8bpp I guess), but using png's would really help our workflow and performance (I'm generating images in d3.js and having to convert them to bmp's in JS is not trivial for me and takes some time/processing power). |
Do you mean that the display will not go above 4bpp, or the input image png has to be 4bpp? I'm trying your branch now. I don't understand why, but one of my Pi Zero will not go below 32 for the BCM2835_SPI_CLOCK_DIVIDER. It messes up the initialisation at least. I noticed it before too, when I wasn't using your latest branch with the png, but was just trying the lower values. sudo ./IT8941 test-4bpp.png When I put it at 32, it initialized correctly, but still crashes afterwards (whole Pi becomes stuck): |
I hardcoded my screen size, that's why (and also require a 4bpp png as input). The display is 4 bpp, therefore having an image higher than that is pure waste. |
@naluhh how do you create 4bpp png? |
I made a repo @pshkvsky https://github.com/naluhh/4bpp-converter/ |
hey @naluhh .. you implementation regarding the socket stuff looks very promising, but i cant get it run. Can you provide a working example? I could get the socketserver working and got also client connection messages, when i did:
i got always the message that the file is not valid. i tried also to supply the filename only, but without success.
what do i wrong here? ;) May thanks in advance! |
it's expecting a local path: |
You can convert any image to a 4bpp via imagemagicks's |
|
Hello,
I am working with Raspberry Pi 3 and the 10.3" Epaper Display from Waveshare. The refresh rate is very fast but the time to write the data from host frame buffer to IT8951 Frame Buffer is about 10 seconds. This is way to long for my application. Is there any way to make this process faster? Or can write multible images to different Frame Buffers on the IT8951? Has this to do with SPI interface?
The text was updated successfully, but these errors were encountered: