-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
How to limit Height ou reduce memory usage on ESP32? #8
Comments
The height doesn't affect the amount of memory used since each line is emitted one at a time. If you're running out of memory on the ESP32, then re-use the GIF structure for other purposes. It needs about 22.5K of RAM, but only while decoding. You can use that memory for something else when not using the GIF decoder. Another way of describing this is a "memory pool". For example: static uint8_t my_memory_pool[24000]; AnimatedGIF *pGIF = static_cast<AnimatedGIF *>(my_memory_pool); Then use the memory for something else that doesn't need to run at the same time as the GIF decoder. Hope this helps. |
This is a very good idea, I will try this. |
Instead of changing the library code, why not allocate the whole GIF structure with malloc? That's why I wrote it the way I did. You can define it as a static or allocate the whole structure in one shot. |
note that those patches are to an old version of the library. With the current one, using one malloc makes sense. I am now running the same (old) gif decoding library code on rPi to decode just about any resolution since rPi has so much RAM (and can drive bigger rgbpanels). It's super cool that this library was written in a way (with callbacks) that porting it to ESP32 SPIFFS/FatFS, and then straight linux (rPI) was very little work. Here's the result: Ideally in my "copious spare time", I should sync up my old fork against this one, but given that the old one is working fine for me, it's not been pressing on my list of priorities ;) That said, I see that this lib has changed "a lot" since the fork I made, so it'll likely be a new port as opposed to a resync |
Hello,
Your library displays GIFs perfectly on a double RGB Led matrix (128 x 32) controlled by an ESP32
But as I load a large code and many libraries (server, clock, audio spectrum, etc.), my memory space is very limited.
My problem :
With #define MAX_WIDTH 320, I cannot compile my code (overflowed by XXXX bytes)
With #define MAX_WIDTH 128 instead of 320, it's better, but a few bytes of memory are still missing to compile.
If I halve #define MAX_WIDTH 64, the code compiles fine and the images display fine. Even the 128px wide one (I understand that it doesn't cut out the images).
As I read your comment: Designed to decode images up to 480x320
I would like to know how to adjust these two values WIDTH an HEIGHT (480x320) to the actual size of my matrix (128x32 or 128x64)?
Or limit the memory for these values?
Thank you so much.
The text was updated successfully, but these errors were encountered: