Skip to content

Commit

Permalink
remove duplicated ocio init
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiencastan authored and cbentejac committed Dec 2, 2024
1 parent 3eb9554 commit a194a5e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
21 changes: 2 additions & 19 deletions src/aliceVision/image/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,13 +872,8 @@ void readImage(const std::string& path, oiio::TypeDesc format, int nchannels, Im
else if (EImageColorSpace_isSupportedOIIOEnum(imageReadOptions.workingColorSpace) &&
EImageColorSpace_isSupportedOIIOEnum(EImageColorSpace_stringToEnum(fromColorSpaceName)))
{
const auto colorConfigPath = getAliceVisionOCIOConfig();
if (colorConfigPath.empty())
{
throw std::runtime_error("ALICEVISION_ROOT is not defined, OCIO config file cannot be accessed.");
}
oiio::ImageBuf colorspaceBuf;
oiio::ColorConfig colorConfig(colorConfigPath);
oiio::ColorConfig& colorConfig(getGlobalColorConfigOCIO());
oiio::ImageBufAlgo::colorconvert(colorspaceBuf,
inBuf,
fromColorSpaceName,
Expand Down Expand Up @@ -1103,12 +1098,7 @@ void writeImage(const std::string& path,
}
else if (EImageColorSpace_isSupportedOIIOEnum(fromColorSpace) && EImageColorSpace_isSupportedOIIOEnum(toColorSpace))
{
const auto colorConfigPath = getAliceVisionOCIOConfig();
if (colorConfigPath.empty())
{
throw std::runtime_error("ALICEVISION_ROOT is not defined, OCIO config file cannot be accessed.");
}
oiio::ColorConfig colorConfig(colorConfigPath);
oiio::ColorConfig& colorConfig(getGlobalColorConfigOCIO());
oiio::ImageBufAlgo::colorconvert(colorspaceBuf,
*outBuf,
EImageColorSpace_enumToOIIOString(fromColorSpace),
Expand Down Expand Up @@ -1395,13 +1385,6 @@ std::string getAliceVisionRoot()
return value ? value : "";
}

std::string getAliceVisionOCIOConfig()
{
if (!getAliceVisionRoot().empty())
return getAliceVisionRoot() + "/share/aliceVision/config.ocio";
return {};
}

void setAliceVisionRootOverride(const std::string& value) { aliceVisionRootOverride = value; }

} // namespace image
Expand Down
4 changes: 0 additions & 4 deletions src/aliceVision/image/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,6 @@ bool tryLoadMask(Image<unsigned char>* mask,
// TODO: use std::optional when the C++ standard version is upgraded to C++17
std::string getAliceVisionRoot();

/// Returns path to OpenColorIO config that is shipped with aliceVision
std::string getAliceVisionOCIOConfig();

void setAliceVisionRootOverride(const std::string& value);

} // namespace image
} // namespace aliceVision
7 changes: 1 addition & 6 deletions src/software/pipeline/main_panoramaPostProcessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,7 @@ void colorSpaceTransform(image::Image<image::RGBAfColor>& inputImage,
}
else if (EImageColorSpace_isSupportedOIIOEnum(toColorSpace) && EImageColorSpace_isSupportedOIIOEnum(fromColorSpace))
{
const auto colorConfigPath = image::getAliceVisionOCIOConfig();
if (colorConfigPath.empty())
{
throw std::runtime_error("ALICEVISION_ROOT is not defined, OCIO config file cannot be accessed.");
}
oiio::ColorConfig colorConfig(colorConfigPath);
oiio::ColorConfig& colorConfig(image::getGlobalColorConfigOCIO());
oiio::ImageBufAlgo::colorconvert(colorspaceBuf,
*outBuf,
EImageColorSpace_enumToOIIOString(fromColorSpace),
Expand Down

0 comments on commit a194a5e

Please sign in to comment.