Skip to main content

check_color_context_attached

Function check_color_context_attached 

Source
pub fn check_color_context_attached<E, D>(
    enc: E,
    dec: D,
    img: &TestImage,
) -> Conformance
where E: EncoderConfig, D: DecoderConfig, <E::Job as EncodeJob>::Enc: Encoder<Error = E::Error>,
Expand description

A decoder that read colour back attaches it to the output buffer — the strict, positive direction of the decoded-buffer convention.

Encodes with an RGB-class ICC + sRGB CICP under PreserveExact, decodes, and looks at what the decoder reported in ImageInfo.source_color. If it read back neither ICC nor CICP there is nothing to attach and the check passes (whether it should have read them is check_capability_honesty’s job). Otherwise the output buffer must carry a [ColorContext], and it must carry the authoritative field: under [ColorAuthority::Icc] with a class-valid profile, the ICC bytes ride as-is (rank 1 of the convention); under [ColorAuthority::Cicp], the CICP. A class-invalid ICC only has to be replaced by some description (the derived-CICP fallback), which the class-gate rules in check_color_context_consistency verify. When streaming is advertised, the first strip must carry a context too.

Opt-in — not part of check_all — because the convention is a SHOULD that codecs adopt one at a time; run it once yours does.