-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Decode and maybe color errors with gifs from gifski #97
Comments
I'm able to reproduce the problem - working on it... |
ok, decode error is fixed (for my test cases). Please give the newest code (not released, just 1 commit). |
I'll check on this today. |
ok, I found and fixed the palette problems. The first issue was improper handling of a local color palette. I also slightly changed the behavior of the cooked output. When you pass a full framebuffer and don't pass a GIFDRAW callback, it will render the cooked pixels into the framebuffer after the native (8-bit) frame. This means that for RGB565 output, the framebuffer needs to be 3 x (iCanvasWidth * iCanvasHeight). |
Oh man, that "fully cooked" mode is really nice. Took me a minute to realize the changes aren't in the Turbo mode decoder (the colors are still a little stripey there). but in non-Turbo mode, things are working great! |
it is confusing - too many options. Do you think Turbo mode behavior should change? |
Yeah, I think so. IMO, turbo mode should output the same as normal mode, just quicker if you have more RAM (assuming that's all technically possible). I do feel like to maybe clear things up, the way the user interacts with the pixels should be set in
(some of this might be wrong, it's just what I pieced together, but hopefully shows how I think about the library) Updating Potentially you could have another buffer ( Honestly not sure about performance impact of any of this, just some ideas on how to maybe make all the options less confusing while still targeting all the use cases. When I first started trying out the library I was a little confused about how the
Bear in mind, I was trying to use the library on Linux trying to get a full 32bpp frame (and ended up copying over the full frame via the |
Part of the issue of getting correct output with GIF is that it was designed to generate RGB888 output from each frame. This output was accumulated and could include pixels from frames with different palette entries. This means that in order to display correctly, the full frame of "cooked" output needs to exist so that it can accumulate changes of any of the possible 16 million colors. When decoding a GIF animation and only feeding it line by line to the caller, if the GIF makes use of a local color palette, then the output image will become full of wrong colors. This recent change where I do a full frame decode if "cooked" is selected and pFrameBuffer exists is the only current way to get completely correct output. If you "optimize" your GIF and remove local color tables, then the line-by-line method can still look correct. With this info, do you have any other ideas about all of the permutations of output? |
I feel it's important to keep all your users on MCUs with a working gif decoder, even if it doesn't handle all gifs. While I'm not a fan of "fix it in docs" - if folks come across gifs with local color palettes on a low memory system, they could use something like gifsicle with its As far as permutations of options, I'm thinking something like:
You could maybe have the draw type associated with the amount of memory to keep things less confusing. Maybe even have a Regardless, I do feel like this is quite the odd situation to be in... |
Describe the bug
Gifs created with gifski don't seem to work for me. They do a lot of color optimization, so could be something weird there. Hopefully it's just a config thing on my end.
To Reproduce
While I am running this as a shared library loaded into another program (all on linux, not sure if the arduino code is affected), I was able to reproduce the issue using the linux example code modified to draw
COOKED
(great name btw) w/buffers (code below).It claims the gif only has 4 frames, but it has more. Other gifs also fail after going through an incorrect number of frames.
iError
claims it's aGIF_DECODE_ERROR
(1). For ones that don't have a decode error, I get some weird colors back.Expected behavior
Ideally, it would be cool if this worked, but if not (because of something from gif.ski's end), we'll make do!
Image files
fails after 4 frames:
fails after 1 frame:
Also, the two example images from the gif.ski website have the odd colors (seem to decode just fine).
For the jazz-chromecast, my second frame looks like:
Additional context
Thanks for making this library! It's the best gif decoder that works well on lower powered hardware.
The text was updated successfully, but these errors were encountered: