Playing 300KB GIF files results in high CPU usage. What optimization methods are available

Playing 300KB GIF files results in high CPU usage. What optimization methods are available

The version of lvgl used is v8.3

Hi, I didn’t know playing GIFs was even an option (when i use the image tool on an animated gif in 8.x mode it just provides one still frame), that sounds pretty cool though if you had a code sample or other suggested converter i should use, thanks.

So instead of animated GIFs, what I’ve been doing is using one long image strip made with ezgif’s anim gif extractor, then setting it’s size to one frame’s size, and adjusting the source’s y-offset to put it on the correct frame as needed. What I found helped my CPU out was only updating that every X frames. Previously I had set the offset every frame but often it wasn’t actually changing and I think that was invalidating it anyways and causing a redraw when it wasn’t needed. In general it seems good to avoid making any changes to an LVGL object unless the data is actually changing, to avoid unnecessary updates.

Another thing i’ve considered is splitting the output image into manageable sized chunks arranged in a vertical stack, and only updating one of them at a time per frame, which should help it keep a high enough frame rate you can’t really see that happening, but it might help avoid recurring frame spikes every time the animation updates.

edit: ok this isn’t exactly optimization but an interesting thing I’ve noticed is that when I put my project into a new enclosure I’m designing/printing, which does not have any sort of ventilation yet (or probably, ever), it builds up a bit more heat. For whatever reason it seems like letting the chip run warm is giving me about 10% higher frame rates in general. Not sure if this would apply in your use case but the speed difference is noticable enough i thought I’d mention it.