Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify ocio init #1786

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading