Repository navigation
Decode baseline JPEG images - #27
Merged
Merged
Conversation
JpegDecoder parses the marker segments, builds the canonical Huffman tables, decodes the MCUs with an 8 x 8 inverse DCT, and states the samples as Gray8, Rgb24 (YCbCr converted) or Cmyk32 (CMYK/YCCK with the Adobe transform). PdfPageContentReader fills DecodedPixels from it while Data keeps the stored JPEG, so a caller can have either. The decoder is checked against 16 x 16 Pillow-written fixtures at 4:4:4 and one component, with Pillow own decode as the reference and a two-level tolerance. Progressive (SOF2), the fancy chroma upsampling a 4:2:0 fixture needs, CMYK and restart-interval fixtures are the next tests; ADR-005 records them. The scoped Stryker run over JpegDecoder.cs is 61.65% (671 mutants: 351 killed, 114 survived, 105 no coverage); the survivors are the variants the two fixtures do not carry, and docs/mutation-testing.md reads them.
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.
Summary
The third slice of 4a-volledig (ADR-005): baseline
DCTDecode.Pdf/JpegDecoder.cs— marker parsing (DQT, DHT, SOF0/SOF1, SOS, DRI, APP14 Adobe), canonical Huffman decoding, MCU/block decode with an 8×8 inverse DCT, restart-interval handling, and the colour paths:Gray8(1 component),Rgb24(3, YCbCr converted or direct RGB when Adobe transform 0),Cmyk32(4, CMYK as stored or YCCK with transform 2).PdfPageContentReaderfillsDecodedPixelsfrom it whileDatakeeps the stored JPEG — the contract ADR-005 settled.PdfJpegFilterTests— 4 cases against Pillow-written 16×16 fixtures at 4:4:4 and one component, with Pillow's own decode as the reference and a ±2 levels tolerance; plus the budget and a non-JPEG stream.What the fixtures do and do not cover
The 4:4:4 fixture is deliberate: no chroma upsampling, so a bug in the block/IDCT/Huffman path is not masked. The survivors of the mutation run name the missing fixtures — 4:2:0 (fancy upsampling), CMYK/YCCK, restart intervals, 16-bit quantisation, malformed streams — and they are the next tests.
Evidence
dotnet build -c Release→ 0 warnings, 0 errors;dotnet test→ 1246 passed, 0 failed onnet10.0andnet11.0.JpegDecoder.cs→ 61.65% (671 mutants: 351 killed, 114 survived, 105 no coverage).docs/mutation-testing.mdreads the survivors.check: ok); ADR-005, parity row 14, chapter 8 and the changelog record the slice.Next
SOF2 (progressive), then the 4:2:0/CMYK/restart fixtures, then
JPXDecodeandJBIG2Decodeper ADR-005.