Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement support for OCIO NamedTransforms (#4393)
- ColorProcCacheKey: Update definition, signature, and usage to support caching NamedTransform processor handles. (Note: **ABI-breaking**) - ColorConfig: add NamedTransform convenience functions: `getNumNamedTransforms`, `getNamedTransformNameByIndex`, `getNamedTransformNames`, `getNamedTransformAliases` - ColorConfig: add `createNamedTransform` function returning new ColorProcessorHandle - Add `ImageBufAlgo::ocionamedtransform` functions - oiiotool: add `--ocionamedtransform` operator - python: add NamedTransform convenience function bindings - python: add `ImageBufAlgo.ocionamedtransform(...)` bindings - Update `oiiotool` and `python` documentation with examples ## Description OCIO-2 config authors may define a set of stand-alone "source-agnostic" `NamedTransforms`. Unlike the `colorconvert`, `ociodisplay`, and `ociolook` IBAs, which explicitly convert _from_ a color space to something else, the `ocionamedtransform` IBA behaves more like the `ociofiletransform` IBA, where the transform itself can be applied either in the forwards or inverse direction, and does not take into consideration the input encoding or image state. Quoting from the OCIO [NamedTransform documentation](https://opencolorio.readthedocs.io/en/latest/guides/authoring/authoring.html#named-transforms): > Sometimes it is helpful to include one or more transforms in a config that are essentially stand-alone transforms that do not have a fixed relationship to a reference space or a process space. An example would be a “utility curve” transform where the intent is to simply apply a LUT1D without any conversion to a reference space. In these cases, a named_transforms section may be added to the config with one or more named transforms. [...] This feature may be used to emulate older methods of color management that ignored the RGB primaries and simply applied one-dimensional transformations. Notably, the built-in OCIO-2 Studio config (`ocio://studio-config-latest`) contains NamedTransforms "sRGB - Curve" and "Rec709 - Curve", which we could implement as drop-in replacements for the existing `linear_to_sRGB`, `sRGB_to_linear`, `linear_to_Rec709`, and `Rec709_to_linear` functions in `color.h` (unless those functions are deprecated...). There are several other applications for NamedTransforms as well. They can be extremely useful as workflow-oriented transforms implemented at various points in facility pipelines (e.g., for applying shot-specific conversions, grades, gamut-compression, etc.); they can be used to provide diagnostic transforms for visualizing "exposure zones", clipped areas, NaNs, etc; for visually "tagging" problematic clips; for applying parts of ACES Metadata Files parsed by OCIO's forthcoming AMF parser; for conversion to non-RGB color models... all sorts of things. ## Tests Tests are forthcoming. I've tested everything locally, but have not yet implemented proper tests in the testsuite. --------- Signed-off-by: Zach Lewis <[email protected]>
- Loading branch information