Bump weezl to 0.2 (faster decode + multiple LZW fixes; fixes small interlaced GIFs, supersedes #232 + #233)#236
Merged
Merged
Conversation
weezl 0.2.x fixes the small-output-buffer false-NoProgress bug (image-rs/weezl#68, fixed by image-rs#72) that caused small interlaced GIFs to fail decoding. Bumps weezl 0.1.10 -> 0.2.1 and MSRV 1.85 -> 1.88 (weezl 0.2.1 requires 1.88). Adds tests/small_interlaced.rs (7x7, 9x9, 47x63). Supersedes image-rs#233.
This was referenced May 30, 2026
kornelski
approved these changes
May 31, 2026
Contributor
|
CI needs msrv update |
The weezl 0.2.1 bump raised rust-version to 1.88, but the CI matrix still pinned the MSRV job at 1.85.0. Align the CI toolchain (matrix + test-skip condition) so the MSRV job actually exercises the declared minimum.
The crate root is `#![cfg(feature = "std")]`, so with --no-default-features the gif crate exports nothing and the new integration test fails to compile (E0433: cannot find DecodeOptions/ColorOutput/DecodingError in gif). Every other test file already opens with `#![cfg(feature = "std")]`; add the same guard here so the no-default-features clippy job compiles it to empty.
Contributor
Author
|
I just found out that Ubuntu 26.04 LTS bundles Rust 1.93.1 |
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.
weezl 0.2.x is a substantial step up from the 0.1.x line this crate currently pins, on both correctness and speed.
Correctness — 0.2.x fixes several decoder bugs over 0.1.10
NoProgresswhen progress was only filling the internal word buffer (yield_on_full + small output buffer: false NoProgress loses data weezl#68, fixed by fix: yield_on_full correctness on wuffs branch (#68) weezl#72) — streaming/abstraction decoders could previously silently drop data.The
#68fix is the one that matters here: it's exactly what made small interlaced GIFs fail to decode. Whenread_into_bufferhands weezl a tiny per-row output slice (7–47 bytes for a small interlaced frame), weezl 0.1.x could returnNoProgresseven though it had advanced its internal word buffer, and the streaming decoder then treated the still-valid input as truncated. On weezl 0.2.1 that no longer happens, so no decoder-side handling is needed — the bump alone fixes it.Performance
weezl 0.2.0 reworked the decoder around a Wuffs-inspired design (image-rs/weezl#77) that decodes 8 bytes at a time over a pre-built code tree. I measured decode through this crate's full path (master, the only change being the weezl version), interleaved A/B across an 8×8→2048×2048 size sweep on two architectures (x86-64 Zen 4 and aarch64 Neoverse-N1):
On GIFs larger than 16×16, weezl 0.2.1 decodes faster — roughly +7% at 32×32 rising to +24% at 2048×2048 on x86-64, and +9% rising to +32% on aarch64 (about 1.24× / 1.32× per pixel at large sizes; the win grows with image size, and aarch64 benefits most). The interlaced regression GIFs below also now decode correctly where 0.1.10 rejected them.
(Numbers are interleaved-A/B ratios via zenbench, no
target-cpu=native; bench notes available on request.)What this changes
weezldependency0.1.10→0.2.1.1.85→1.88(weezl 0.2.1 declaresrust-version = "1.88.0"— see reviewer note).tests/small_interlaced.rs: regression tests for 7×7, 9×9, and 47×63 interlaced GIFs produced by gifsicle 1.95 (valid per GIF89a, verified withgiftopnm), which previously failed withDecodingFormatError { underlying: "unexpected data" }.No source changes are required in
src/reader/decoder.rs: theLzwReaderwrapper already consumes weezl'sBufferResult/VectorResultshape, which is unchanged between 0.1.10 and 0.2.1. The entire non-test diff is the twoCargo.tomlversion strings.Supersedes #232 and #233
tests/small_interlaced.rscases as failing tests (no fix); they're included here and now pass.lzw_drain_onedecoder-side workaround; with weezl 0.2.1 the decoder no longer stalls, so the workaround is unnecessary.Both #232 and #233 can be closed in favour of this PR. A/B on a clean
master:master+ weezl 0.1.10unexpected data)master+ weezl 0.2.1 (this PR)Full
cargo testis green on the bumped tree.Reviewer note: MSRV
weezl 0.2.1 raises its MSRV to Rust 1.88.0. image-gif currently declares
rust-version = "1.85", so this PR also bumps the declared MSRV to1.88. If holding MSRV at 1.85 is a hard requirement, this bump can't land as written — that's the trade-off to weigh. For reference, image-tiff already took the same step onmain(image-rs/image-tiff#392 bumped weezl to 0.2 and MSRV to 1.88.0).Refs: image-rs/weezl#64, #67, #68, #72, #77, #78, and #232, #233.