Skip to content

gamut-icc: validate() does not check ICC.1:2022 §10.3's MatrixCoefficients constraint on a parsed cicpType tag #587

Description

@justin13888

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions