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

Method bake

src/OpenColorIO/fileformats/FileFormatHDL.cpp:590–823  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590void LocalFileFormat::bake(const Baker & baker,
591 const std::string & formatName,
592 std::ostream & ostream) const
593{
594
595 if(formatName != "houdini")
596 {
597 std::ostringstream os;
598 os << "Unknown hdl format name, '";
599 os << formatName << "'.";
600 throw Exception(os.str().c_str());
601 }
602
603 // setup the floating point precision
604 ostream.setf(std::ios::fixed, std::ios::floatfield);
605 ostream.precision(6);
606
607 // Default sizes
608 const int DEFAULT_SHAPER_SIZE = 1024;
609 // MPlay produces bad results with 32^3 cube (in a way
610 // that looks more quantised than even "nearest"
611 // interpolation in OCIOFileTransform)
612 const int DEFAULT_CUBE_SIZE = 64;
613 const int DEFAULT_1D_SIZE = 1024;
614
615 // Get configured sizes
616 int cubeSize = baker.getCubeSize();
617 int shaperSize = baker.getShaperSize();
618 int onedSize = baker.getCubeSize();
619
620 // Check defaults and cube size
621 if(cubeSize == -1) cubeSize = DEFAULT_CUBE_SIZE;
622
623 // ..and same for shaper size
624 if(shaperSize == -1) shaperSize = DEFAULT_SHAPER_SIZE;
625
626 // ..and finally, for the 1D LUT size
627 if(onedSize == -1) onedSize = DEFAULT_1D_SIZE;
628
629 // Version numbers
630 const int HDL_1D = 1; // 1D LUT version number
631 const int HDL_3D = 2; // 3D LUT version number
632 const int HDL_3D1D = 3; // 3D LUT with 1D prelut
633
634 // Get spaces from baker
635 const std::string shaperSpace = baker.getShaperSpace();
636
637 // Determine required LUT type
638 int required_lut = -1;
639
640 ConstCPUProcessorRcPtr inputToTarget = GetInputToTargetProcessor(baker);
641
642 if(inputToTarget->hasChannelCrosstalk())
643 {
644 if(shaperSpace.empty())
645 {
646 // Has crosstalk, but no prelut, so need 3D LUT
647 required_lut = HDL_3D;

Callers

nothing calls this directly

Calls 15

GetShaperRangeFunction · 0.85
GenerateLinearScaleLut1DFunction · 0.85
GenerateIdentityLut1DFunction · 0.85
GenerateIdentityLut3DFunction · 0.50
getCubeSizeMethod · 0.45
getShaperSizeMethod · 0.45
getShaperSpaceMethod · 0.45
hasChannelCrosstalkMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected