Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-12 17:42:34 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-12-13 21:25:46 +0300
commitf527ce5b2f5bb300a7fe55db33d1e3a4da8051c7 (patch)
treedf1226d253b2a7c2e66cba75b37f9ec0a475c288 /intern/opencolorio/ocio_impl.cc
parent6601a89650f92454aa57bc01bedebd4086f6d98d (diff)
Color management: add OCIO aware utility functions for transform to/from XYZ.
Diffstat (limited to 'intern/opencolorio/ocio_impl.cc')
-rw-r--r--intern/opencolorio/ocio_impl.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 4c9115af810..ac167692647 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -419,6 +419,33 @@ void OCIOImpl::configGetDefaultLumaCoefs(OCIO_ConstConfigRcPtr *config, float *r
}
}
+void OCIOImpl::configGetXYZtoRGB(OCIO_ConstConfigRcPtr *config_, float xyz_to_rgb[3][3])
+{
+ ConstConfigRcPtr config = (*(ConstConfigRcPtr *) config_);
+
+ /* Default to ITU-BT.709 in case no appropriate transform found. */
+ memcpy(xyz_to_rgb, OCIO_XYZ_TO_LINEAR_SRGB, sizeof(OCIO_XYZ_TO_LINEAR_SRGB));
+
+ /* Auto estimate from XYZ and scene_linear roles, assumed to be a linear transform. */
+ if(config->hasRole("XYZ") && config->hasRole("scene_linear")) {
+ ConstProcessorRcPtr to_rgb_processor = config->getProcessor("XYZ", "scene_linear");
+ if(to_rgb_processor) {
+ xyz_to_rgb[0][0] = 1.0f;
+ xyz_to_rgb[0][1] = 0.0f;
+ xyz_to_rgb[0][2] = 0.0f;
+ xyz_to_rgb[1][0] = 0.0f;
+ xyz_to_rgb[1][1] = 1.0f;
+ xyz_to_rgb[1][2] = 0.0f;
+ xyz_to_rgb[2][0] = 0.0f;
+ xyz_to_rgb[2][1] = 0.0f;
+ xyz_to_rgb[2][2] = 1.0f;
+ to_rgb_processor->applyRGB(xyz_to_rgb[0]);
+ to_rgb_processor->applyRGB(xyz_to_rgb[1]);
+ to_rgb_processor->applyRGB(xyz_to_rgb[2]);
+ }
+ }
+}
+
int OCIOImpl::configGetNumLooks(OCIO_ConstConfigRcPtr *config)
{
try {