Skip to content

Feat/wide color gamut#31

Merged
merlotqi merged 12 commits into
mainfrom
feat/wide-color-gamut
Jun 26, 2026
Merged

Feat/wide color gamut#31
merlotqi merged 12 commits into
mainfrom
feat/wide-color-gamut

Conversation

@merlotqi

Copy link
Copy Markdown
Owner

No description provided.

merlotqi and others added 12 commits June 24, 2026 06:41
Add rec2020_rgbf_t, rec2020_rgbaf_t, linear_rec2020_rgbf_t, and
linear_rec2020_rgbaf_t types following the Adobe RGB / Display P3 pattern.
Includes construction and boundary tests.

Co-Authored-By: Claude <noreply@anthropic.com>
…egistered)

Add gamma encode/decode, XYZ matrices, and sRGB shortcut. Tests added but
will fail to compile until graph edges are registered in next task.

Co-Authored-By: Claude <noreply@anthropic.com>
Register Rec.2020 edges in index.hpp and add Rec.2020 color_traits to
color_space_registry.hpp. Add Rec.2020 types to builtin_color_nodes in
graph.hpp. Increase MaxNodes from 32 to 64.

Bugfix: Fix XYZ channel range handling in rec2020, adobe_rgb, and
prophoto_rgb conversion functions. XYZ channels have [0,2] range, so
using to_unit()/from_unit() (which assume [0,1]) produces incorrect
values when routing through the standard sRGB->XYZ->wide-gamut path.
Changed to use direct reads and from_value() instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Add standalone chromatic_adaptation module with Bradford and Von Kries
transforms, plus standard white point constants (D65, D50, D55, A, C).
Tests verify round-trip fidelity and known reference values.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace combined D50/D65 matrices with stepwise conversion:
pure ProPhoto primaries matrix + explicit bradford_adapt() call.
Improves transparency and reusability of the chromatic adaptation logic.

Also fix circular include in chromatic_adaptation.hpp by replacing
the #include of conversion.hpp with a forward declaration of
color_cast, enabling inclusion from within the conversion subsystem.

Co-Authored-By: Claude <noreply@anthropic.com>
Add prophoto_rgb to gamut_type enum with gamma helpers, gamut check,
and gamut clipping support. Tests verify in-gamut detection and clipping.

Co-Authored-By: Claude <noreply@anthropic.com>
Refactor rec2020_to_rgbaf to use the new rec2020_rgbaf_t core type.
Add parse_css_color overload for direct Rec.2020 parsing.

Co-Authored-By: Claude <noreply@anthropic.com>
The 7 blocked tests (BlackConversion, WhiteConversion, AlphaPreserved,
FloatRoundTrip, AlphaRoundTrip, LinearConversion, LinearRoundTrip) were
prematurely disabled. Conversion code exists and is registered.

Also fixes the display_p3af_t <-> rgbaf_t shortcut cost from
shortcut_4_hop (5) to shortcut_2_hop (3) so the graph routing prefers
the direct alpha-preserving path over the canonical 4-hop XYZ path
that silently drops alpha.

Co-Authored-By: Claude <noreply@anthropic.com>
Demonstrates construction, sRGB round-trip, chromatic adaptation,
gamut checking, CSS parsing, and gamma encoding.

Co-Authored-By: Claude <noreply@anthropic.com>
Demonstrates construction, gamut hierarchy comparison, round-trip,
transfer function, and CSS parsing for the BT.2020 color space.

Co-Authored-By: Claude <noreply@anthropic.com>
Demonstrates construction, sRGB round-trip, gamma encoding,
cross-space chain, CSS parsing, and ANSI swatch output.

Co-Authored-By: Claude <noreply@anthropic.com>
- Added missing newlines at the end of several files to adhere to coding standards.
- Reordered includes in core.hpp, color_space_registry.hpp, and other files for consistency.
- Improved formatting and readability in various functions, particularly in conversion functions for Adobe RGB, ProPhoto RGB, and Rec.2020.
- Simplified lambda expressions in conversion functions for better clarity.
- Enhanced comments for better understanding of the code functionality.
- Updated tests to ensure consistency and clarity in test cases.
@merlotqi merlotqi merged commit 556fea2 into main Jun 26, 2026
9 checks passed
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.

1 participant