Skip to content

Adsk contrib - Convert to or from a known external color space#1710

Merged
doug-walker merged 22 commits into
AcademySoftwareFoundation:mainfrom
autodesk-forks:adsk_contrib/convert-from-to-known-external-color-space
Oct 28, 2022
Merged

Adsk contrib - Convert to or from a known external color space#1710
doug-walker merged 22 commits into
AcademySoftwareFoundation:mainfrom
autodesk-forks:adsk_contrib/convert-from-to-known-external-color-space

Conversation

@cedrik-fuoco-adsk
Copy link
Copy Markdown
Contributor

@cedrik-fuoco-adsk cedrik-fuoco-adsk commented Oct 26, 2022

This is the PR for the issue Add a function to convert from/to a known external color space #1541.

Changes to public API:
GetProcessorFromBuiltinColorSpace and GetProcessorToBuiltinColorSpace were added.

This work leverages the recently added Default Built-in Config to define well-known external color spaces such as sRGB and linear sRGB. If the source config has the interchange roles set, the conversion is trivial and we simply call GetProcessorFromConfigs.

If the interchange roles are missing, we implemented some heuristics to see if we could guess the reference space being used by the source config and match it up with a color space available in the Default Built-in config. And then we use that information to call GetProcessorFromConfigs.

We needed the functionality of PR #1703 (the isColorSpaceLinear function), and we built this PR on that branch, so please ignore those changes when reviewing this PR.

Implementation note: We implemented this in Config.cpp to give us access to various private methods. However, the heuristics feel like they should not be part of Config.cpp. We will take an action item to see if the implementation could be refactored after 2.2.0 is out.

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
- 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 <cedrik.fuoco@autodesk.com>
…e 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 <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…ear.

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…litiy functions

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…tinColorspace 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 <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
- 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 <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…rm and styling issues.

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
@doug-walker doug-walker changed the title Adsk contrib - Convert from to known external color space Adsk contrib - Convert to or from a known external color space Oct 26, 2022
Comment thread include/OpenColorIO/OpenColorIO.h
cedrik-fuoco-adsk and others added 5 commits October 26, 2022 17:23
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…color-space

Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
…fixing warnings on Linux and Mac.

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
Copy link
Copy Markdown
Collaborator

@michdolan michdolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool @cedrik-fuoco-adsk and @doug-walker ! I was hesitant at first while reading through the explanation, but your heuristics seem like they would produce consistent results. We'll definitely need some good documentation around these.

Comment thread tests/python/ColorSpaceTest.py Outdated
Comment thread src/bindings/python/PyConfig.cpp Outdated
Comment thread src/OpenColorIO/Config.cpp
Comment thread src/OpenColorIO/Config.cpp Outdated
Comment thread src/OpenColorIO/Config.cpp Outdated
Comment thread src/OpenColorIO/Config.cpp
Comment thread src/OpenColorIO/Config.cpp Outdated
Comment thread src/OpenColorIO/Config.cpp Outdated
- 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 <cedrik.fuoco@autodesk.com>
…ace and adding "Utility - Linear - Rec.2020" to the builtin linear spaces.

Signed-off-by: Cedrik Fuoco <cedrik.fuoco@autodesk.com>
…color-space

Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
@doug-walker doug-walker merged commit b236bd8 into AcademySoftwareFoundation:main Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants