Repository navigation
feat(jpeg): a granular JPEG library, its WASM kit and a browser-decoder oracle - #38
Merged
Merged
Conversation
…an symbols, oversized kit round trips - dequantize multiplies in f32 and the decoder's DC predictor saturates, so a crafted file can no longer overflow i32 in decode - encode validates its image (shared Rgb8Image::validate) and stores the clamped quality in Trace.options - Huffman tables with duplicate symbols are refused - the kit refuses round trips over the 16-megapixel decode cap up front - MAX_DECODE_PIXELS is documented as a pixel count
- missing-docs sweep over crates/jpeg (zero warnings) - state preconditions (amplitude range, non-empty planes, component counts, write_segments table/nibble limits); fix zigzag, text_px and huffman docs - README layout names error and image; spec says what the Trace stores
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.
Slice 1 of the JPEG compression lab. Spec:
docs/superpowers/specs/2026-10-15-jpeg-lab-design.md. Plan:docs/superpowers/plans/2026-10-15-jpeg-lab-1-library.md. There are no UI changes; the engine lab and the stage pages come in Plans 2–4.What's in it
crates/jpeg: a new crate with no dependencies.codeccomposes them into a JFIF encoder, which keeps a fullTraceof every intermediate, and a decoder.viz-core:jpeg_images: generated gradient, text and bars test images.jpeg_kit: 24 statelesswasm-bindgenfunctions over the crate's parts. They check lengths and ranges and return aJsErrorfor bad input.tests/jpeg_oracle.rs): headless Chrome decodes our files, and the result must match our decoder to within 3 levels per channel (max) and 0.5 (mean). It covers 3 images × 2 sizes × 3 subsamplings × 3 qualities.Tests
cargo test --all-features: jpeg 85, viz-core 266.wasm-pack test --chrome --headless: 40 tests (33 existing, 6 kit, 1 oracle).fmtis clean, and the new code adds no clippy warnings.