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

Method optimize

src/OpenColorIO/OpOptimizers.cpp:611–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611void OpRcPtrVec::optimize(OptimizationFlags oFlags)
612{
613 if (m_ops.empty())
614 {
615 return;
616 }
617
618 if (IsDebugLoggingEnabled())
619 {
620 std::ostringstream oss;
621 oss << std::endl
622 << "**" << std::endl
623 << "Optimizing Op Vec..." << std::endl
624 << SerializeOpVec(*this, 4) << std::endl;
625
626 LogDebug(oss.str());
627 }
628
629 const auto originalSize = size();
630
631 // NoOpType can be removed (facilitates conversion to a CPU/GPUProcessor).
632 const int total_nooptype = RemoveNoOpTypes(*this);
633
634 if (oFlags == OPTIMIZATION_NONE)
635 {
636 if (IsDebugLoggingEnabled())
637 {
638 OpRcPtrVec::size_type finalSize = size();
639
640 std::ostringstream os;
641 os << "**" << std::endl;
642 os << "Optimized ";
643 os << originalSize << "->" << finalSize << ", 1 pass, ";
644 os << total_nooptype << " no-op types removed\n";
645 os << SerializeOpVec(*this, 4);
646 LogDebug(os.str());
647 }
648
649 return;
650 }
651
652 // Keep dynamic ops using their default values. Remove the ability to modify
653 // them dynamically.
654 const auto removeDynamic = HasFlag(oFlags, OPTIMIZATION_NO_DYNAMIC_PROPERTIES);
655 if (removeDynamic)
656 {
657 RemoveDynamicProperties(*this);
658 }
659
660 // As the input and output bit-depths represent the color processing
661 // request and they may be altered by the following optimizations,
662 // preserve their values.
663
664 int total_noops = 0;
665 int total_replacedops = 0;
666 int total_identityops = 0;
667 int total_inverseops = 0;
668 int total_combines = 0;

Callers 15

finalizeMethod · 0.80
FinalizeOpsForCPUFunction · 0.80
getOptimizedProcessorMethod · 0.80
EvalTransformFunction · 0.80
writeMethod · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80

Calls 13

IsDebugLoggingEnabledFunction · 0.85
SerializeOpVecFunction · 0.85
LogDebugFunction · 0.85
RemoveNoOpTypesFunction · 0.85
HasFlagFunction · 0.85
RemoveDynamicPropertiesFunction · 0.85
RemoveNoOpsFunction · 0.85
ReplaceOpsFunction · 0.85
ReplaceIdentityOpsFunction · 0.85
RemoveInverseOpsFunction · 0.85
CombineOpsFunction · 0.85
ReplaceInverseLutsFunction · 0.85

Tested by 14

OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64