feat(gamut-color): add TransferCharacteristics::Linear (CICP code point 8) - #297
Merged
Conversation
…nt 8) ITU-T H.273 / ISO/IEC 23091-2 code point 8 is the linear (identity) transfer, V = Lc. It was unmodelled, so from_code_point(8) returned None and a linear working space had no faithful spelling: Srgb (13) misdescribes the samples and Unspecified (2) conflates "no code point exists" with "we could not name it". Adds the variant, its from_code_point arm, and linear_eotf so eotf_for dispatches code point 8 to a curve rather than None. Documents the code point in references/color and lists it in the CLI's `color info` table. The enum is #[non_exhaustive], so this is additive per the crate's v1 policy. Refs #295
Rounds out the profile surface alongside the new Linear code point: the scene-linear working space (BT.709 primaries + linear transfer) that a RAW pipeline demosaics, white-balances, and colour-matrixes in before applying its output transfer. SourceTransfer::Linear's eotf is the identity and reports code point 8, so LINEAR_SRGB decomposes onto both CICP axes like every other named profile. A test pins that it shares SRGB's M1 and differs only in the transfer: feeding LINEAR_SRGB pre-linearized samples lands on the same OKLab point as feeding SRGB the gamma-encoded ones. Refs #295
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #295.
What is Delivered
TransferCharacteristics::Linear = 8(ITU-T H.273 code point 8,V = Lc), with the matchingfrom_code_point(8)arm.linear_eotf(identity) intransfer.rs, wired intoeotf_forso linear-tagged content flows through the same CICP dispatch as every other code point.SourceProfile::LINEAR_SRGB— the issue's optional half — via a newSourceTransfer::Linear: BT.709 primaries + linear transfer, the scene-linear working space.eotf_forand the CLIcolor infolisting.gamut-avif/gamut-av1/gamut-icc/gamut-tonemaponly call.code_point()on existing variants and are unaffected.references/color/README.md, per the specs-as-source-of-truth rule. There is no constant to transcribe — the curve isf(x) = x— so the entry records the definition and citation rather than a value table.The enum is
#[non_exhaustive], and the crate's v1 policy already declares new variants andfrom_code_pointNone→Somepromotions to be minor releases, so this is additive.On the optional profile constant
The issue marks
SourceProfile::LINEAR_SRGBas lower priority. I included it becauseSourceTransferhad to grow aLineararm regardless for theeotf_fordispatch — stopping short of the named constant would have left a half-built surface. It is a separate commit (5aff08d), so it can be dropped independently if you'd rather defer it.Verification Done
Linear.code_point() == 8;from_code_point(8) == Some(Linear); the round-trip test extended over all modelled points including 8.eotf_for(Linear)resolves to a curve and is the identity across the domain.LINEAR_SRGBdecomposes toSome(Bt709)/Some(Linear), andeotf(x) == x.LINEAR_SRGBsharesSRGB'sM1and differs only in the transfer: feeding it pre-linearized samples lands on the same OKLab point as feedingSRGBthe gamma-encoded ones. This is what would catch a wrong-gamut copy-paste; the per-axis accessor assertions alone would not.mise run test(full workspace),mise run lint,mise run fmt-check, andmise run check-commitsall pass locally.Notes
MatrixCoefficientsalso uses discriminant 8 (YCgCo). That is the spec's own independent per-table numbering, not a collision.