HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_OCIO Namespace Reference

Abstract interface to OpenColorIO. More...

Classes

struct  PHandle
 

Enumerations

enum  BitDepth {
  BitDepth::PXL_BIT_DEPTH_UNKNOWN = 0, BitDepth::PXL_BIT_DEPTH_UINT8, BitDepth::PXL_BIT_DEPTH_UINT10, BitDepth::PXL_BIT_DEPTH_UINT12,
  BitDepth::PXL_BIT_DEPTH_UINT14, BitDepth::PXL_BIT_DEPTH_UINT16, BitDepth::PXL_BIT_DEPTH_UINT32, BitDepth::PXL_BIT_DEPTH_F16,
  BitDepth::PXL_BIT_DEPTH_F32
}
 

Functions

PXL_API const UT_StringRef & configFilePath ()
 The path and filename of the config file being used. More...
 
PXL_API bool isOCIOEnvSet (bool check_for_active_vars=true)
 
PXL_API const char * getDefaultDisplay ()
 Returns the current color space name. More...
 
PXL_API const char * getDefaultView (const char *display=NULL)
 Returns the current color space name. More...
 
PXL_API bool getViewsForDisplay (const char *display, UT_StringArray &view_names)
 Return the list of views for a given display. More...
 
PXL_API void getActiveDisplays (UT_StringArray &names)
 Returns the list of active displays. More...
 
PXL_API void getActiveViews (UT_StringArray &names)
 Returns the list of active views. More...
 
PXL_API void getColorSpaces (UT_StringArray &names)
 Returns a list of the supported color spaces. More...
 
PXL_API void getLooks (UT_StringArray &looks)
 Returns a list of looks (color transforms) More...
 
PXL_API void getRoles (UT_StringArray &names)
 Returns a list of the supported roles. More...
 
PXL_API void reload ()
 Reload the configuration. More...
 
PXL_API const char * getDefaultRole ()
 
PXL_API const char * getReferenceRole ()
 
PXL_API const char * getDataRole ()
 
PXL_API const char * getSceneLinearRole ()
 
PXL_API const char * getCompLogRole ()
 
PXL_API const char * getColorPickingRole ()
 
PXL_API const UT_StringHolder & getSceneLinearColorSpace ()
 
PXL_API const UT_StringHolder & getsRGBColorSpace ()
 
PXL_API UT_StringHolder getsRGBColorSpace (const char *display)
 
PXL_API const UT_StringHolder & getRec709ColorSpace ()
 
PXL_API const UT_StringHolder & getLinearRec709ColorSpace ()
 
PXL_API const UT_StringHolder & getRawColorSpace ()
 
PXL_API const char * getColorSpaceForDisplayView (const char *display_name, const char *view_name)
 Return the colorspace defined by the view for a given display. More...
 
PXL_API const char * getTransformNameForDisplayView (const char *display_name, const char *view_name)
 Return the colorspace defined by the view for a given display. More...
 
PXL_API const char * getLooksForDisplayView (const char *display_name, const char *view_name)
 Return the looks attached to the view for a given display. More...
 
PXL_API const char * parseColorSpaceFromString (const char *string)
 
PXL_API UT_StringHolder parseColorSpaceFromHolder (const UT_StringHolder &s)
 
PXL_API const UT_StringHolder & pxlImageColorSpace (PXL_ColorSpace cs, const UT_StringHolder &ocioname)
 Convert a PXL_ColorSpace to roughly the OCIO equivalent. More...
 
PXL_API const ColorSpace * lookupSpace (const UT_StringHolder &name)
 
PXL_API const char * getName (const ColorSpace *space)
 Return the name of the color space. More...
 
PXL_API const char * getDescription (const ColorSpace *space)
 Return the description of the color space. More...
 
PXL_API const UT_StringHolder & getNanocolorName (const ColorSpace *space)
 
PXL_API const UT_StringHolder & getOpenUSDName (const ColorSpace *space)
 
PXL_API const UT_StringHolder & getBestAlias (const ColorSpace *space)
 Return the "best" alias for the color space (either Nanocolor or OpenUSD) More...
 
