Skip to content

fix(conformance): count colour channels in the JPEG 2000 rule - #793

Open
Tim81 wants to merge 21 commits into
mainfrom
fix/jpx-rule-colour-channels
Open

Tim81 wants to merge 21 commits into
mainfrom
fix/jpx-rule-colour-channels

Conversation

@Tim81

@Tim81 Tim81 commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Closes #792

What changed

Jpeg2000Rule (ISO 19005-2 6.2.8.3) now counts colour channels instead of every component.

  • The channels are numbered as ISO/IEC 15444-2 M.5.1.2 numbers them: by component, or, when the file has a palette (pclr) and a component mapping (cmap) box, by the mapping box's entries, a palette channel having its column's depth.
  • A channel is a colour channel when any description of it in the channel definition (cdef) box has type 0 (ISO/IEC 15444-1 I.5.3.6, read on NEN Connect, paraphrased), and every channel is one when the file has no such box. A channel may carry several descriptions; one with a type 0 description and an opacity description counts once, as colour. A description whose channel index names no channel describes nothing and is ignored. A JPX file's first compositing layer header (jplh) replaces the cdef with its own cdef or an Opacity (opct) box (15444-2 M.11.7, M.11.7.6, M.9.2.2, held and checked with clause_check.py), and the codestream header (jpch) of the layer's codestream overrides ihdr, pclr and cmap box by box (M.11.6, M.5.2.1), a bpcc going with its ihdr (M.11.5.1).
  • One table, in the class remarks of Jpeg2000Rule, covers seven boxes: the ones whose contents decide which channels the rule counts and how deep they are, ihdr (rows I1 to I9), bpcc (B1 to B7), pclr (P1 to P6), cmap (C1 to C6), cdef (D1 to D10), opct (O1 to O6) and creg (G1, G2). Each row gives a requirement of the clause it cites, or says it is a definition or a reading, where it applies, and what failing it does, and has a test in PdfPreflightTests.Jpeg2000Rows.cs. What failing a row does is in that row's effect cell and is not restated here. Tests 2 to 4 read the colr boxes of the jp2h whose contents hold METH, PREC, APPROX and at least one byte of METHDAT (15444-2 M.11.7.2: its length may not be 0); a box whose contents are 3 bytes or fewer is no longer counted. C5 and C6 are field definitions, not shalls, and say so.
  • Scope. The class remarks list what the rule reads and does not follow. The rows P1, C1, D1 and B2 count the boxes of a jp2h only: 15444-2 M.11.5.2, M.11.6, M.11.7 and M.11.7.5 give a jpch and a jplh these boxes' structure and no count, so the first of two there is read, except that a jpch bpcc beside no jpch ihdr is not read at all. D3 to D6 are asked whatever the File Type box lists, and only when the channels are numbered, as D1 (see "Not done" for M.11.7.5). B4 refuses a bpcc box of other than NC bytes when BPC is 255: main read the first NC bytes of a longer one, so r3y-bpcc-long loses its finding 5. A bpcc box goes with the ihdr it explains (M.11.5.1): a jpch bpcc beside no jpch ihdr is not read with the jp2h ihdr. P2 is asked of the pair of boxes the rule reads, which is a reading of M.5.2.1. D5 treats one channel described as both opacity and premultiplied opacity for one colour as both ("not both"). D6 asks the palette column's sign for a palette channel, a reading of Table I.16, and asks premultiplied opacity (type 2) for an unsigned component as well, a reading too (type 2 is defined as type 1 with the opacity multiplied in).
  • The previous gate was written from an idea of the boxes: it refused a cdef that describes one channel twice and any file with a jpch or creg box, which the clauses allow, and it trusted a palette without values, a reserved channel type, a repeated type and association pair and a mapping of type 0 with a palette column, which they forbid.
  • The equal-depth requirement is limited to colour channels.
  • Tests 2, 3 and 4 already ran with or without /ColorSpace on main; they are pinned by tests against veraPDF, which skips them when /ColorSpace is present.
  • Class docs, ConformanceCatalog notes for 6.2.8.3-1 to -5, row D7 in docs/conformance-divergences.md and the 6.2.8.3 row of docs/conformance-v2.4.md say where veraPDF differs.

No output bytes change: the rule's findings are a report and no save is refused or altered.

Findings that appear and disappear

Preflight (PDF/A-2b) over 359 generated variants (the 293 of the earlier rounds and 66 added in review), each three ways (with /ColorSpace, without, and through the image loader into a Layout document), on main (2d587c2, built from a git archive of that commit) and on this branch (464a08b): 1,077 runs, 465 differ, in 171 variants. In the direct runs 125 variants lose a finding, 42 gain one and one goes from 1 to 5; three differ in the loader run only (r2-opct-with-palette-2cols, r3x-opct-ck-palette16-1byte, r3x-jp2h-cdef-first-jpch-ihdr). Each assembly was built from its own tree and the probe printed the path of the DLL it loaded (the head's informational version is 2.3.3+d5d1e46...; the commit after it changes documents only). Classification: the variants of the earlier rounds that still differ from main keep the reading of the table built in round 3 from a build that logged the failing row, and a script checked that each table cell still covers the measured cs and nocs values; a build of the head with a log line at every row's failure point (findings equal to the plain head on all 1,299 runs) logged the failing rows: 169 of the 171 cells match their logged row or are "text" with none logged, and the two "scope" cells logged the several-codestreams branch. The image loader (JpxImageLoader) re-emits the signature, File Type, jp2h and first codestream box and drops the other top-level boxes, so a compositing layer header and a codestream header are not in the file it writes and the loader run reads the jp2h alone. The reviewer's 39 further variants (r5-*) run the same way: 13 differ from main (3 gain a finding, 10 lose one; logged rows B2, B4, D4 and D6; none for the three variants with a colr box whose contents are 3 bytes and the three whose jpch brings its own ihdr). The 35 r6-* variants of the last review: 7 differ (1 gains, 6 lose; logged rows B2 and B4, and none for the three colr variants). Against the previous head (fe0f870) 7 variants moved, in their cs and nocs runs only, all with a jpch bpcc beside no jpch ihdr (r3x-jpch-bpcc-only-uniform-jp2h-8-16, r5-b2-jpch-bpcc-only-two, r5-b2-jp2h-two-jpch-bpcc-only, r6-i5-jp2h255-nobpcc-jpch-bpcc-8-8-16, r6-i5-jp2h255-nobpcc-nc2-jpch-bpcc-8-16, r6-i5-jp2h255-nobpcc-jpch-label-bpcc, r6-i5-jp2h255-bpcc-jpch-bpcc-uniform); each of the seven now equals main. The other 1,285 runs are unchanged.

"Text" means the file is as the clauses allow and the finding changes because the rule now counts colour channels or numbers the channels; a row name means the box fails that row.

Findings that appear (direct runs):

Reading Variants Before After
text: palette channels counted (M.5.1.2); that many colour channels (9) f2-pclr-npc255, pclr-1c-five-cols, pclr-1c-rgb-cols-16-16-8, pclr-1c-two-cols, r2-pclr-16bit-2byte-values-2cols, r3x-big-pclr-1024x255x38, r3x-pclr-ne1-2cols, r3x-pclr-ne1024-2cols, r3x-pclr-npc255-ne2-exact - 1 or 5
text: palette column depths (a depth outside 1 to 38, or columns of different depths): 6.2.8.3-5 on the channels; P6 has no effect (7) r2-pclr-col-depth39, r3x-pclr-9-1-16-exact, r3x-pclr-col128-exact, r3x-pclr-col39-exact, r4-p6-col26, r4-p6-col7F, r4-p6-colA6 - 5
text: jpch boxes override the jp2h ones one by one (M.5.2.1); two boxes in a jpch are not counted, the first is read (P1, C1 scope); the loader drops the jpch (5) r3x-jpch-cmap-only-jp2h-pclr-cmap, r3x-jpch-ihdr-nc5-jp2h-nc3, r3x-jpch-label-then-ihdr-nc2, r3x-jpch-two-pclr, r3y-jpch-two-identical-cmap-rgb-16-16-8 - 1 or 5
text: the jpch of the layer's one codestream brings its own palette (M.5.2.1); the loader drops the jpch (4) f2-creg-cdn1-jpch1-palette, f2-creg-one-cs-jpch-palette, f2-jpch-palette-no-creg, r3x-creg-cdn0-two-jpch - 1
text: two colour channels; D8 has no effect (3) cdef-two-colour-one-alpha, r3y-cdef-srgb-only-R-G-described-plus-A, r4-d8-srgb-rg-unspec - 1
text: two colour channels; types 2 and 65535 are not colour (3) r3x-cdef-typ2-ok-third, r3x-cdef-typ65535-asoc1-asoc2, r3x-cdef-typ65535-unspec-third - 1
text: 65535 palette channels, every one colour (1) r3x-big-cmap65535-cdef65535 - 1
text: Otyp 0 on one channel leaves no colour channel (M.11.7.6) (1) r2-opct-otyp0-nc1 - 1
text: P2 asked of the pair read (the jpch pclr completes the jp2h cmap); the loader run reads the jp2h alone and P2 fails there (1) r3x-jpch-pclr-only-jp2h-cmap-only - 1
text: a chroma-key box over 16-bit palette channels with exactly its bytes: two colour channels (1) r3x-opct-ck-palette16-exact - 1
text: a cmap of no entries reads as no channels, so no colour channel (no row) (1) r3x-cmap-zero-entries-cdef - 1
text: a mapping of one palette column and one direct component: two channels (1) r2-cmap-mtyp0-pcol0 - 1
text: no colour channel (1) cdef-single-opacity - 1
text: the jpch ihdr and bpcc override the jp2h ones (M.5.2.1); the loader drops the jpch (1) f2-jpch-ihdr-bpcc - 1,5
text: the jpch's pclr overrides the jp2h's two (the replaced boxes are not read); the loader run reads the jp2h boxes and P1 fails there (row P1) (1) r3x-jp2h-two-pclr-jpch-one-pclr - 1
text: two colour channels (D5 allows one opacity channel for each colour) (1) f2-cdef-opacity-for-two-colours-two-channels - 1
text: two colour channels (the opacity channel has two descriptions) (1) r2-md-two-colour-a-twice - 1

Findings that disappear (direct runs):

Reading Variants Before After
row D4 (16) big-cdef-nc16384-colour, cdef-all-opacity, r2-dp-grey-five-Y, r2-dp-grey-twice, r4-d4-jp2, r4-d4-jp2br-jpxcl, r4-d4-jpxempty, r4-d4-jpxjp2, r4-d4-jpxonly, r4-d4-noftyp, r4-d4-short, r4-d4-two-ftyp, r4-jplh-d4-jpxjp2, r4-jplh-d4-jpxjp2-creg-cdn0, r4-jplh-d4-jpxjp2-creg-cdn1, r4-jplh-d4-jpxonly 1 -
row D3 (12) cdef-g-reserved3, r4-d3-jp2, r4-d3-jp2br-jpxcl, r4-d3-jpxempty, r4-d3-jpxjp2, r4-d3-jpxonly, r4-d3-noftyp, r4-d3-short, r4-d3-two-ftyp, r4-d3only-grey-jpxonly, r4-jplh-d3-jpxjp2-creg-cdn1, r4-jplh-d3-jpxonly 1 or 5 -
row D5 (8) r4-d5-jp2, r4-d5-jp2br-jpxcl, r4-d5-jpxempty, r4-d5-jpxjp2, r4-d5-jpxonly, r4-d5-noftyp, r4-d5-short, r4-d5-two-ftyp 1,5 -
row D6 (8) r4-d6-jp2, r4-d6-jp2br-jpxcl, r4-d6-jpxempty, r4-d6-jpxjp2, r4-d6-jpxonly, r4-d6-noftyp, r4-d6-short, r4-d6-two-ftyp 5 -
row D7 (8) cdef-channel-outside, cdef-dup-colour, cdef-dup-conflict, cdef-dup-conflict-rev, r3x-d7-rgb-fourth-undescribed-16, r3x-d7-two-colour-third-undescribed-16, r3y-d7-rgb-desc-8-8-16-fourth-undescribed, r4-d7-jpxonly 1 or 1,5 or 5 -
row D2 (7) cdef-declared-0-trailing, cdef-declared-65535-short, cdef-declared-fewer, cdef-declared-more, r3x-cdef-gg-minus1, r3x-cdef-gg-plus1, r4-d2-jpxonly 1 or 1,5 or 5 -
text: the layer header's cdef or Opacity box replaces the jp2h definition (M.11.7, M.11.7.6); the loader drops the layer header (6) jpx-jplh-cdef-ga, jpx-jplh-opct-ga, jpx-jplh-opct-rgba-a16, r2-jplh-cdef-and-jp2h-cdef, r2-opct-jp2-brand-only, r2-opct-otyp1-ga 1 or 5 -
text: channels numbered through cmap (M.5.1.2); the cdef gives 1, 3 or 4 colour channels of one depth (5) pclr-2c-alpha-index-grey-cdef, pclr-2c-index-alpha-grey-cdef, pclr-2c-index-alpha-rgb-cdef, pclr-3c-cmap-reorders, pclr-3c-mapped-depths 1 or 1,5 or 5 -
text: one colour channel (grey); opacity, premultiplied or unspecified type is not colour (Table I.16) (5) cdef-g-premult, cdef-g-premult-8-16, cdef-g-unspec, cdef-ga, cdef-ga-8-4 1 or 1,5 -
row D1: a second cdef in jp2h (3) cdef-two-boxes-first-ga, cdef-two-boxes-first-gg, r4-d1-jpxonly 1 or 5 -
row G2 (3) f2-creg-bad-length, r3x-creg-n0, r3x-creg-n1-plus1 1 -
row I3 (3) big-cdef-nc65535-colour, big-cdef-nc65535-opacity, f2-ihdr-nc16385 1 -
text: a channel with two descriptions; the colour channels are 1 or 3 and one depth (3) r2-md-ga-twice, r2-md-ga-twice-4, r2-md-rgba-a-twice-a16 1 or 1,5 or 5 -
text: colour channels only; an RGB file with a 16-bit opacity channel has one depth over R, G, B (6.2.8.3-5) (3) cdef-argb-a16, cdef-rgba-a16, cdef-rgba-reversed-entries 5 -
row C3 (2) r2-cmap-mtyp2, r2-cmap-mtyp255 1 -
row C5 (2) r2-cmap-comp-beyond-nc, r3x-cmap-cmp-eq-nc-8-16 1 or 1,5 -
row D2: the contents are shorter than the 2-byte N (2) cdef-payload-1byte, cdef-payload-empty 1 -
row I1 (2) cdef-before-ihdr, f2-ihdr-second 1 or 1,5 -
row I2 (2) f2-ihdr-15-bytes, r3x-jpch-ihdr-15-bytes-jp2h-nc2 1 -
row O3 (2) r2-opct-empty-ga, r2-opct-otyp3-ga 1 -
row O4 (2) r2-opct-otyp0-trailing-ga, r3x-opct-otyp1-trailing 1 -
row O5 (2) r2-opct-otyp2-nch-mismatch-ga, r3x-opct-ck-nch-plus1 1 -
row O6 (2) f2-opct-ck-16bit-short, r3x-opct-ck-cv-long 1 -
row scope: a layer of several codestreams is not numbered (2) f2-creg-two-codestreams, r3x-creg-n2-same-cs 1 -
text: one colour channel, so 6.2.8.3-1 is gone; the 1 to 38 range still checks every component (2) cdef-ga-bpc-out-of-range-alpha, cdef-ga-bpc-out-of-range-colour 1,5 5
row B4: a bpcc box of other than NC bytes leaves the depths unknown (main read the first NC bytes) (1) r3y-bpcc-long 5 -
row C2 (1) r2-cmap-len5 1 -
row C6 (1) r2-cmap-pcol-beyond-cols 1 -
row G1 (1) f2-creg-two-boxes 1 -
row I5: BPC 255 without a bpcc leaves the depths unknown; and text: one colour channel (1) cdef-ga-bpcc-missing 1 -
row O1 (1) r2-opct-two-in-jplh-ga 1 -
row P4 (1) r2-pclr-header-only 1 -
text: CMYK with a 16-bit channel; four colour channels, K at 16 bits: 5 only (1) r2-md-cmyk-a-twice-k16 1,5 5
text: one colour channel (the palette column), the other is opacity (1) r2-pclr-cmap-depths-16-8-cdef-ga 1,5 -
text: the last channel is premultiplied opacity (M.11.7.6); the loader drops the layer header (1) r3x-opct-otyp1-ok-rgb-a16 5 -
text: three colour channels (R, G, B); D5 asks associations 1 to 65534 only (1) r3y-d5-opacity0-premult0-two-channels 1 -
text: three colour channels; D5 allows one opacity channel for each colour (1) cdef-rgb-a-a 1 -
text: type 65535 is not colour, and 65535/65535 may repeat (D4) (1) r2-dp-unspec-pair-allowed-16 5 -

Other:

Reading Variants Before After
row O6 (1) r3x-opct-ck-palette16-1byte - -
text: colour columns of 8, 8 and 16 bits: 6.2.8.3-5, and three colour channels remove 6.2.8.3-1 (1) r2-pclr-cmap-rgb-a-cdef-b16 1 5
text: direct runs 1 as main; the loader run drops the jpch and, with the cdef before the ihdr, I1 (row I1) (1) r3x-jp2h-cdef-first-jpch-ihdr 1 1
text: the layer's Opacity box makes the last of the two palette channels opacity; the direct run reads one colour channel; the loader drops the layer header and reads two colour channels (1) r2-opct-with-palette-2cols - -

How this rule and the loader report (#787) agree

Read from the source of fix/image-audit-gaps at 9583ec6 (not measured): its loader also counts the type-0 entries of the first cdef box, compares depths over the colour channels only, and ignores a cdef shorter than its count. So for a plain grey + opacity or RGB + opacity file, the 501 report and this rule agree that there is nothing to report. They differ where this rule reads more: a cdef that fails a row (the loader counts its type-0 entries, this rule does not read it), a palette file (the loader keeps the name and does not read the box; this rule numbers the channels through cmap), and a compositing layer header (the loader drops it). The 6.2.8.3 row in docs/conformance-v2.4.md is edited here, and #787 edits the same row: if #787 merges first, take its row, which already says colour channels.

veraPDF parity

Jpeg2000VeraPdfParityTests runs 16 cases through both validators and pins the 6.2.8.3 test numbers each reports. All 16 give the same verdicts on veraPDF 1.30.2 and on 1.30.4, each run here against its own install.

Case This library veraPDF Reason
grey + opacity, cdef none 1 veraPDF counts every channel
grey 8 + opacity 4, cdef none 1, 5 same
RGB 8 + opacity 16, cdef none 5 veraPDF compares every channel's depth
two colour + opacity, cdef 1 none veraPDF counts three channels
opacity only, cdef 1 none veraPDF counts one channel
palette RGBA through cmap and cdef none none agree
palette of two columns, no cdef 1 none veraPDF counts the one component
grey + opacity through a layer header Opacity box none 1 veraPDF counts two components
two channels, no cdef 1 1 agree
RGB colour depths differ, cdef 5 5 agree
two APPROX 0, with /ColorSpace 2 none veraPDF skips test 2 then
two APPROX 0, without 2 2, 3 veraPDF also fails test 3 for two METH 1 boxes
METH 4, with / without /ColorSpace 3 / 3 none / 3 veraPDF skips test 3 then
CIEJab, with / without 4 / 4 none / 4 veraPDF skips test 4 then

Mutations

Run in a detached worktree at the head, each restored afterwards; each build's DLL timestamp was printed to confirm the mutation was in the run. Tests run: the 145 Jpeg2000_* cases of VellumPdf.Conformance.Tests, net10.0.

Mutant Result
ihdr need not be the first box killed by 1: RowI1_IhdrMustBeTheFirstBoxOfJp2h
ihdr of 14 bytes or more killed by 1: RowI2_IhdrContentsAreFourteenBytes
NC above 16384 accepted killed by 1: RowI3_NcIsOneTo16384(nc: 16385, read: False)
NC 0 accepted (equivalent: NC 0 leaves nothing to check either way) survives
second pclr accepted killed by 2: ASecondPaletteOrMappingBox_IsNotTrusted and others
second cmap accepted killed by 2: ASecondPaletteOrMappingBox_IsNotTrusted and others
pclr without cmap (or the reverse) accepted killed by 2: PaletteWithoutItsMappingBoxOrTheOtherWayRound_IsNotTrusted and others
pclr shorter than NE and NPC accepted killed by 1: RowP3_PclrTooShortForNeAndNpcIsNotRead
NE 0 accepted killed by 1: RowP3_NeIsOneTo1024(entries: 0, read: False)
NE 1025 accepted killed by 1: RowP3_NeIsOneTo1024(entries: 1025, read: False)
NPC 0 accepted killed by 1: RowP4_NpcIsOneTo255AndEveryColumnHasItsByte
B bytes missing for the columns accepted killed by 1: RowP4_NpcIsOneTo255AndEveryColumnHasItsByte
pclr longer than its values accepted killed by 2: RowP5_PclrContentsHoldNpcTimesNeValuesOfTheirColumnWidth and others
pclr shorter than its values accepted killed by 4: RowP5_PclrContentsHoldNpcTimesNeValuesOfTheirColumnWidth and others
value width rounded down killed by 5: PaletteColumnsOfDifferentDepths_AreColourChannelsOfDifferentDepths_Finding5 and others
sign bit counted in the value width killed by 1: APaletteColumnsSignBitIsNotPartOfItsDepthOrItsWidth
cmap length not a multiple of 4 accepted killed by 1: RowC2_CmapContentsAreWholeFourByteEntries
mapping type 2 to 255 accepted killed by 4: RowC3_ReservedMappingTypesAreNotRead(type: 3) and others
PCOL nonzero under MTYP 0 accepted killed by 1: RowC4_PcolIsZeroWhenMtypIsZero
CMP past NC accepted killed by 1: RowC5_CmpNamesAComponentOfTheCodestream
CMP past NC checked for MTYP 0 only killed by 1: RowC5_CmpNamesAComponentOfTheCodestream
PCOL past NPC accepted killed by 1: RowC6_PcolNamesAPaletteColumnWhenMtypIsOne
second jp2h cdef accepted killed by 2: TwoCdefBoxes_AreNotTrusted_WhicheverComesFirst and others
second layer cdef accepted killed by 1: RowD1_AtMostOneCdefInALayerHeader
N 0 accepted killed by 1: RowD2_CdefHasAtLeastOneEntryAndExactlyTheBytesItsCountGives
bytes after the last entry accepted killed by 1: CdefWithBytesAfterItsLastEntry_IsNotTrusted
fewer bytes than the count accepted killed by 1: RowD2_CdefHasAtLeastOneEntryAndExactlyTheBytesItsCountGives
reserved type accepted killed by 2: RowD3_ATypeInTheReservedRangeIsNotRead(type: 65534, read: False) and others
repeated pair accepted killed by 1: RowD4_NoTwoChannelsShareATypeAndAssociation
65535/65535 pair refused killed by 1: RowD4_TheUnspecifiedPairMayRepeat_AndOneChannelMayRepeatAPair
one channel's repeated pair refused killed by 1: RowD4_TheUnspecifiedPairMayRepeat_AndOneChannelMayRepeatAPair
two opacity channels for one colour accepted killed by 1: RowD5_AColourHasAtMostOneOpacityChannel
one opacity channel described twice for a colour refused killed by 1: RowD5_OneOpacityChannelMayBeDescribedForSeveralColours
signed opacity accepted killed by 1: RowD6_OpacityComesFromAnUnsignedComponent
description past the last channel refuses the box killed by 1: ADescriptionOfAChannelThatDoesNotExist_DescribesNothing
last description of a channel decides colour killed by 2: AChannelWithSeveralDescriptions_IsColourWhenAnyIsType0 and others
second opct accepted killed by 1: RowO1_AtMostOneOpacityBoxInALayerHeader
opct with cdef in one layer accepted killed by 2: LayerWithBothAnOpacityBoxAndACdef_IsNotTrusted and others
reserved Otyp read as colour killed by 2: LayerOpacityBoxOfAReservedType_IsNotTrusted(type: 3) and others
empty opct read as colour killed by 1: RowO3_OtypIsZeroOneOrTwo
byte after Otyp 0 or 1 accepted killed by 2: RowO4_OtypZeroAndOneCarryNoOtherField and others
NCH not compared killed by 1: RowO5_ChromaKeyNchIsTheNumberOfChannels
NCH byte read without a length check killed by 1: RowO5_ChromaKeyNchIsTheNumberOfChannels
chroma-key values unchecked killed by 1: RowO6_ChromaKeyValuesTakeTheirChannelsDepthRoundedUpToBytes
chroma-key depth rounded down killed by 1: RowO6_ChromaKeyValuesTakeTheirChannelsDepthRoundedUpToBytes
Otyp 0 on one channel refused killed by 1: AnOpacityBoxOfOtyp0OnOneChannel_LeavesNoColourChannel
several codestreams numbered killed by 3: ALayerOfSeveralCodestreams_IsNotNumbered and others
creg codestream number ignored killed by 1: ACregNamingCodestream1_ReadsTheSecondCodestreamHeader
jpch ihdr ignored killed by 1: TheCodestreamHeadersIhdrAndBpccOverrideTheJp2hDefaults
jpch bpcc ignored killed by 1: TheCodestreamHeadersIhdrAndBpccOverrideTheJp2hDefaults
jpch pclr ignored killed by 2: ACregNamingCodestream1_ReadsTheSecondCodestreamHeader and others
jpch cmap ignored killed by 2: ACregNamingCodestream1_ReadsTheSecondCodestreamHeader and others
jpch ignored killed by 3: ACregNamingCodestream1_ReadsTheSecondCodestreamHeader and others
cdef ignored (every channel colour) killed by 24: RowD2_CdefHasAtLeastOneEntryAndExactlyTheBytesItsCountGives and others
opacity counted for depth killed by 7: RgbPlusOpacityOf16Bits_WithRgbAt8_NoFinding and others
layer Opacity box ignored killed by 14: RowO4_OtypZeroAndOneCarryNoOtherField and others
layer cdef ignored killed by 2: RowD1_AtMostOneCdefInALayerHeader and others
jp2h cdef wins over the layer's killed by 1: LayerCdef_IsReadAsM117SaysAReaderDoes_ThoughABaselineFileHasNone
palette channel takes the component's depth killed by 2: PaletteColumnsOfDifferentDepths_AreColourChannelsOfDifferentDepths_Finding5 and others
palette depth always column 0 killed by 1: PaletteColumnsOfDifferentDepths_AreColourChannelsOfDifferentDepths_Finding5
palette sign bit counted in the depth killed by 1: APaletteColumnsSignBitIsNotPartOfItsDepth
channel count off by one killed by 22: ACregNamingCodestream1_ReadsTheSecondCodestreamHeader and others
range not checked on components killed by 2: ThePaletteIndexComponentOutsideTheDepthRange_IsStillFinding5 and others
range not checked on channels killed by 1: APaletteColumnOutsideTheDepthRange_IsFinding5
component sign bit counted in the depth killed by 2: RowD6_OpacityComesFromAnUnsignedComponent and others
undescribed channel accepted killed by 2: CdefCountBelowTheChannelCount_IsNotTrusted and others
second creg accepted killed by 1: RowG1_AtMostOneCregInALayerHeader
creg of other than 4 + 6n bytes accepted killed by 1: RowG2_CregContentsAreFourBytesAndWholeSixByteEntries

The 69 rows above ran in three passes; the first was at the commit before the last tests were added, and the rows whose tests changed afterwards (D2, D5, O3, O5, O6, P4, P5, palette sign, range, G1, G2, D7) were run again at the head. The lane's mutant that gates APPROX on /ColorSpace was not run again: no line it touches changed. Row I3's lower bound is an equivalent mutant, because NC 0 leaves nothing to check whether the row refuses it or not.

Mutations for the table rows added later

Run in a detached worktree at the head, each restored afterwards, DLL timestamp printed; Jpeg2000* cases of VellumPdf.Conformance.Tests, net10.0 (189, 16 parity cases skipped without the oracles). Rows: P1, C1, D1, P2, I4, I5, I7, I8, P6, D5, D6, D8 to D10, G2 and six mutants (S1 to S6) that a weaker test set had let survive plus a throw in five more rows. Mutants of code that no longer exists (the File Type condition and two lines of the I5 check) are not listed; the next section has the mutants of the rows that replaced them.

Mutant Result
P1-counted-in-jpch killed by 1: RowP1_AJpchHoldingTwoPclrBoxes_ReadsTheFirst
C1-counted-in-jpch killed by 1: RowC1_AJpchHoldingTwoCmapBoxes_ReadsTheFirst
D1-counted-in-layer killed by 1: RowD1_ALayerHeaderHoldingTwoCdefBoxes_ReadsTheFirst
D1-jp2h killed by 3: RowD1_AtMostOneCdefInAHeader
P2-jp2h-pair killed by 2: ACodestreamHeadersCmapReplacesTheJp2hOneWithoutAJpchPalette
I4-refuse-reserved-bpc killed by 3: RowI4_ABpcOutsideTableI6_IsReadAndReportedByTest5(bpc: 127, outsideRange: True)
I5-bpcc-from-jp2h killed by 1: RowI5_AJpchIhdrWithBpc255TakesItsBpccFromTheJpchNotFromTheJp2h
I7-refuse-c killed by 3: RowI7_TheCompressionTypeDoesNotChangeWhatIsRead(c: 0)
I8-refuse-unkc killed by 2: RowI8_UnkCAndIprDoNotChangeWhatIsRead(unkC: 2, ipr: 2)
I8-refuse-ipr killed by 2: RowI8_UnkCAndIprDoNotChangeWhatIsRead(unkC: 2, ipr: 2)
D5-ignores-type killed by 1: RowD5_ANonColourAssociationIsNotColourOne_AndOneChannelWithBothTypesIsBoth
D5-asoc0 killed by 1: RowD5_ANonColourAssociationIsNotColourOne_AndOneChannelWithBothTypesIsBoth
D5-same-channel-twice-refused killed by 2: RowD5_ANonColourAssociationIsNotColourOne_AndOneChannelWithBothTypesIsBoth
D6-component-sign-for-palette killed by 1: RowD6_ForAPaletteChannelTheSignOfTheColumnDecides_NotThatOfTheIndexComponent
D8-refuse-fewer-than-3-colour killed by 12: RowD3_ATypeInTheReservedRangeIsNotRead(type: 2, read: True)
D9-refuse-all-colour killed by 12: AChannelWithSeveralDescriptions_IsColourWhenAnyIsType0
D10-refuse-reversed killed by 2: RowD10_AMultipleComponentTransformIsNotLookedFor_TheBoxIsReadAsWritten
G2-n-at-least-1 survives
S1-P5-throws killed by 6: RowP1_AJpchHoldingTwoPclrBoxes_ReadsTheFirst
S2-D4-throws killed by 3: RowD1_ALayerHeaderHoldingTwoCdefBoxes_ReadsTheFirst
S3-D5-asoc0 killed by 1: RowD5_ANonColourAssociationIsNotColourOne_AndOneChannelWithBothTypesIsBoth
S4-jpch-ihdr-first killed by 1: ACodestreamHeadersIhdrNeedNotBeItsFirstBox
S5-jpch-cmap-needs-jpch-pclr killed by 1: ACodestreamHeadersCmapReplacesTheJp2hOneWithoutAJpchPalette
S6-D6-component-sign killed by 1: RowD6_ForAPaletteChannelTheSignOfTheColumnDecides_NotThatOfTheIndexComponent
T-P3-throws killed by 1: RowP3_PclrTooShortForNeAndNpcIsNotRead
T-C3-throws killed by 3: RowC3_ReservedMappingTypesAreNotRead(type: 2)
T-D2-throws killed by 3: RowD2_CdefHasAtLeastOneEntryAndExactlyTheBytesItsCountGives
T-D7-throws killed by 2: RowD7_EveryChannelHasADescription
T-O6-throws killed by 1: RowO6_ChromaKeyValuesTakeTheirChannelsDepthRoundedUpToBytes
I6-ihdr-nc-ignored KILLED by 66 (NC from the ihdr is what every test reads)
P6-refuse-column-depth KILLED by 1: RowP6_APaletteColumnOutsideTheDepthRange_IsReadAndReportedByTest5

G2-n-at-least-1 survives and is equivalent: an n of 0 also fails the next test (exactly one codestream), so the row changes the text and not the result. The D8 to D10, I6 and I7 mutants make a no-effect row refuse its box, which shows the test pins the reading.

Mutations for the bpcc and colr rows of the previous round

Run in a detached worktree at 0c17e76, each restored afterwards (git status clean at the end); the script printed the DLL timestamp and checked the mutated text was in the source. The colr tests were named RowK1_... to RowK5_... then and are Colr_* now, and the test names in this table are the current ones; K1-count-short-colr (a colr of 1 or 2 bytes counted) no longer applies, because the rule's threshold is now 4 bytes and the mutant's text is gone. Tests: the Jpeg2000* cases of VellumPdf.Conformance.Tests, net10.0 (209, 16 parity cases skipped without the oracles). A row with effect "none" and no code has a mutant that makes the rule refuse where the row says it reads, which shows its test pins the reading. The code that read the File Type box is gone, so it has no mutants of its own.

Mutant Result
B2-counted-in-jpch (a jpch holding two bpcc untrusted) killed by 1: RowB2_AJpchHoldingTwoBpccBoxes_ReadsTheFirst
B2-never-counted (two bpcc in a jp2h read from the first) killed by 1: RowB2_AtMostOneBpccInAJp2h
B4-long-read (a bpcc of more than NC bytes read) killed by 1: RowB4_BpccHoldsOneByteForEachComponent
B4-short-read (any non-empty bpcc read) killed by 2: RowB4_BpccHoldsOneByteForEachComponent and RowI5_Bpc255NeedsABpccBoxWithADepthForEveryComponent
B3-read-when-bpc-not-255 killed by 1: RowB3_ABpccNextToABpcOtherThan255_IsNotRead
B1-bpcc-must-follow-ihdr (a jpch bpcc before its ihdr dropped) killed by 1: RowB1_ABpccBeforeTheIhdrOfAJpch_IsStillRead
B5-refuse-contradicting-bpcc (a bpcc whose depths are not 8 refused) killed by 25, among them RowB5_ABpccThatContradictsTheCodestream_IsReadAsWritten
B7-refuse-out-of-range-entry killed by 7, among them RowB7_ABpccEntryOutsideTableI8_IsReadAndReportedByTest5
I9-refuse-height-0 killed by 1: RowI9_HeightAndWidthAreNotRead(height: 0, width: 0)
I9-refuse-width-max killed by 1: RowI9_HeightAndWidthAreNotRead(height: 4294967295, width: 4294967295)
K1-count-short-colr (a colr of 1 or 2 bytes counted) killed by 1: Colr_AColrWithNoMethdat_IsNotCounted
K2-ignore-meth-above-4 (such a box not counted for test 2) killed by 1: Colr_AMethOutsideTableM22_IsCountedAndJudgedByTest3
K3-count-approx-above-1 killed by 3: Colr_AnApproxOtherThanOne_IsNotCountedAsOne and two more
K4-enumcs-from-6-bytes killed by 1: Colr_TheEnumeratedColourSpaceIsTheFourBytesAfterApproxOfAMeth1Box
K4-enumcs-exactly-7 (bytes after the field refuse it) killed by 1: the same test
K4-meth-not-checked (the field read and reported whatever METH) killed by 1: the same test
K4-enumcs-for-meth2 (the field read for METH 2 as well) survives, equivalent: test 4 reports only when METH is 1, so a field stored for a METH 2 box is never consulted; K4-meth-not-checked removes both and is killed
K5-first-colr-only (test 4 reads the first colr only) killed by 1: Colr_AnEnumeratedColourSpaceOtherThan161718_IsReadAndOnly19IsReported
K5-refuse-above-18 (EnumCS above 18 reported) killed by 1: the same test
D6-type1-only (premultiplied opacity not asked) killed by 1: RowD6_APremultipliedOpacityChannelComesFromAnUnsignedComponentToo
D6-never killed by 4: that test, RowD6_OpacityComesFromAnUnsignedComponent and two more
relaxation-reinstated (D3 to D6 skipped when the File Type box lists no jp2 ) killed by 1: RowsD3ToD6_AreAskedWhateverTheFileTypeBoxLists

Mutations for the narrowed table, the colr length and the bpcc length cases

Run in a detached worktree at 4652ca7, restored afterwards (git status clean); the script checked the mutated text was in the source. Tests: the Jpeg2000* cases of VellumPdf.Conformance.Tests, net10.0 (207, 16 parity cases skipped without the oracles). The table's rows for the File Type box and colr no longer exist, so their mutants are gone with them.

Mutant Result
K1-3-byte-colr-counted (a colr of 3 bytes counted, as before) killed by 1: Colr_AColrWithNoMethdat_IsNotCounted
B4-jpch-long-read (a jpch bpcc longer than NC read from its first NC bytes) killed by 1: RowB4_AJpchBpccOfAnotherLength_IsRefusedToo (survived the previous round)
B4-jp2h-short-by-one-read (a jp2h bpcc of NC-1 bytes read, its last entry repeated) killed by 1: RowB4_BpccHoldsOneByteForEachComponent, its NC 3 case of 8 and 16 bits (survived the previous round)
B4-long-read killed by 2
B4-short-read killed by 3
B2-counted-in-jpch killed by 1: RowB2_AJpchHoldingTwoBpccBoxes_ReadsTheFirst
K4-enumcs-from-6-bytes killed by 1: Colr_TheEnumeratedColourSpaceIsTheFourBytesAfterApproxOfAMeth1Box
K4-needs-8 killed by 5

Mutations for the bpcc pairing and the other-BPC cases

Run in the head's worktree at d5d1e46, restored afterwards (git status showed only the documents changed after it); the script printed each DLL's timestamp and checked the mutated text was in the source. Tests: the Jpeg2000* cases of VellumPdf.Conformance.Tests, net10.0 (210, 16 parity cases skipped without the oracles).

Mutant Result
I5-jpch-bpcc-with-jp2h-ihdr (the previous code: a jpch bpcc with no jpch ihdr read with the jp2h ihdr) killed by 1: RowI5_AJpchBpccWithNoJpchIhdr_IsNotReadWithTheJp2hIhdr
I5-jpch-bpcc-used-when-jp2h-has-none killed by 1: the same test
I5-jpch-bpcc-preferred-over-jp2h-bpcc killed by 1: the same test (its second case)
B4-at-bpc7-untrusts (a wrong-length bpcc beside BPC 0x26 makes the depths unknown) killed by 2: RowB2_WithABpcOtherThan255TwoBpccBoxesChangeNothing and RowB4_WithABpcOtherThan255ABpccOfAnotherLengthChangesNothing
B2-at-bpc7-untrusts (two bpcc beside BPC 0x26) killed by 1: RowB2_WithABpcOtherThan255TwoBpccBoxesChangeNothing

The two B mutants survived the previous round because both read BPC 7, where unknown and known depths give no finding; the new tests use BPC 0x26 (39 bits), where test 5 reports only when the depths are known.

Cost

ReadCdefColourChannels keeps two dictionaries, one for the (type, association) pairs and one for opacity, and ResolveChannels reads each cmap entry once, so both are linear in the entry count. Channels are not bounded by NC (the mapping box makes one channel per 4 bytes), so the largest case is not the NC row's: a cmap of 65,535 entries with a cdef of 65,535 entries, trusted, in a 656,177-byte file (r3x-big-cmap65535-cdef65535). Release, net10.0, 5 Validate calls averaged, two runs: 5.5 and 4.7 ms here, 1.2 and 1.1 ms on main. A palette of 1024 entries of 255 columns of 38 bits (1,307,692 bytes): 3.2 and 1.7 ms here, 1.9 and 1.5 ms on main. Other processes ran on the machine during these runs (one test host was counted at the start, CPU load 59%), so the figures are loose; the shape, a few milliseconds for the largest file the table accepts, is what they support.

Not done

  • A cross-reference box (cref) in a layer header is not followed (15444-2 M.5.2.2, M.11.7 last paragraph, M.9.2.6): cref-opct-ga and cref-cdef-ga keep main's finding 1 where the text finds none. Following it needs the fragment-list box and the file offsets it names; filed for Tracking: defects found while doing the v2.4 work (not yet fixed) #613.
  • A colour group box (cgrp) in a layer header replaces the jp2h colour specifications for that layer (M.11.7); tests 2 to 4 still read the jp2h ones. Which set 6.2.8.3 counts then is a NEN question, so it is not guessed; filed for Tracking: defects found while doing the v2.4 work (not yet fixed) #613.
  • A cdef or an Opacity box in a layer header makes the file a non-baseline JPX (M.9.2.7); the rule reads it as M.11.7 says a reader does, and the class remarks and the test name say so.
  • Images drawn inside a form XObject are still not checked (PDF/A and PDF/UA-1 conformance rules are validated against veraPDF, not against the ISO text they cite #418).
  • The pclr, cmap and cdef layouts and the channel type values come from ISO/IEC 15444-1, which is not held; the rows rest on the notes of the NEN reading (evidence rows e13 to e19, e45 to e49, e52, e58 to e60). A wrong reading can leave a file unread, and can also make the rule report: types 65535 and 2 counted as colour would remove findings, and a cdef that describes a channel twice or names channels past the last would change them.
  • Not read: the codestream's SIZ and COD markers of a JP2 file (rows I6 and D10 are listed with no effect for that reason), a profile's colour space (row D8 has no effect), and the first codestream of a file that has a jpch for a codestream the rule does not number.
  • ISO/IEC 15444-2 M.11.7.5 lets any channel be associated with any colour or type in a JPX file that no JP2 reader can read, and in a codestream of a JPX file that such a reader will not read. The rule follows neither half: it does not read the File Type box and does not decide which codestream a JP2 reader reads, so it asks D3 to D6 whatever that box lists. The held M.11.7.5 text names additional values of the association field (Table M.32) and no new type value.
  • The table has no row for the padding of the values of a chroma key (15444-2 M.11.7.6) or for a creg box in every layer header once one has it (M.11.7.7).
  • The loader side stays with fix(images): close the image gaps the ISO audit found (#763, #764, #768, #770) #787.

Needs a NEN reading

  • 15444-1 I.5.3.5: whether CMP larger than the component count, and PCOL at or past NPC under MTYP 1, are forbidden by a sentence (rows C5 and C6 rest on the definition of the fields, not on a sentence).
  • 15444-1 I.5.3.6: whether "complete list" means every channel has a description (row D7), and whether the one-opacity-per-colour sentence covers association 0 (row D5 applies it to associations 1 to 65534 only).
  • 15444-1 I.5.3.5: whether a cmap with no entries is allowed. The rule reads it as a layer of no channels, which has no colour channel.
  • 19005-2 6.2.8.3: whether type 65535 ("not specified") counts as a colour channel; the rule says it does not.
  • 15444-1 I.5.3.4 and I.5.3.6: the exact sentences behind rows P5 and D2 (byte counts of the boxes).
  • 15444-1 I.5.3.2: row B2 reads "one and only one" together with "shall not be found" as at most one, and exactly one when BPC is 255 (I5); the notes give that as a reading of the two sentences.
  • 15444-1 Table I.16: whether the unsigned-components sentence in the type 1 row binds type 2 (row D6 says it does, a reading from the type 2 row's wording as "an opacity channel as specified above, except" the multiplication; the notes mark it as a reading, not a quotation).
  • 15444-1 I.5.2 and I.5.3.3: what the File Type box and the colr box require beyond the layout and fields tests 2 to 4 read (a JP2 file's APPROX and PREC "shall be set to zero" in the notes, against 6.2.8.3's APPROX of 1). The table does not cover either box, so no sentence of the change rests on them.

ISO 19005-2 6.2.8.3 limits the number of colour channels to 1, 3 or 4
and asks for one bit depth over the colour channels. The rule counted
every channel, as veraPDF does, so a JP2 file of one grey and one
opacity channel was reported, and so was an RGB file whose opacity
channel has another depth.

The channel definition box says which channels are colour: its type-0
entries, or every channel when the file has none (ISO/IEC 15444-1
I.5.3.6). The rule reads the box with the bounds it applies to its
other boxes and reports nothing about colour channels when the box is
shorter than its count or names a channel the codestream lacks.

Tests 2, 3 and 4 already ran with or without /ColorSpace; parity tests
against veraPDF now pin that and each case where the two differ. The
catalog notes and the divergence record say where veraPDF differs.
Findings are a report, so no saved byte changes.
Tim81 added 20 commits November 30, 2026 14:14
Review round 1 found that the colour-channel count treated every codestream
component as a channel and read cdef only in jp2h. A palette file's channels
are the entries of its component mapping box (ISO/IEC 15444-2 M.5.1.2), and a
JPX compositing layer header can replace the jp2h channel definition with its
own cdef or an Opacity box (M.11.7, M.11.7.6). The rule now numbers channels
through cmap when a palette applies, takes a palette channel's depth from its
column, and reads the first layer header.

A cdef that does not list every channel exactly once (no entries, a count the
channel count or the bytes do not support, a repeated or out-of-range channel,
trailing bytes), a second cdef, palette, mapping or Opacity box in one header,
and a file with codestream header or registration boxes are all not trusted
the same way: tests 1 and 5's uniformity half report nothing, so malformed
input yields no finding main did not already report. The repeat check uses a
seen array, so the cost is linear in the channel count.

The tests pin every malformed shape, the palette and layer cases, and the new
veraPDF parity cases. The CHANGELOG now lists the findings that appear as well
as those that disappear, and the divergence and v2.4 conformance docs match.
…alls (#792)

The trust gate of the colour-channel rule was written from an idea of the
boxes. It distrusted files the clauses allow (a channel with several
descriptions, a codestream header or registration box on one codestream)
and trusted files they forbid (a palette without values, a reserved
channel type, a repeated type and association pair, a mapping type 0 with
a palette column).

Replace it with an enumeration. The class remarks now hold one table of
the shalls the clauses put on ihdr, pclr, cmap, cdef, opct and creg,
each row citing its clause; code and tests carry the row names, and a
box is untrusted exactly when one of its rows fails. A channel is colour
when any description of it has type 0. A description naming no channel
is ignored. A layer built from one codestream is read like any other,
with or without a codestream header or a registration box, and the
header of that codestream overrides the jp2h boxes box by box.

The range half of test 5 now covers the components as well as the
numbered channels, so a palette's index component of 40 bits is a
finding again. A chroma key without its values, and an Opacity box of
type 0 on one channel, are decided by their rows instead of by a guess.
…#792)

The rule's catch-all turns any exception into "no finding", so a row test
that expects an empty result cannot tell an untrusted box from a thrown
index. Files that must report only a second, unrelated finding (a METH 4
colour box) now carry it, so a box left unread no longer hides a throw.
Also drop the creg length check "shorter than 4 bytes": the modulo check
that follows already refuses every such length.
…#792)

A palette with no columns and a mapping that uses none is refused only by the NPC row; the earlier file also failed the mapping's column row, so removing the NPC check went unnoticed.
…thing at it (#792)

The class remarks hold the table of shalls; the CHANGELOG entry, divergence
row D7 and the test comments now say a box is read unless a row fails, in
place of the earlier "lists every channel exactly once" and "channels from
several codestreams" sentences, which described a different gate. Add the
row tests that mutation testing showed to be too weak: a signed palette
column, a 39-bit column, NPC 0 with a direct-only mapping, N 0 with no
channels, a chroma key of 10-bit channels and of the wrong NCH, and an
opacity channel described twice for one colour.
R1 and R2 are the labels of an unrelated rule list; the registration box rows take G1 and G2 so a reader does not look them up in the wrong table.
#792)

The JPEG 2000 rule's table of shalls now lists each sentence that
ISO/IEC 15444-1 I.5.3.1 to I.5.3.6 and 15444-2 M.11.5.1 to M.11.7.7 put
on ihdr, bpcc, pclr, cmap, cdef, opct and creg, with the box it
applies to (jp2h, jpch, jplh) and what failing it does. A row either
leaves its box unread or is listed with the reason it changes nothing.

Rows that changed the reading:
- The "at most one" rows P1, C1 and D1 count the boxes of a jp2h only.
  15444-2 gives a jpch and a jplh the structure of these boxes and no
  count, so a second box there is no longer a reason to distrust the
  first, which is read.
- D3 to D6 are not asked of a JPX file whose File Type box does not list
  "jp2 ": M.11.7.5 lets any channel have any colour or type there.
- D5 refuses one channel described as both opacity and premultiplied
  opacity for one colour, which is the notes' "not both".
- A bpcc box goes with the ihdr it explains, so a jpch ihdr of BPC 255
  does not borrow the jp2h bpcc (M.11.5.1).
- G2 asks for at least one registration entry.

New rows with no effect, each with its reason: I4 and P6 (a depth
outside 1 to 38 is what test 5 reports), I6 to I8, D8 to D10.

Tests: every row has one; a METH 4 colr box in every row-test file shows
that a row which throws instead of refusing would end the scan before
test 3.
…eader reads (#792)

Each of the three rows now carries its own condition on the File Type
box, so a test or a mutation can show that each one is skipped there, not
just the group.
…ing row stops (#792)

The class remarks, the CHANGELOG entry and divergence D7 said the table
had a row for each shall the clauses put on the boxes. It lists each
requirement, the boxes it applies to and its effect, and says so, with
the scope of the jpch, jplh and JPX-only cases. The defensive-operation
paragraph no longer says a failing row silences the scan, and the
probe sentences about the image loader and the variant counts follow
the 293-variant run. The D7 test now has an undescribed channel whose
reading would report something.
…d colr rows (#792)

The File Type condition that skipped rows D3 to D6 is removed. It was
unbriefed, covered half of M.11.7.5 (a JPX file no JP2 reader reads, not
a codestream such a reader will not read) and reached past what the
clause says for D3: M.11.7.5 adds values of the association field and
gives no new type. D3 to D6 are asked of every file again, and the rule
does not read the File Type box.

The table now lists what the clauses put on the boxes it names:
- F1 to F3 for the File Type box (I.5.2, M.6.1.3, M.8), effect none.
- I9 for HEIGHT and WIDTH, effect none; I6 and I7 gain the JPX sentence
  of M.11.5.1 and the contradiction between Tables M.19 and M.21.
- B1 to B7 for bpcc (I.5.3.2, M.11.5.2). Two bpcc boxes in a jp2h and a
  box whose length is not NC bytes now leave the depths unknown; a longer
  box used to be read from its first NC bytes.
- K1 to K5 for colr (I.5.3.3, M.11.7.2): layout, METH, APPROX, the
  enumerated colour space and Table I.10.
- D6 asks premultiplied opacity (type 2) for an unsigned component too,
  since type 2 is defined as type 1 with the opacity multiplied in.

Every new row has a test; the tests that pinned the relaxation are
replaced by one that asks D3 to D6 under eight File Type shapes.
…1.7.5 leaves out (#792)

The class remarks, the CHANGELOG entry and divergence D7 now name the
boxes the table covers (File Type, ihdr, bpcc, colr, pclr, cmap, cdef,
opct, creg), what it leaves out (the superboxes themselves, a colr box's
precedence and profile), and that D3 to D6 are asked of every file.
M.11.7.5 is named as a limit: the rule does not read the File Type box
and does not decide which codestream a JP2 reader reads.

The probe counts are re-measured over 359 variants against current main:
172 differ, 126 lose a finding, 42 gain one.
…r with METHDAT (#792)

The class remarks claimed to list every requirement the cited clauses put
on the File Type box and colr, and each round that widened the table found
more boxes the clauses touch. The table now covers the seven boxes whose
contents decide which channels the rule counts and how deep they are: ihdr,
bpcc, pclr, cmap, cdef, opct and creg. The File Type rows and the colr rows
are gone. A paragraph after the table says which colr boxes tests 2 to 4
read.

15444-2 M.11.7.2 says the length of METHDAT may not be 0, so a colr box of
3 bytes or fewer is no longer counted; the test builders write one METHDAT
byte. Rows B2 and B4 now say their effect holds when BPC is 255. Both
halves of M.11.7.5 are stated where the rule names the limit. Two bpcc
tests cover a jpch box of the wrong length and a box one byte short for
three components, which a reader that repeated the last entry would read
differently. Comments and test lines wrap to 100 columns.
…792)

The CHANGELOG entry and divergence D7 said the table lists every
requirement the clauses put on the File Type box and colr, and gave a
blanket account of what an untrusted row leaves running. Both now name
the seven boxes the table covers and send the reader to its effect column.
One sentence says which colr boxes tests 2 to 4 read, citing 15444-2
M.11.7.2, and the entry records that a colr box of 3 bytes or fewer is no
longer counted. D7 states both halves of M.11.7.5.
Row I5 says a bpcc goes with the ihdr in its own header box (15444-2
M.11.5.1), but the code combined a jpch bpcc with the jp2h ihdr when the
jpch had no ihdr of its own. The rule now takes the bpcc from the header
of the ihdr it reads, so a jpch bpcc beside no jpch ihdr is not read. That
can only remove a finding. Three tests pin both directions of the choice.

The class remarks now give the table one introducing sentence and put what
failing a row does in that row's effect cell. The paragraphs that summed
up effects across rows are gone, as are the "range is checked on every
component and channel" sentences, which were false when the component
depths are unknown beside a direct channel. The colour specification
paragraph counts METHDAT bytes of the contents and cites M.11.7.3.1 for
EnumCS. The scope notes are a list of one-sentence items.

Tests: B2 and B4 now pin that another BPC leaves the depths the BPC
field's, using a 39-bit BPC so test 5 tells the two readings apart. One
word comment lines are rejoined and comment lines over 100 columns wrapped.
…792)

The CHANGELOG entry and divergence D7 said what failing a row does across
boxes ("every file with a box that fails an untrusted row loses one", "a
box is read unless a row ... fails for it"). Both were false at their
boundary, so they now say what the rule checks, point to the table in the
class remarks for the per-row requirements and effects, and give the
measured counts with their population: 359 generated variants, 171 differ
from main, 125 lose a finding, 42 gain one, one changes, three differ in
the loader run only. The 3-byte colr sentence counts contents, not the
box with its header.
Rows B2, G1 and G2, the Scope list and three code comments said a jpch holding two bpcc is read from its first, that D3 to D6 are asked of every file, and that a failing creg only leaves the channels unnumbered. None holds: a jpch bpcc with no jpch ihdr is not read (I5), D3 to D6 are asked only when the channels are numbered and not of a jp2h cdef a layer Opacity box replaces, and a failing creg or several codestreams also stop the jpch being read. Three tests pin each reading.
…792)

The intro sentence of the class remarks, the CHANGELOG entry and divergence D7 said each row gives one requirement; D2, P3, P4 and others give two, and C5, C6 and D7 are not shalls.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conformance: the JPEG 2000 rule counts colour channels as ISO 19005-2 6.2.8.3 does

1 participant