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

Method getLutData

tests/cpu/Config_tests.cpp:10067–10098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10065 }
10066
10067 inline std::vector<uint8_t> getLutData(
10068 const char * filepath) const override
10069 {
10070 std::vector<std::string> paths = {
10071 std::string(OCIO::GetTestFilesDir()),
10072 std::string("configs"),
10073 std::string("context_test1"),
10074 std::string(filepath),
10075 };
10076 const std::string lutPath = pystring::os::path::normpath(
10077 pystring::os::path::join(paths)
10078 );
10079
10080 std::ifstream fstream(
10081 OCIO::Platform::filenameToUTF(lutPath).c_str(),
10082 std::ios_base::in | std::ios_base::binary | std::ios::ate
10083 );
10084 if (fstream.fail())
10085 {
10086 std::ostringstream os;
10087 os << "Error could not read LUT file : " << lutPath;
10088 throw OCIO::Exception (os.str().c_str());
10089 }
10090
10091 const auto eofPosition = static_cast<std::streamoff>(fstream.tellg());
10092 std::vector<uint8_t> buffer;
10093 buffer.resize(eofPosition);
10094 fstream.seekg(0, std::ios::beg);
10095 fstream.read(reinterpret_cast<char*>(buffer.data()), eofPosition);
10096
10097 return buffer;
10098 }
10099
10100 inline std::string getFastLutFileHash(const char * filename) const override
10101 {

Callers

nothing calls this directly

Calls 6

filenameToUTFFunction · 0.85
resizeMethod · 0.45
readMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected