Implement a pure Rust baseline JPEG decoder in the image crate.
Requirements#
- Parse JFIF marker structure (SOI, APP0/APP1, DQT, SOF0, DHT, SOS, EOI)
- Baseline DCT decoding (SOF0):
- 8x8 block-based processing
- Huffman entropy decoding (DC and AC coefficients)
- Inverse DCT (IDCT) transform
- Dequantization using DQT tables
- Chroma subsampling: 4:4:4, 4:2:2, 4:2:0
- YCbCr → RGB color conversion
- Support for restart markers (DRI/RST)
- Output as RGBA8
Image - API:
fn decode_jpeg(data: &[u8]) -> Result<Image, ImageError>
Acceptance Criteria#
- Decodes standard JPEG test images (various subsampling modes)
- Handles JFIF and EXIF headers (parse but don't need full EXIF support)
- Correct color conversion from YCbCr to RGB
- Unit tests for Huffman decoding, IDCT, color conversion
- Integration tests with real JPEG files
- No external dependencies, no
unsafe
Dependencies#
- Requires pixel format types
Phase 7 — Image Decoders