pub fn check_fidelity_honesty<E, D>(
enc: E,
dec: D,
img: &TestImage,
) -> ConformanceExpand description
The resolved Fidelity report is honest against the declared capabilities
and against the pixels that actually come back.
with_fidelity is best-effort and
infallible, so the whole cross-codec contract rests on
resolved_target_fidelity telling
the truth. For each request — Lossless, then every LossyTarget arm
(CodecSpecificQuality at the middle of the declared quality_range,
ApproxSsim2, ApproxButteraugli, ApproxZensimB), each applied on top of a
prior Lossless request so a stale setting cannot leak through — the
check asserts:
losslessdeclared ⇒ aLosslessrequest resolves toSome(Lossless)and the decoded pixels are byte-identical to the input. Undeclared ⇒ it must not resolve toSome(Lossless)(a codec cannot claim a mode it does not declare).lossydeclared ⇒ a lossy request never resolves toLossless(a codec with a lossy mode must use it when asked), and — when it also declares aquality_range— resolves toSome(Lossy(_))rather thanNone. Undeclared ⇒ it must not resolve toSome(Lossy(_)): the honest outcomes are promotion toSome(Lossless)(as thereferencecodec does) orNone.- Every request still encodes and decodes, and whenever the codec reports
Losslessthe pixels are exact — whatever was asked for. - The legacy getter agrees: when both
is_lossless()and the resolved fidelity areSome,is_lossless()equalsresolved.is_lossless().
All violations are collected and reported together. Not covered: whether a
metric target was hit (needs the metric), and the deferred
LosslessMode/near-lossless arm (not in the shipped enum).