AcademySoftwareFoundation / OpenColorIO

A color management framework for visual effects and animation.
https://opencolorio.org
BSD 3-Clause "New" or "Revised" License
1.76k stars 438 forks source link

GetProcessorFromBuiltinColorSpace with "noop" transform does not result in isNoOp() returning true #1830

Closed SRHMorris closed 1 year ago

SRHMorris commented 1 year ago

Tested using the ocio://default config, using OCIO v2.2.1

auto config = OCIO::Config::CreateFromFile("ocio://default");
auto proc = OCIO::Config::GetProcessorFromBuiltinColorSpace("ACEScg", config, "ACEScg");
bool noop = proc->isNoOp();
assert(noop);

When generating the shader text it is quite clearly a noop.

For my use case I kind of want to rely on this specific case returning a noop processor (more specifically when using the OCIO::ROLE_SCENE_LINEAR role) as an optimization.

doug-walker commented 1 year ago

@SRHMorris , that's because the Processor has not been optimized, it is just the concatenation of the to-reference and from-reference transforms. If you were processing pixels, you would generate a CPUProcessor or GPUProcessor from the Processor and that would optimize it. But if you just want to run the optimizer without processing pixels, you may use the getOptimizedProcessor method. Calling isNoOp on the result of that would be a no-op, in your case.

SRHMorris commented 1 year ago

@doug-walker thanks for your help, that does seem work so I'll close this issue.