Skip to content

Commit b236bd8

Browse files
Adsk contrib - Convert to or from a known external color space (#1710)
* First iteration of isColorspaceLinear. Signed-off-by: Cedrik Fuoco <[email protected]> * - Comments. - Added a private getProcessor method that ignore caching. - Fix the algorithm for isColorspaceLinear. - Now testing R, G, B and neutral values. Signed-off-by: Cedrik Fuoco <[email protected]> * - Passing in the config reference instead of using this in the capture clause of the lambda function as this was causing issue on other platforms than Windows. - Remove unused variable in unit test. - other minors changes Signed-off-by: Cedrik Fuoco <[email protected]> * Removing a comment and removing the helper function as it is not needed. Signed-off-by: Cedrik Fuoco <[email protected]> * Get in sync with changes on the public repository for isColorspaceLinear. Signed-off-by: Cedrik Fuoco <[email protected]> * - C++ implemention for getProcessorToBuiltinColorSpace with a few utilitiy functions Signed-off-by: Cedrik Fuoco <[email protected]> * - Changed getProcessorToBuiltinColorSpace to getProcessorToOrFromBuiltinColorspace and it not accessible through the API anymore - Added getProcessorFromBuiltInColorspace (API) - Added getProcessorToBuiltinColorspace (API) - rename "bi" variables to "builtin" - Added the swaping of colorspace when TRANSFORM_DIR_INVERSE - Added C++ unit test std::cout debug print will be removed in the next commit. Signed-off-by: Cedrik Fuoco <[email protected]> * Adding ColorSpaceUtils Signed-off-by: Cedrik Fuoco <[email protected]> * - Comments and styling - Refactor the code in order to use apply() - Move everything to ColorSpaceUtils so that all the helper functions are private to ColorSpaceUtils - Remove the std::cout Signed-off-by: Cedrik Fuoco <[email protected]> * Now using getProcessorWithoutCaching and moved logics into Config::Impl. Signed-off-by: Cedrik Fuoco <[email protected]> * Removing combineGroupTransform, small refactor of getRefToSRGBTransform and styling issues. Signed-off-by: Cedrik Fuoco <[email protected]> * Python Bindings Signed-off-by: Cedrik Fuoco <[email protected]> * Changing new helper methods to const and minor styling issues. Signed-off-by: Cedrik Fuoco <[email protected]> * Minor styling issues Signed-off-by: Cedrik Fuoco <[email protected]> * Changed a comment to fit on one line and styling issue. Signed-off-by: Cedrik Fuoco <[email protected]> * Removing extra qualifiers that returns an error on Linux and Mac and fixing warnings on Linux and Mac. Signed-off-by: Cedrik Fuoco <[email protected]> * Fixing issue with documentation Signed-off-by: Cedrik Fuoco <[email protected]> * - Rename checkForLinearColorSpace ---> getReferenceSpaceFromLinearSpace - Fix an issue where the wrong config object was used for getProcessorWithoutCaching. - Added a comment about about 0.0030399346397784323. - Using std::pow instead of pow - Small refactor of getReferenceSpaceFromLinearSpace to avoid duplicate code. Signed-off-by: Cedrik Fuoco <[email protected]> * Renaming checkForSRGBTextureColorSpace to getReferenceSpaceFromSRGBSpace and adding "Utility - Linear - Rec.2020" to the builtin linear spaces. Signed-off-by: Cedrik Fuoco <[email protected]> Signed-off-by: Cedrik Fuoco <[email protected]> Signed-off-by: Cédrik Fuoco <[email protected]>
1 parent a347d80 commit b236bd8

File tree

5 files changed

+868
-1
lines changed

5 files changed

+868
-1
lines changed

include/OpenColorIO/OpenColorIO.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,46 @@ class OCIOEXPORT Config
12101210
const ConstTransformRcPtr & transform,
12111211
TransformDirection direction) const;
12121212

1213+
/**
1214+
* \brief Get a Processor to or from a known external color space.
1215+
*
1216+
* These methods provide a way to interface color spaces in a config with known standard
1217+
* external color spaces. The set of external color space are those contained in the current
1218+
* default Built-in config. This includes common spaces such as "Linear Rec.709 (sRGB)",
1219+
* "sRGB - Texture", "ACEScg", and "ACES2065-1".
1220+
*
1221+
* If the source config defines the necessary Interchange Role (typically "aces_interchange"),
1222+
* then the conversion will be well-defined and equivalent to calling GetProcessorFromConfigs
1223+
* with the source config and the Built-in config
1224+
*
1225+
* However, if the Interchange Roles are not present, heuristics will be used to try and
1226+
* identify a common color space in the source config that may be used to allow the conversion
1227+
* to proceed. If the heuristics fail to find a suitable space, an exception is thrown.
1228+
* The heuristics may evolve, so the results returned by this function for a given source config
1229+
* and color space may change in future releases of the library. However, the Interchange Roles
1230+
* are required in config versions 2.2 and higher, so it is hoped that the need for the heuristics
1231+
* will decrease over time.
1232+
*
1233+
* \param srcConfig The user's source config.
1234+
* \param srcColorSpaceName The name of the color space in the source config.
1235+
* \param builtinColorSpaceName The name of the color space in the current default Built-in config.
1236+
*/
1237+
static ConstProcessorRcPtr GetProcessorToBuiltinColorSpace(
1238+
ConstConfigRcPtr srcConfig,
1239+
const char * srcColorSpaceName,
1240+
const char * builtinColorSpaceName);
1241+
/**
1242+
* \brief See description of GetProcessorToBuiltinColorSpace.
1243+
*
1244+
* \param builtinColorSpaceName The name of the color space in the current default Built-in config.
1245+
* \param srcConfig The user's source config.
1246+
* \param srcColorSpaceName The name of the color space in the source config.
1247+
*/
1248+
static ConstProcessorRcPtr GetProcessorFromBuiltinColorSpace(
1249+
const char * builtinColorSpaceName,
1250+
ConstConfigRcPtr srcConfig,
1251+
const char * srcColorSpaceName);
1252+
12131253
/**
12141254
* \brief Get a processor to convert between color spaces in two separate
12151255
* configs.

0 commit comments

Comments
 (0)