PXL_API bool getAllocationVars (const ColorSpace *space, bool &uniform, fpreal &min, fpreal &max, fpreal &offset)
 Return the allocation variable meta data about the color space. More...
 
PXL_API bool isFloatPointSpace (const ColorSpace *space, bool &fp)
 Set 'fp' to true if the color space is defined for FP, false for uint. More...
 
PXL_API void getAliases (const ColorSpace *space, UT_StringArray &aliases)
 Return a list of the aliases for a color space. More...
 
PXL_API bool getInfo (const ColorSpace *space, UT_Options &info)
 
PXL_API void viewingRuleNames (UT_StringArray &names)
 Get the viewing rule names. More...
 
PXL_API const UT_Options & viewingRule (const UT_StringRef &name)
 Lookup a viewing rule by the name. More...
 
PXL_API bool transform (const PHandle &processor, fpreal32 *data, const int npixels, const int nchannels)
 Transform pixels by a processor. More...
 
PXL_API bool transform (const PHandle &processor, const void *src, void *dst, const int width, const int height, const int src_channels, const int dst_channels)
 
PXL_API bool transform (const PHandle &processor, void *data, int width, int height, int channels)
 
bool transformToView (const UT_StringHolder &src, const UT_StringHolder &display, const UT_StringHolder &view, fpreal32 *data, int npixels, int nchannels, bool forward_xform=true)
 Transform from a colorspace to a display/view, including looks. More...
 
bool transform (const UT_StringHolder &view_transform, fpreal32 *data, int npixels, int nchannels, bool forward_transform=true)
 Transform with the given view transform, which must exist in the config. More...
 
PXL_API bool issRGB (const ColorSpace *s)
 
PXL_API bool isRec709 (const ColorSpace *s)
 
PXL_API bool isLinearRec709 (const ColorSpace *s)
 
PXL_API bool isSceneLinear (const ColorSpace *s)
 
PXL_API bool isRaw (const ColorSpace *s)
 
PXL_API PXL_ColorSpace pxlImageColorSpace (const ColorSpace *cs, UT_StringHolder &name)
 
PXL_API PXL_ColorSpace pxlImageColorSpace (const UT_StringHolder &csname, UT_StringHolder &name)
 
PXL_API PHandle lookupProcessor (const UT_StringHolder &src, const UT_StringHolder &dest, const UT_StringHolder &looks, bool forward_transform=true, const BitDepth src_depth=DefaultBitDepth, const BitDepth dst_depth=DefaultBitDepth)
 
PXL_API PHandle lookupProcessor (const ColorSpace *src, const ColorSpace *dest, const UT_StringHolder &looks, bool forward_transform=true, const BitDepth src_depth=DefaultBitDepth, const BitDepth dst_depth=DefaultBitDepth)
 
PXL_API PHandle lookupViewProcessor (const UT_StringHolder &src, const UT_StringHolder &display, const UT_StringHolder &view, bool forward_transform, const BitDepth src_depth=DefaultBitDepth, const BitDepth dst_depth=DefaultBitDepth)
 
PXL_API PHandle lookupViewProcessor (const UT_StringHolder &view_transform, bool forward_transform, const BitDepth src_depth=DefaultBitDepth, const BitDepth dst_depth=DefaultBitDepth)
 
bool isValidTransform (const PHandle &processor)
 
bool isNoOpTransform (const PHandle &processor)
 
bool is3DTransform (const PHandle &processor)
 
bool transform (const UT_StringHolder &src, const UT_StringHolder &dest, const UT_StringHolder &looks, fpreal32 *data, int npixels, int nchannels, bool forward_transform=true)
 
bool transform (const ColorSpace *src, const ColorSpace *dest, const UT_StringHolder &looks, fpreal32 *data, int npixels, int nchannels, bool forward_transform=true)
 
PXL_API int addConfigChangeCB (UT_Functor< void > callback)
 
PXL_API void removeConfigChangeCB (int id)
 

Detailed Description

Abstract interface to OpenColorIO.

Enumeration Type Documentation

enum PXL_OCIO::BitDepth
strong

Mirrors the OCIO enum so that we don't have to expose the OCIO_NAMESPACE and we can avoid namespace collisions.

Enumerator
PXL_BIT_DEPTH_UNKNOWN 
PXL_BIT_DEPTH_UINT8 
PXL_BIT_DEPTH_UINT10 
PXL_BIT_DEPTH_UINT12 
PXL_BIT_DEPTH_UINT14 
PXL_BIT_DEPTH_UINT16 
PXL_BIT_DEPTH_UINT32 
PXL_BIT_DEPTH_F16 
PXL_BIT_DEPTH_F32 

Definition at line 35 of file PXL_OCIO.h.

Function Documentation

PXL_API int PXL_OCIO::addConfigChangeCB ( UT_Functor< void >  callback)

When the OCIO config is reloaded, all processor and color space pointers become invalid. You can register a callback (and remove it) to be notified of reloads.

PXL_API const UT_StringRef& PXL_OCIO::configFilePath ( )

The path and filename of the config file being used.

PXL_API void PXL_OCIO::getActiveDisplays ( UT_StringArray &  names)

Returns the list of active displays.

PXL_API void PXL_OCIO::getActiveViews ( UT_StringArray &  names)

Returns the list of active views.

PXL_API void PXL_OCIO::getAliases ( const ColorSpace *  space,
UT_StringArray &  aliases 
)

Return a list of the aliases for a color space.

PXL_API bool PXL_OCIO::getAllocationVars ( const ColorSpace *  space,
bool &  uniform,
fpreal &  min,
fpreal &  max,
fpreal &  offset 
)

Return the allocation variable meta data about the color space.

PXL_API const UT_StringHolder& PXL_OCIO::getBestAlias ( const ColorSpace *  space)

Return the "best" alias for the color space (either Nanocolor or OpenUSD)

PXL_API const char* PXL_OCIO::getColorPickingRole ( )
PXL_API const char* PXL_OCIO::getColorSpaceForDisplayView ( const char *  display_name,
const char *  view_name 
)

Return the colorspace defined by the view for a given display.

PXL_API void PXL_OCIO::getColorSpaces ( UT_StringArray &  names)

Returns a list of the supported color spaces.

PXL_API const char* PXL_OCIO::getCompLogRole ( )
PXL_API const char* PXL_OCIO::getDataRole ( )
PXL_API const char* PXL_OCIO::getDefaultDisplay ( )

Returns the current color space name.

PXL_API const char* PXL_OCIO::getDefaultRole ( )
PXL_API const char* PXL_OCIO::getDefaultView ( const char *  display = NULL)

Returns the current color space name.

PXL_API const char* PXL_OCIO::getDescription ( const ColorSpace *  space)

Return the description of the color space.

PXL_API bool PXL_OCIO::getInfo ( const ColorSpace *  space,
UT_Options &  info 
)

Fill out metadata for color space in a UT_Options Keys are the tokens in the config.ocio file:

  • name
  • family
  • equalitygroup
  • bitdepth
  • description
  • isdata
  • allocation
  • allocationvars
PXL_API const UT_StringHolder& PXL_OCIO::getLinearRec709ColorSpace ( )
PXL_API void PXL_OCIO::getLooks ( UT_StringArray &  looks)

Returns a list of looks (color transforms)

PXL_API const char* PXL_OCIO::getLooksForDisplayView ( const char *  display_name,
const char *  view_name 
)

Return the looks attached to the view for a given display.

PXL_API const char* PXL_OCIO::getName ( const ColorSpace *  space)

Return the name of the color space.

PXL_API const UT_StringHolder& PXL_OCIO::getNanocolorName ( const ColorSpace *  space)

Return the Nanocolor name for the color space. If it's not possible to determine the Nanocolor space name, this will return an empty string.

PXL_API const UT_StringHolder& PXL_OCIO::getOpenUSDName ( const ColorSpace *  space)

Return the OpenUSD color space token: See: https://openusd.org/release/user_guides/color_user_guide.html

PXL_API const UT_StringHolder& PXL_OCIO::getRawColorSpace ( )
PXL_API const UT_StringHolder& PXL_OCIO::getRec709ColorSpace ( )
PXL_API const char* PXL_OCIO::getReferenceRole ( )
PXL_API void PXL_OCIO::getRoles ( UT_StringArray &  names)

Returns a list of the supported roles.

PXL_API const UT_StringHolder& PXL_OCIO::getSceneLinearColorSpace ( )
PXL_API const char* PXL_OCIO::getSceneLinearRole ( )
PXL_API const UT_StringHolder& PXL_OCIO::getsRGBColorSpace ( )
PXL_API UT_StringHolder PXL_OCIO::getsRGBColorSpace ( const char *  display)
PXL_API const char* PXL_OCIO::getTransformNameForDisplayView ( const char *  display_name,
const char *  view_name 
)

Return the colorspace defined by the view for a given display.

PXL_API bool PXL_OCIO::getViewsForDisplay ( const char *  display,
UT_StringArray &  view_names 
)

Return the list of views for a given display.

bool PXL_OCIO::is3DTransform ( const PHandle &  processor)
inline

Does the transform from src->dest with applied looks require a 3D LUT.

Definition at line 273 of file PXL_OCIO.h.

PXL_API bool PXL_OCIO::isFloatPointSpace ( const ColorSpace *  space,
bool &  fp 
)

Set 'fp' to true if the color space is defined for FP, false for uint.

PXL_API bool PXL_OCIO::isLinearRec709 ( const ColorSpace *  s)

Test whether a color space is one of the well-known color spaces

bool PXL_OCIO::isNoOpTransform ( const PHandle &  processor)
inline

Valid transform, but does nothing. This is true if the src and dest color spaces are equal, but also handles special cases like transforming from "raw" spaces. So, this is more correct than an operator==() or isEqual() method.

Definition at line 265 of file PXL_OCIO.h.

PXL_API bool PXL_OCIO::isOCIOEnvSet ( bool  check_for_active_vars = true)

Returns whether the user has set $OCIO, $OCIO_ACTIVE_DISPLAYS or $OCIO_ACTIVE_VIEWS is set. If there's an error loading the configuration, this method will return false.

PXL_API bool PXL_OCIO::isRaw ( const ColorSpace *  s)

Test whether a color space is one of the well-known color spaces

PXL_API bool PXL_OCIO::isRec709 ( const ColorSpace *  s)

Test whether a color space is one of the well-known color spaces

PXL_API bool PXL_OCIO::isSceneLinear ( const ColorSpace *  s)

Test whether a color space is one of the well-known color spaces

PXL_API bool PXL_OCIO::issRGB ( const ColorSpace *  s)

Test whether a color space is one of the well-known color spaces

bool PXL_OCIO::isValidTransform ( const PHandle &  processor)
inline

Is there a transform from src->dest with the applied looks.

Definition at line 254 of file PXL_OCIO.h.

PXL_API PHandle PXL_OCIO::lookupProcessor ( const UT_StringHolder &  src,
const UT_StringHolder &  dest,
const UT_StringHolder &  looks,
bool  forward_transform = true,
const BitDepth  src_depth = DefaultBitDepth,
const BitDepth  dst_depth = DefaultBitDepth 
)

Lookup processors which can be used to transform colors efficiently.

Note
: These processors become invalid on a reload.
PXL_API PHandle PXL_OCIO::lookupProcessor ( const ColorSpace *  src,
const ColorSpace *  dest,
const UT_StringHolder &  looks,
bool  forward_transform = true,
const BitDepth  src_depth = DefaultBitDepth,
const BitDepth  dst_depth = DefaultBitDepth 
)

Lookup processors which can be used to transform colors efficiently.

Note
: These processors become invalid on a reload.
PXL_API const ColorSpace* PXL_OCIO::lookupSpace ( const UT_StringHolder &  name)

Return a color space handle given a name. The name may be a color space name or prefixed with "role:" to specify a color space role.

PXL_API PHandle PXL_OCIO::lookupViewProcessor ( const UT_StringHolder &  src,
const UT_StringHolder &  display,
const UT_StringHolder &  view,
bool  forward_transform,
const BitDepth  src_depth = DefaultBitDepth,
const BitDepth  dst_depth = DefaultBitDepth 
)

Lookup processors which can be used to transform colors efficiently.

Note
: These processors become invalid on a reload.
PXL_API PHandle PXL_OCIO::lookupViewProcessor ( const UT_StringHolder &  view_transform,
bool  forward_transform,
const BitDepth  src_depth = DefaultBitDepth,
const BitDepth  dst_depth = DefaultBitDepth 
)

Lookup processors which can be used to transform colors efficiently.

Note
: These processors become invalid on a reload.
PXL_API UT_StringHolder PXL_OCIO::parseColorSpaceFromHolder ( const UT_StringHolder &  s)
PXL_API const char* PXL_OCIO::parseColorSpaceFromString ( const char *  string)

Guess at the colorspace using the rightmost colorspace found, or NULL if none are found.

PXL_API const UT_StringHolder& PXL_OCIO::pxlImageColorSpace ( PXL_ColorSpace  cs,
const UT_StringHolder &  ocioname 
)

Convert a PXL_ColorSpace to roughly the OCIO equivalent.

PXL_API PXL_ColorSpace PXL_OCIO::pxlImageColorSpace ( const ColorSpace *  cs,
UT_StringHolder &  name 
)

Get the best approximation for the PXL_ColorSpace from the OCIO color space. The name will be filled out with the full name of the space. The return value will be PXL_CS_OCIO, unless it's a well known space.

PXL_API PXL_ColorSpace PXL_OCIO::pxlImageColorSpace ( const UT_StringHolder &  csname,
UT_StringHolder &  name 
)

Get the best approximation for the PXL_ColorSpace from the OCIO color space. The name will be filled out with the full name of the space. The return value will be PXL_CS_OCIO, unless it's a well known space.

PXL_API void PXL_OCIO::reload ( )

Reload the configuration.

PXL_API void PXL_OCIO::removeConfigChangeCB ( int  id)

When the OCIO config is reloaded, all processor and color space pointers become invalid. You can register a callback (and remove it) to be notified of reloads.

PXL_API bool PXL_OCIO::transform ( const PHandle &  processor,
fpreal32 *  data,
const int  npixels,
const int  nchannels 
)

Transform pixels by a processor.

PXL_API bool PXL_OCIO::transform ( const PHandle &  processor,
const void *  src,
void *  dst,
const int  width,
const int  height,
const int  src_channels,
const int  dst_channels 
)
PXL_API bool PXL_OCIO::transform ( const PHandle &  processor,
void *  data,
int  width,
int  height,
int  channels 
)
bool PXL_OCIO::transform ( const UT_StringHolder &  src,
const UT_StringHolder &  dest,
const UT_StringHolder &  looks,
fpreal32 *  data,
int  npixels,
int  nchannels,
bool  forward_transform = true 
)
inline

Transform color data from one color space to another color space. The color space names may either refer to a color space name, or it can also be prefixed with "role:" and refer to a color space role. The 'looks' is a comma separated list of color gradings (aka looks)

Definition at line 284 of file PXL_OCIO.h.

bool PXL_OCIO::transform ( const ColorSpace *  src,
const ColorSpace *  dest,
const UT_StringHolder &  looks,
fpreal32 *  data,
int  npixels,
int  nchannels,
bool  forward_transform = true 
)
inline

Transform color data from one color space to another color space. The color space names may either refer to a color space name, or it can also be prefixed with "role:" and refer to a color space role. The 'looks' is a comma separated list of color gradings (aka looks)

Definition at line 293 of file PXL_OCIO.h.

bool PXL_OCIO::transform ( const UT_StringHolder &  view_transform,
fpreal32 *  data,
int  npixels,
int  nchannels,
bool  forward_transform = true 
)
inline

Transform with the given view transform, which must exist in the config.

Definition at line 316 of file PXL_OCIO.h.

bool PXL_OCIO::transformToView ( const UT_StringHolder &  src,
const UT_StringHolder &  display,
const UT_StringHolder &  view,
fpreal32 *  data,
int  npixels,
int  nchannels,
bool  forward_xform = true 
)
inline

Transform from a colorspace to a display/view, including looks.

Definition at line 305 of file PXL_OCIO.h.

PXL_API const UT_Options& PXL_OCIO::viewingRule ( const UT_StringRef &  name)

Lookup a viewing rule by the name.

PXL_API void PXL_OCIO::viewingRuleNames ( UT_StringArray &  names)

Get the viewing rule names.