Commits
Commits on
2cccf178a8bb4ba04fa845f4a9ed002c6a135fe3Filtered to crates/ec-image/src/lib.rsClear filter2026-08-14
feat(image): WebP decoding, VP8 key frames and VP8LAhmet Kaan Gümüş · 22ac6ab
feat(image): WebP decoding, VP8 key frames and VP8L The RIFF container, both bitstreams, and the separate alpha plane an extended file carries. VP8 (RFC 6386) is a complete key frame decoder: boolean entropy decoder, segmentation, per-partition token decoding with the neighbour contexts, the WHT and DCT inversions bit-exactly as specified, all sixteen intra prediction modes including the six diagonal subblock ones, and both loop filters with their per-macroblock strength derivation. The probability and quantizer tables are generated from the RFC text rather than retyped — two thousand values transcribed by hand is a defect waiting to be found several macroblocks into a picture. VP8L is the lossless bitstream: canonical prefix codes with meta prefix groups, the colour cache, LZ77 over the two-dimensional distance map, and all four transforms applied in the reverse of the order they were read. The colour cache size is read *before* the meta prefix codes; the other order parses plausibly and then fails on the first real file. Alpha arrives either raw or as a headerless lossless stream in the green channel, then unfiltered by the method its chunk declares. Animation is refused by name: a still decoder that quietly returns frame one makes "this plays" and "this decoded" indistinguishable to its caller.
feat(image): baseline and progressive JPEG decodingAhmet Kaan Gümüş · 7eed0e7
feat(image): baseline and progressive JPEG decoding ITU-T T.81 baseline (SOF0), extended sequential (SOF1) and progressive (SOF2), Huffman coded, with restart intervals and both spectral-selection and successive-approximation refinement. Chroma is upsampled with the triangle filter both reference decoders use, in a module JPEG and WebP share: pixel replication is a decibel cheaper against the source and puts a visible staircase on every saturated colour edge. The IDCT is a separable fixed-point inversion carrying thirteen fractional bits, which lands within one count of the incumbent on grayscale, where no colour matrix or upsampler is in the way. EXIF orientation is parsed and exposed, never applied — the same choice the incumbent makes, so a caller swapping between them sees one picture. Arithmetic-coded, lossless and hierarchical JPEGs, and the 4-component CMYK/YCCK family, are refused by name with the reason: decoding ink colours without their ICC profile looks right in a thumbnail and is wrong in print.
feat(image): PNG decoding and the still-image APIAhmet Kaan Gümüş · 7bceff2
feat(image): PNG decoding and the still-image API ec-image decodes stills for the engine's placed-picture path. This first stage is the shared API — format guessing from content, a Pixels buffer in the file's own colour form, parsed-but-unapplied metadata, and pixel limits checked before any buffer is sized from a header — plus the PNG decoder over ec-inflate. Every colour type at every legal bit depth, all five filter types, Adam7 interlace, palette and colour-key transparency, gamma and sRGB exposed, ancillary chunks skipped by length, and every chunk CRC verified: a PNG that fails its own checksum is refused rather than decoded into a picture nobody can tell is wrong. scripts/gen-still-fixtures.sh generates the seeded corpus the later stages measure against; the fixtures themselves stay out of the repository.