Skip to content

The named source spaces are hard-coded twice and nothing checks the copies agree #4351

Closed

Description

@zackees

src/fl/gfx/color_profile.h hard-codes the chromaticities for sRGB/BT.709, Display P3 and BT.2020. ci/color_reference.py and ci/color_reference_corpus.py hard-code them again — and the golden corpus, which P6's ΔE budget is measured against, is generated from those copies.

Nothing checks the two agree.

Why this is worse than the guard drift in #4330 / #4335 / #4337

Those were guards that stopped covering something; the failure was a missing check. Here a divergence would not fail at all:

  • both sides stay internally consistent
  • the corpus is generated for one set of primaries
  • the pipeline renders with another
  • tests/fl/gfx/pipeline.cpp goes on reporting 0.395096 dE2000, comfortably inside A1's 0.5

A wrong reference that passes its own budget is a harder thing to notice than a guard that never fires.

Current state

They agree, to four decimal places, in all four places I checked:

space C++ reference
sRGB / BT.709 .640/.330 .300/.600 .150/.060 0.6400/0.3300 0.3000/0.6000 0.1500/0.0600
Display P3 .680/.320 .265/.690 .150/.060 0.6800/0.3200 0.2650/0.6900 0.1500/0.0600
BT.2020 .708/.292 .170/.797 .131/.046 0.7080/0.2920 0.1700/0.7970 0.1310/0.0460
D65 white .3127/.3290 0.3127/0.3290

So this is a guard against future drift, not a defect found.

Shape of the fix

#4034 calls these names a registry — "source-color names owned by the canonical ledmapper spec" — so the check pins the registry, not either copy: the expected values are the standard-defined ones (IEC 61966-2-1 / BT.709-6, SMPTE RP 431-2 with D65, BT.2020-2), and both implementations are checked against them. Editing either alone fails; editing both to a wrong value still fails.

That is deliberately stronger than asserting the two match each other, which would pass if someone "fixed" both in the same wrong direction.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions