Repository navigation
Faster GIF animation decoding - #70
Merged
Merged
Conversation
Decoding wrote every frame as RGBA, compositing read it back (checking each pixel's alpha byte) and copied the canvas, and the Frame copied it once more into a zeroed bitmap. Frames now keep their indices (in display order) and a table of their colors: compositing writes the colors straight onto the canvas, skipping the transparent index, and the frames take the composited copies as their bitmaps. The benchmark's 101 frame GIF decodes in 83 instead of 134 ms (omggif: 123 ms). Bit-identical: decoding and re-encoding checked against master on 1593 images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
matmen
force-pushed
the
faster-gif-decode
branch
from
October 16, 2026 09:51
6ee695e to
8c0a821
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decoding animated GIFs was the other operation where a pure-JS library beat us: omggif took 123 ms for the benchmark's 101-frame GIF, we took 134 ms.
Before, every frame was copied several times:
Framecopied the result once more into a freshly zeroed bitmap.Changes
Results
The output is bit-identical: decoding plus GIF/APNG re-encoding of the decoded frames was checked against master on 1593 corpus images (1970 results, 0 different).
The changelog entry goes under 3.2.1, which #68 adds as well (trivial conflict).
🤖 Generated with Claude Code
https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