diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-05-20 18:54:43 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-23 16:34:50 +0300 |
commit | eb5e7d0a31eed698909c23ab0ca89c8fd4929365 (patch) | |
tree | 6332d3f66107492795254d4fbc0f8f3beccfb156 /intern/opencolorio/ocio_impl.cc | |
parent | 469ee7ff1529a1b28ce0b300835ebc42d5c5362f (diff) |
Cleanup: clarify what is scene linear color space in conversion conversion
* Rename ambiguous rgb to scene_linear in some places
* Precompute matrices to directly go to scene instead of through XYZ
* Make function signatures more consistent
Diffstat (limited to 'intern/opencolorio/ocio_impl.cc')
-rw-r--r-- | intern/opencolorio/ocio_impl.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc index a352c54da86..7cf7fbefcd6 100644 --- a/intern/opencolorio/ocio_impl.cc +++ b/intern/opencolorio/ocio_impl.cc @@ -311,13 +311,14 @@ static bool to_scene_linear_matrix(ConstConfigRcPtr &config, return true; } -void OCIOImpl::configGetXYZtoRGB(OCIO_ConstConfigRcPtr *config_, float xyz_to_rgb[3][3]) +void OCIOImpl::configGetXYZtoSceneLinear(OCIO_ConstConfigRcPtr *config_, + float xyz_to_scene_linear[3][3]) { ConstConfigRcPtr config = (*(ConstConfigRcPtr *)config_); /* Default to ITU-BT.709 in case no appropriate transform found. * Note XYZ is defined here as having a D65 white point. */ - memcpy(xyz_to_rgb, OCIO_XYZ_TO_REC709, sizeof(OCIO_XYZ_TO_REC709)); + memcpy(xyz_to_scene_linear, OCIO_XYZ_TO_REC709, sizeof(OCIO_XYZ_TO_REC709)); /* Get from OpenColorO config if it has the required roles. */ if (!config->hasRole(ROLE_SCENE_LINEAR)) { @@ -326,17 +327,17 @@ void OCIOImpl::configGetXYZtoRGB(OCIO_ConstConfigRcPtr *config_, float xyz_to_rg if (config->hasRole("aces_interchange")) { /* Standard OpenColorIO role, defined as ACES AP0 (ACES2065-1). */ - float aces_to_rgb[3][3]; - if (to_scene_linear_matrix(config, "aces_interchange", aces_to_rgb)) { + float aces_to_scene_linear[3][3]; + if (to_scene_linear_matrix(config, "aces_interchange", aces_to_scene_linear)) { float xyz_to_aces[3][3]; invert_m3_m3(xyz_to_aces, OCIO_ACES_TO_XYZ); - mul_m3_m3m3(xyz_to_rgb, aces_to_rgb, xyz_to_aces); + mul_m3_m3m3(xyz_to_scene_linear, aces_to_scene_linear, xyz_to_aces); } } else if (config->hasRole("XYZ")) { /* Custom role used before the standard existed. */ - to_scene_linear_matrix(config, "XYZ", xyz_to_rgb); + to_scene_linear_matrix(config, "XYZ", xyz_to_scene_linear); } } |