Skip to content

Commit dd66123

Browse files
committed
Build ROMM->CIE XYZ D65 matrix dynamically
Remove the hard-coded ROMM_RGB to XYZ D65 matrix and instead generate the conversion matrix at runtime using build_conversion_matrix_to_XYZ_D65 with ROMM_RGB::primaries and Bradford adaptation. Update the CreateMatrixOp call to accept the constructed MatrixArrayPtr. This simplifies maintenance and ensures the matrix is derived from the defined primaries and chosen chromatic adaptation method. Signed-off-by: Vlad <shaamaan@gmail.com>
1 parent 55143ae commit dd66123

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

src/OpenColorIO/transforms/builtins/ProPhotoRGB.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ namespace OCIO_NAMESPACE
3030

3131
const Primaries primaries(red_xy, grn_xy, blu_xy, wht_xy);
3232

33-
static constexpr double RGB_to_XYZ_D65[4 * 4]{
34-
0.7555287932957933, 0.11273621650716224, 0.0820865579632326, 0.,
35-
0.26824815751179243, 0.7151801391921419, 0.016570112476870784, 0.,
36-
0.003916686659314376, -0.012934540726208194, 1.0978022304574562, 0.,
37-
0., 0., 0., 1.};
38-
3933
} // namespace ROMM_RGB
4034

4135
// ROMM RGB uses a piecewise gamma function with gamma 1.8.
@@ -110,13 +104,10 @@ namespace OCIO_NAMESPACE
110104
{
111105
auto ROMM_to_CIE_XYZ_D65_BFD_Functor = [](OpRcPtrVec &ops)
112106
{
113-
// 1. Decode gamma 1.8 to linear.
114107
ROMM_RGB_GAMMA_18::GenerateEncodedToLinearOps(ops);
115108

116-
// 2. Convert from ROMM RGB to CIE XYZ D65 using the
117-
// published ROMM RGB to XYZ(D50) matrix combined with
118-
// Bradford adaptation from D50 to D65.
119-
CreateMatrixOp(ops, &ROMM_RGB::RGB_to_XYZ_D65[0], TRANSFORM_DIR_FORWARD);
109+
MatrixOpData::MatrixArrayPtr matrix = build_conversion_matrix_to_XYZ_D65(ROMM_RGB::primaries, ADAPTATION_BRADFORD);
110+
CreateMatrixOp(ops, matrix, TRANSFORM_DIR_FORWARD);
120111
};
121112

122113
registry.addBuiltin("ROMM_to_CIE-XYZ-D65_BFD",

0 commit comments

Comments
 (0)