Animated gif crashes ESP32 output?

Hi @Louis. I’ve made some progress with my ESP32 setup. I’m now using @Jason’s shield with level shifters:

(GPIOPINOUT == ESP32_JC_RIBBON_PINOUT)
A sad downside is that it prevents serial TX, so I can’t currently send serial input to my code to make it do stuff. After @Jason tells me which pin he’d like to use instead of the TX pin, I’ll cut traces on my boards and try to reroute the wire in question.

On ESP32, I have some 64x64 animated gifs that cause crashes like
/gifs64/257_mesh.gif

My AnimatedGifs fork has now evolved a fair amount from yours since it has full support for NeoMatrix and SmartMatrix, including running SmartMatrix::GFX API on top of SmartMatrix (i.e. 3 backends) as well as SPIFFS on ESP32 and ESP8266 (the latter only supports NEOMATRIX) plus better file browsing via serial input and debugging a specific GIF if needed

You should be able to fetch https://github.com/marcmerlin/AnimatedGIFs/blob/master/data64/gifs64/257_mesh.gif
It works on teensy, just not on ESP32. I’m guessing it tickles some DMA lines the wrong way, or something.
Would you be able to try it out to see if you can reproduce?
More generally see if you can slurp my entire gifs64 collection to see if they work ok for you (better stress test than the smaller 32x32 gifs)

Can you try to isolate if it’s a problem with the GIF decoding, or the SmartMatrix Library? You can comment out the Callback code that actually sets pixels and swaps buffers, and see if there’s still a crash.

Thanks @Louis, sure thing.

First, the gif has 96 frames
./data64/gifs64/257_mesh.gif[95] GIF 64x64 64x64+0+0 8-bit PseudoClass 128c 91.2KB 0.000u 0:00.010

Second, I found that it dies after 202 frames displayed
09:27:35.892 → Decoding Frame Start:201
09:27:35.893 → Decoding Frame End
09:27:35.893 → Decoding Frame Start:202

Third, I modified updateScreenCallback to do nothing, and then it went farther:
09:29:57.902 → Decoding Frame Start:212
09:29:57.902 → Decoding Frame End
09:29:57.903 → Decoding Frame Start:213

Now, it’s smelling like a memory leak in the decoder, or somesuch.
I had lzwMaxBits set to 12, I put it to 10 and it crashes at
09:31:33.333 → Decoding Frame Start:209
09:31:33.333 → Decoding Frame End
09:31:33.334 → Decoding Frame Start:210

If the bug is in the frame decoder, it should hopefully be easy for you to take that gif and reproduce (given time to do it, obviously)

Now, I did have that GIF working before on ESP32 with Neomatrix only, and when I re-enable Neomatrix, it crashes too at the same frame, so I don’t think your SmartMatrix library is at fault.
Maybe something in my changes to AnimatedGifs that only trigger on this one gif and not the others or something else wrong with my ESP32 config.
Would be great to know if it works for you, it will help me narrow it down.

Ok, something happened with the wrong message being deleted. I’ll repost this, sorry about that:

Mmmh, now that I remember, it does not crash when I display it on teensy with smartmatrix, which is why I suspected an ESP32 display related bug, but given that I was just able to reproduce the bug after turning off the updateScreenCallback, it’s not as clear what’s going on.

Reply from Louis:

As for that one GIF, obviously we’d like to fix the decoder, but in the meantime, can you run it through ezgif.com or another tool that will re-encode it and see if you can get it playing through the current decoder?

Ball is in my court, will followup