本文整理汇总了C++中ocio_namespace::ConstConfigRcPtr::sanityCheck方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstConfigRcPtr::sanityCheck方法的具体用法?C++ ConstConfigRcPtr::sanityCheck怎么用?C++ ConstConfigRcPtr::sanityCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocio_namespace::ConstConfigRcPtr
的用法示例。
在下文中一共展示了ConstConfigRcPtr::sanityCheck方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _validate
void OCIOColorSpace::_validate(bool for_real)
{
input0().validate(for_real);
if(!m_hasColorSpaces)
{
error("No colorspaces available for input and/or output.");
return;
}
int inputColorSpaceCount = static_cast<int>(m_inputColorSpaceCstrNames.size()) - 1;
if(m_inputColorSpaceIndex < 0 || m_inputColorSpaceIndex >= inputColorSpaceCount)
{
std::ostringstream err;
err << "Input colorspace index (" << m_inputColorSpaceIndex << ") out of range.";
error(err.str().c_str());
return;
}
int outputColorSpaceCount = static_cast<int>(m_outputColorSpaceCstrNames.size()) - 1;
if(m_outputColorSpaceIndex < 0 || m_outputColorSpaceIndex >= outputColorSpaceCount)
{
std::ostringstream err;
err << "Output colorspace index (" << m_outputColorSpaceIndex << ") out of range.";
error(err.str().c_str());
return;
}
try
{
const char * inputName = m_inputColorSpaceCstrNames[m_inputColorSpaceIndex];
const char * outputName = m_outputColorSpaceCstrNames[m_outputColorSpaceIndex];
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
config->sanityCheck();
OCIO::ConstContextRcPtr context = getLocalContext();
m_processor = config->getProcessor(context, inputName, outputName);
}
catch(OCIO::Exception &e)
{
error(e.what());
return;
}
if(m_processor->isNoOp())
{
// TODO or call disable() ?
set_out_channels(DD::Image::Mask_None); // prevents engine() from being called
copy_info();
return;
}
set_out_channels(DD::Image::Mask_All);
DD::Image::PixelIop::_validate(for_real);
}
示例2: _validate
void OCIOFileTransform::_validate(bool for_real)
{
input0().validate(for_real);
if(!src)
{
error("The source file must be specified.");
return;
}
try
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
config->sanityCheck();
OCIO::FileTransformRcPtr transform = OCIO::FileTransform::Create();
transform->setSrc(src);
// TODO: For some reason, cccid is NOT incorporated in this node's hash.
// Until then, cccid is considered broken. Figure out why.
transform->setCCCId(cccid.c_str());
if(dirindex == 0) transform->setDirection(OCIO::TRANSFORM_DIR_FORWARD);
else transform->setDirection(OCIO::TRANSFORM_DIR_INVERSE);
if(interpindex == 0) transform->setInterpolation(OCIO::INTERP_NEAREST);
else transform->setInterpolation(OCIO::INTERP_LINEAR);
processor = config->getProcessor(transform, OCIO::TRANSFORM_DIR_FORWARD);
}
catch(OCIO::Exception &e)
{
error(e.what());
return;
}
if(processor->isNoOp())
{
// TODO or call disable() ?
set_out_channels(DD::Image::Mask_None); // prevents engine() from being called
copy_info();
return;
}
set_out_channels(DD::Image::Mask_All);
DD::Image::PixelIop::_validate(for_real);
}
示例3: _validate
void OCIOCDLTransform::_validate(bool for_real)
{
input0().validate(for_real);
try
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
config->sanityCheck();
OCIO::CDLTransformRcPtr cc = OCIO::CDLTransform::Create();
cc->setSlope(m_slope);
cc->setOffset(m_offset);
cc->setPower(m_power);
cc->setSat(m_saturation);
if(m_dirindex == 0) cc->setDirection(OCIO::TRANSFORM_DIR_FORWARD);
else cc->setDirection(OCIO::TRANSFORM_DIR_INVERSE);
m_processor = config->getProcessor(cc);
}
catch(OCIO::Exception &e)
{
error(e.what());
return;
}
if(m_processor->isNoOp())
{
// TODO or call disable() ?
set_out_channels(DD::Image::Mask_None); // prevents engine() from being called
copy_info();
return;
}
set_out_channels(DD::Image::Mask_All);
DD::Image::PixelIop::_validate(for_real);
}
示例4: main
//.........这里部分代码省略.........
}
if(convertsToLinear && convertsFromLinear)
{
std::cout << cs->getName() << std::endl;
}
else if(!convertsToLinear && !convertsFromLinear)
{
std::cout << cs->getName();
std::cout << " -- error" << std::endl;
std::cout << "\t" << convertsToLinearErrorText << std::endl;
std::cout << "\t" << convertsFromLinearErrorText << std::endl;
errorcount += 1;
}
else if(convertsToLinear)
{
std::cout << cs->getName();
std::cout << " -- input only" << std::endl;
}
else if(convertsFromLinear)
{
std::cout << cs->getName();
std::cout << " -- output only" << std::endl;
}
}
}
std::cout << std::endl;
std::cout << "** Looks **" << std::endl;
if(config->getNumLooks()>0)
{
for(int i=0; i<config->getNumLooks(); ++i)
{
std::cout << config->getLookNameByIndex(i) << std::endl;
}
}
else
{
std::cout << "no looks defined" << std::endl;
}
std::cout << std::endl;
std::cout << "** Sanity Check **" << std::endl;
try
{
config->sanityCheck();
std::cout << "passed" << std::endl;
}
catch(OCIO::Exception & exception)
{
std::cout << "ERROR" << std::endl;
errorcount += 1;
std::cout << exception.what() << std::endl;
}
if(!outputconfig.empty())
{
std::ofstream output;
output.open(outputconfig.c_str());
if(!output.is_open())
{
std::cout << "Error opening " << outputconfig << " for writing." << std::endl;
}
else
{
config->serialize(output);
output.close();
std::cout << "Wrote " << outputconfig << std::endl;
}
}
}
catch(OCIO::Exception & exception)
{
std::cout << "ERROR: " << exception.what() << std::endl;
return 1;
} catch (std::exception& exception) {
std::cout << "ERROR: " << exception.what() << "\n";
return 1;
}
catch(...)
{
std::cout << "Unknown error encountered." << std::endl;
return 1;
}
std::cout << std::endl;
if(errorcount == 0)
{
std::cout << "Tests complete." << std::endl << std::endl;
return 0;
}
else
{
std::cout << errorcount << " tests failed." << std::endl << std::endl;
return 1;
}
}
示例5: _validate
void OCIOLookTransform::_validate(bool for_real)
{
input0().validate(for_real);
if(!m_hasColorSpaces)
{
error("No colorspaces available for input and/or output.");
return;
}
int inputColorSpaceCount = static_cast<int>(m_inputColorSpaceCstrNames.size()) - 1;
if(m_inputColorSpaceIndex < 0 || m_inputColorSpaceIndex >= inputColorSpaceCount)
{
std::ostringstream err;
err << "Input colorspace index (" << m_inputColorSpaceIndex << ") out of range.";
error(err.str().c_str());
return;
}
int outputColorSpaceCount = static_cast<int>(m_outputColorSpaceCstrNames.size()) - 1;
if(m_outputColorSpaceIndex < 0 || m_outputColorSpaceIndex >= outputColorSpaceCount)
{
std::ostringstream err;
err << "Output colorspace index (" << m_outputColorSpaceIndex << ") out of range.";
error(err.str().c_str());
return;
}
try
{
const char * inputName = m_inputColorSpaceCstrNames[m_inputColorSpaceIndex];
const char * outputName = m_outputColorSpaceCstrNames[m_outputColorSpaceIndex];
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
config->sanityCheck();
OCIO::LookTransformRcPtr transform = OCIO::LookTransform::Create();
const char * look = m_lookCstrNames[m_lookIndex];
if(look != NULL)
{
transform->setLooks(look);
}
OCIO::ConstContextRcPtr context = getLocalContext();
OCIO::TransformDirection direction = OCIO::TRANSFORM_DIR_UNKNOWN;
bool invertTransform = (m_dirIndex == 0) ? false : true;
// Forward
if(!invertTransform)
{
transform->setSrc(inputName);
transform->setDst(outputName);
direction = OCIO::TRANSFORM_DIR_FORWARD;
}
else
{
// The TRANSFORM_DIR_INVERSE applies an inverse for the end-to-end transform,
// which would otherwise do dst->inv look -> src.
// This is an unintuitive result for the artist (who would expect in, out to
// remain unchanged), so we account for that here by flipping src/dst
transform->setSrc(outputName);
transform->setDst(inputName);
direction = OCIO::TRANSFORM_DIR_INVERSE;
}
try
{
m_processor = config->getProcessor(context, transform, direction);
}
// We only catch the exceptions for missing files, and try to succeed
// in this case. All other errors represent more serious problems and
// should fail through.
catch(const OCIO::ExceptionMissingFile &e)
{
if(!m_ignoreErrors) throw;
m_processor = config->getProcessor(context, inputName, outputName);
}
}
catch(const OCIO::Exception &e)
{
error(e.what());
return;
}
catch (...)
{
error("OCIOLookTransform: Unknown exception during _validate.");
return;
}
if(m_processor->isNoOp())
{
// TODO or call disable() ?
set_out_channels(DD::Image::Mask_None); // prevents engine() from being called
copy_info();
return;
}
set_out_channels(DD::Image::Mask_All);
//.........这里部分代码省略.........