pub fn expected_color_authority(
format: ImageFormat,
has_cicp: bool,
has_icc: bool,
) -> Option<ColorAuthority>Expand description
The [ColorAuthority] a format’s specification assigns, given which colour
fields the decoder actually read back.
This is the shared answer key behind check_source_color_authority — the
“what does the spec say” half of the audit in zencodec issue #11 (Table 4),
so every codec crate asserts the same rule instead of re-deriving it:
| format | rule |
|---|---|
| PNG | cICP outranks iCCP (PNG 3rd ed.): Cicp when CICP was read, else Icc |
| JXL | codestream colour encoding outranks an embedded ICC: Cicp when read, else Icc |
| HEIC | nclx is the primary colour authority (ISO 23008-12): Cicp when read, else Icc |
| AVIF | MIAF order: an ICC colr outranks nclx — Icc when an ICC was read, else Cicp when CICP was read, else Icc |
| Radiance HDR | scene-linear BT.709 has no ICC carrier: Cicp when the codec expressed it as CICP, else Icc |
| JPEG, WebP, GIF, TIFF, BMP, ICO, PNM, Farbfeld, QOI, TGA, DNG, RAW, PDF | ICC (or an sRGB assumption): always Icc |
Returns None where no rule is recorded — Custom,
Unknown, and the formats the audit did not cover
(EXR, JPEG 2000, SVG) — so a check over those passes rather than inventing a
rule. Cicp is never expected when no CICP was read (the enum’s own
invariant: codecs only set Cicp when cicp is populated).