ICC.1:2022 §10.3 states two shalls about a cicpType tag's MatrixCoefficients field, keyed on the data colour space in the profile header:
When the data colour space in the profile header is RGB or XYZ, MatrixCoefficients shall be 0 (zero).
When the data colour space in the profile header is YCbCr, MatrixCoefficients shall be non-zero.
IccProfile::validate checks the §8 required-tag sets but not this. PR #542 makes the constructors satisfy the RGB clause by construction (normalized_cicp writes zero), so nothing gamut-icc builds can violate it — but a profile parsed from a file can, and validate() reports it clean.
Why it is not folded into #542
Adding the check changes behaviour on real-world input, not on anything this crate writes. Profiles with a non-zero MatrixCoefficients in an RGB profile exist in the wild — an encoder copying an nclx box verbatim produces one — and every consumer of validate() would start seeing a new diagnostic on files it accepts today. That needs its own before/after corpus evidence, which the built-in-constructor work does not carry.
Scope
- A
ValidationError variant for each direction of the clause, or one carrying the header colour space and the offending value.
- The YCbCr direction as well as the RGB/XYZ one; ICC states both as
shall.
- A corpus measurement first: how many profiles in the crate's existing fixtures and in
references/ change verdict.
- Decide explicitly whether this is an error or a warning-severity diagnostic, since
validate() returning non-empty is what gamut-icc's own tests use as "conformant".
Refs #424, #542.
ICC.1:2022 §10.3 states two
shalls about acicpTypetag'sMatrixCoefficientsfield, keyed on the data colour space in the profile header:IccProfile::validatechecks the §8 required-tag sets but not this. PR #542 makes the constructors satisfy the RGB clause by construction (normalized_cicpwrites zero), so nothing gamut-icc builds can violate it — but a profile parsed from a file can, andvalidate()reports it clean.Why it is not folded into #542
Adding the check changes behaviour on real-world input, not on anything this crate writes. Profiles with a non-zero
MatrixCoefficientsin an RGB profile exist in the wild — an encoder copying annclxbox verbatim produces one — and every consumer ofvalidate()would start seeing a new diagnostic on files it accepts today. That needs its own before/after corpus evidence, which the built-in-constructor work does not carry.Scope
ValidationErrorvariant for each direction of the clause, or one carrying the header colour space and the offending value.shall.references/change verdict.validate()returning non-empty is what gamut-icc's own tests use as "conformant".Refs #424, #542.