MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / GetProcessorToBuiltinCS

Function GetProcessorToBuiltinCS

src/OpenColorIO/Config.cpp:5159–5212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5157}
5158
5159static ConstProcessorRcPtr GetProcessorToBuiltinCS(ConstConfigRcPtr srcConfig,
5160 const char * srcColorSpaceName,
5161 const char * builtinColorSpaceName,
5162 TransformDirection direction)
5163{
5164 // Use the Default config as the Built-in config to interpret the known color space name.
5165 ConstConfigRcPtr builtinConfig = Config::CreateFromFile("ocio://default");
5166
5167 if (builtinConfig->getColorSpace(builtinColorSpaceName) == nullptr)
5168 {
5169 std::ostringstream os;
5170 os << "Built-in config does not contain the requested color space: "
5171 << builtinColorSpaceName << ".";
5172 throw Exception(os.str().c_str());
5173 }
5174
5175 const char * srcInterchange = nullptr;
5176 const char * builtinInterchange = nullptr;
5177 Config::IdentifyInterchangeSpace(&srcInterchange,
5178 &builtinInterchange,
5179 srcConfig,
5180 srcColorSpaceName,
5181 builtinConfig,
5182 builtinColorSpaceName);
5183
5184 if (builtinInterchange && builtinInterchange[0])
5185 {
5186 ConstProcessorRcPtr proc;
5187 if (direction == TRANSFORM_DIR_FORWARD)
5188 {
5189 proc = Config::GetProcessorFromConfigs(srcConfig,
5190 srcColorSpaceName,
5191 srcInterchange,
5192 builtinConfig,
5193 builtinColorSpaceName,
5194 builtinInterchange);
5195 }
5196 else if (direction == TRANSFORM_DIR_INVERSE)
5197 {
5198 proc = Config::GetProcessorFromConfigs(builtinConfig,
5199 builtinColorSpaceName,
5200 builtinInterchange,
5201 srcConfig,
5202 srcColorSpaceName,
5203 srcInterchange);
5204 }
5205 return proc;
5206 }
5207
5208 std::ostringstream os;
5209 os << "Heuristics were not able to find a known color space in the provided config.\n"
5210 << "Please set the interchange roles in the config.";
5211 throw Exception(os.str().c_str());
5212}
5213
5214ConstProcessorRcPtr Config::GetProcessorToBuiltinColorSpace(ConstConfigRcPtr srcConfig,
5215 const char * srcColorSpaceName,

Calls 2

IdentifyInterchangeSpaceFunction · 0.85
getColorSpaceMethod · 0.45

Tested by

no test coverage detected