pixelmatix / AnimatedGIFs

MIT License
62 stars 34 forks source link

Animated GIF crashes smartmatrix 3.0 #7

Closed tcottle closed 8 years ago

tcottle commented 8 years ago

I have been experimenting with animated GIFs on a 64 x 64 panel. Everything is working fine except for the attachment. It crashes the display. I am using the stock example with the following changes

kMatrixWidth = 64
kMatrixHeight = 64 kRefreshDepth = 24 kDmaBufferRows = 2 kMatrixOptions = (SMARTMATRIX_OPTIONS_BOTTOM_TO_TOP_STACKING); matrix.setRefreshRate(60);

eyes

Thanks!

embedded-creations commented 8 years ago

I'll take a look to see if I can reproduce the crash here, and if so, try to trace it down.

One thought though, if looks like the GIF is going to all white briefly, which would cause a surge of current going to the displays during the white frame. If your power supply or wiring or any other part of the power circuit isn't able to handle that and the voltage going to the Teensy drops, that could be the source of the crash. Try lowering the brightness and see if your crash goes away.

tcottle commented 8 years ago

Thanks - I wondered if it could be a P/S problem. I reset the current limit to 80W and the problem still persisted. I am out on travel for a week but will adjust the brightness down and report back on the results

Can you recommend a tool that breaks down an animated GIF into its component frames?

On Mon, Apr 4, 2016 at 7:12 PM, Louis Beaudoin notifications@github.com wrote:

I'll take a look to see if I can reproduce the crash here, and if so, try to trace it down.

One thought though, if looks like the GIF is going to all white briefly, which would cause a surge of current going to the displays during the white frame. If your power supply or wiring or any other part of the power circuit isn't able to handle that and the voltage going to the Teensy drops, that could be the source of the crash. Try lowering the brightness and see if your crash goes away.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/pixelmatix/AnimatedGIFs/issues/7#issuecomment-205572163

embedded-creations commented 8 years ago

There's a couple here in this article I wrote for the Adafruit Learning System: https://learn.adafruit.com/smartmatrix-animated-gif-player/gifs

GIMP and ezgif.com should work.

embedded-creations commented 8 years ago

I'm able to reproduce the crash, but haven't yet been able to track down the bug. I ran the GIF through ezgif trying a 0-pixel crop first, and color reduction next, to try to keep the GIF content the same but reencode it, and still get crashes. I opened the file in GIMP, then exported as GIF animation, and that crashes as well.

I'm planning to track this down and fix it in the next minor release (excluding today's Arduino 1.6.8 fix release), sorry about this issue.

tcottle commented 8 years ago

Thanks! It was on my to-do list for today to extract out all of the frames and display it one at a time ...

On Tue, Apr 19, 2016 at 8:11 AM, Louis Beaudoin notifications@github.com wrote:

I'm able to reproduce the crash, but haven't yet been able to track down the bug. I ran the GIF through ezgif trying a 0-pixel crop first, and color reduction next, to try to keep the GIF content the same but reencode it, and still get crashes. I opened the file in GIMP, then exported as GIF animation, and that crashes as well.

I'm planning to track this down and fix it in the next minor release (excluding today's Arduino 1.6.8 fix release), sorry about this issue.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/pixelmatix/AnimatedGIFs/issues/7#issuecomment-211937747

embedded-creations commented 8 years ago

This is a weird GIF, it does things I didn't know were allowed by the GIF spec:

I saw some weird things when parsing through the file, including an X,Y coordinate that was outside of the 64x64 bounds. I opened the file in GIMP, then chose "Fit Canvas to Layers", and this weird stuff showed up outside of the 64x64 bounds.

__ezgif_com-optimize___imported_-2_0__rgb_color__4_layers__122x91_ _gimp

A longterm solution is probably to throw out any pixels that are outside the bounds of the GIF decoder's buffer. I'm considering a rewrite of the GIF decoder, and I'll keep this feature in mind. A shortterm solution is to edit the GIF file manually to remove the extra stuff outside the bounds.

You can use ezgif's resize tool, but only one option works: Imagemagick + coalesce. The other two options either leave the graphics outside the bounds, or resizes the GIF to make the graphics out of bounds visible.

http://ezgif.com/resize/

Here's a version that doesn't crash the sketch:

ezgif com-resize-2

embedded-creations commented 8 years ago

I added bounds checking in a couple places, and now even this weird GIF plays without crashing.