Skip to content

Commit f975dce

Browse files
committed
Use ROMM RGB -> XYZ(D50) matrix and adapt
Add the published ROMM RGB to XYZ(D50) 4x4 matrix and D50 whitepoint offsets. Replace the previous direct conversion to XYZ D65 with a two-step process: apply the ROMM->XYZ(D50) matrix, then perform a Bradford (von Kries) adaptation from D50 to D65. This aligns the transform with the published ROMM spec and makes the chromatic adaptation explicit. Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
1 parent 006c53b commit f975dce

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

src/OpenColorIO/transforms/builtins/ProPhotoRGB.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@ namespace OCIO_NAMESPACE
3232

3333
const Primaries primaries(red_xy, grn_xy, blu_xy, wht_xy);
3434

35+
static constexpr double RGB_to_XYZ_D50[4 * 4]
36+
{
37+
0.7977, 0.1352, 0.0313, 0.,
38+
0.2880, 0.7119, 0.0001, 0.,
39+
0.0000, 0.0000, 0.8249, 0.,
40+
0., 0., 0., 1.
41+
};
42+
43+
static const MatrixOpData::Offsets white_D50_XYZ(
44+
0.3457 / 0.3585,
45+
1.,
46+
(1.0 - 0.3457 - 0.3585) / 0.3585,
47+
0.);
48+
3549
} // namespace ROMM_RGB
3650

3751

@@ -113,9 +127,13 @@ namespace OCIO_NAMESPACE
113127
// 1. Decode gamma 1.8 to linear.
114128
ROMM_RGB_GAMMA_18::GenerateEncodedToLinearOps(ops);
115129

116-
// 2. Convert color space from ROMM RGB (D50) to CIE XYZ D65.
130+
// 2. Convert from the published ROMM RGB to XYZ(D50) matrix.
131+
CreateMatrixOp(ops, &ROMM_RGB::RGB_to_XYZ_D50[0], TRANSFORM_DIR_FORWARD);
132+
133+
// 3. Adapt XYZ from D50 to D65 using Bradford.
117134
MatrixOpData::MatrixArrayPtr matrix
118-
= build_conversion_matrix_to_XYZ_D65(ROMM_RGB::primaries,
135+
= build_vonkries_adapt(ROMM_RGB::white_D50_XYZ,
136+
WHITEPOINT::D65_XYZ,
119137
ADAPTATION_BRADFORD);
120138
CreateMatrixOp(ops, matrix, TRANSFORM_DIR_FORWARD);
121139
};

0 commit comments

Comments
 (0)