forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 00c1b3ff2d80d84fef71bb6208110dedbbd95fc4Filtered to crates/ec-image/tests/real_library.rsClear filter

2026-08-26

feat(image): GIF decoding and a format-agnostic animation surfaceAhmet Kaan Gümüş · 166bcc8
feat(image): GIF decoding and a format-agnostic animation surface

A GIF87a/GIF89a decoder written to the spec: LSB-first LZW with the
one-code-early width bump and the cScSc case, sub-block chains, the
four-pass interlace, graphic control extensions, local and global colour
tables, and frame compositing with all four disposal methods.

Adds decode_animation(), which every format answers -- a still is one
frame with a zero delay -- so a caller that wants to play something never
branches on the format. One colour form is chosen for the whole
animation, so the pixel layout cannot change under a caller mid-walk.

Gated pixel-exact against the incumbent decoder: 6/6 fixtures, and 7/7
real GIFs on this machine over 454 frames, frame count and per-frame
delays included. Two 10 000-round mutation sweeps cover the still and
the animation path.

2026-08-14

test(image): differential corpus, fuzz sweep and a real-library passAhmet Kaan Gümüş · 82499c0
test(image): differential corpus, fuzz sweep and a real-library pass

Three bars, one per format, each the strictest the format allows:

- PNG and lossless WebP are pixel-exact against the incumbent `image`
  crate over every colour type, bit depth and interlace method, with the
  16-bit variants compared at 16 bits so neither side's narrowing rounds
  the comparison away.
- JPEG is measured, not asserted away: max sample delta 5 of 255 (1 on
  grayscale, 3 on 4:4:4), correlation above 0.9999 and 49-66 dB against
  the incumbent's own decode, all printed per file. T.81 leaves IDCT
  rounding to the implementation and both readings are legal.
- WebP lossy is measured against the *source picture*: 32.1-36.5 dB,
  within 0.05 dB of the incumbent everywhere, and the alpha plane, being
  lossless, must match exactly.

Ten thousand mutations per format — bit flips, truncations, injections and
noise behind each signature, with PNG chunk CRCs repaired so the mutations
reach the decoder instead of stopping at the checksum — must produce an
Ok or an Err, never a panic. A header claiming four gigapixels is refused
before anything is allocated from it.

The real-library sweep decodes the PNGs and JPEGs actually on this machine
and prints a per-file table: 13 files, PNGs pixel-exact, JPEGs within four
counts, 33 Mpx in 568 ms and a 12.6 Mpx phone JPEG in 247 ms in release.