Skip to content

feat(gamut-color): add TransferCharacteristics::Linear (CICP code point 8) - #297

Merged
justin13888 merged 2 commits into
masterfrom
feat/295-linear-transfer
Jul 18, 2026
Merged

feat(gamut-color): add TransferCharacteristics::Linear (CICP code point 8)#297
justin13888 merged 2 commits into
masterfrom
feat/295-linear-transfer

Conversation

@justin13888

@justin13888 justin13888 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Closes #295.

What is Delivered

  • TransferCharacteristics::Linear = 8 (ITU-T H.273 code point 8, V = Lc), with the matching from_code_point(8) arm.
  • linear_eotf (identity) in transfer.rs, wired into eotf_for so linear-tagged content flows through the same CICP dispatch as every other code point.
  • SourceProfile::LINEAR_SRGB — the issue's optional half — via a new SourceTransfer::Linear: BT.709 primaries + linear transfer, the scene-linear working space.
  • In-crate exhaustive consumers updated: eotf_for and the CLI color info listing. gamut-avif/gamut-av1/gamut-icc/gamut-tonemap only call .code_point() on existing variants and are unaffected.
  • H.273 code point 8 documented in references/color/README.md, per the specs-as-source-of-truth rule. There is no constant to transcribe — the curve is f(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 and from_code_point NoneSome promotions to be minor releases, so this is additive.

On the optional profile constant

The issue marks SourceProfile::LINEAR_SRGB as lower priority. I included it because SourceTransfer had to grow a Linear arm regardless for the eotf_for dispatch — 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_SRGB decomposes to Some(Bt709) / Some(Linear), and eotf(x) == x.
  • A composition test pins that LINEAR_SRGB shares SRGB's M1 and differs only in the transfer: feeding it pre-linearized samples lands on the same OKLab point as feeding SRGB the 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, and mise run check-commits all pass locally.

Notes

  • MatrixCoefficients also uses discriminant 8 (YCgCo). That is the spec's own independent per-table numbering, not a collision.

…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
@justin13888
justin13888 merged commit dde9f64 into master Jul 18, 2026
5 checks passed
@justin13888
justin13888 deleted the feat/295-linear-transfer branch July 19, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gamut-color: add TransferCharacteristics::Linear (CICP code point 8)

1 participant