diff --git a/src/libOpenImageIO/color_ocio.cpp b/src/libOpenImageIO/color_ocio.cpp index fbfea11edf..0d4dd7643c 100644 --- a/src/libOpenImageIO/color_ocio.cpp +++ b/src/libOpenImageIO/color_ocio.cpp @@ -612,6 +612,9 @@ ColorConfig::Impl::classify_by_name(CSInfo& cs) } else if (cs.name == "srgbf" || cs.name == "srgbh" || cs.name == "srgb16" || cs.name == "srgb8") { cs.setflag(CSInfo::is_srgb, srgb_alias); + } else if (cs.name == "srgblnf" || cs.name == "srgblnh" + || cs.name == "srgbln16" || cs.name == "srgbln8") { + cs.setflag(CSInfo::is_lin_srgb, lin_srgb_alias); } #endif diff --git a/src/libOpenImageIO/imagebufalgo_test.cpp b/src/libOpenImageIO/imagebufalgo_test.cpp index 2a8fdae647..46409820b8 100644 --- a/src/libOpenImageIO/imagebufalgo_test.cpp +++ b/src/libOpenImageIO/imagebufalgo_test.cpp @@ -1140,19 +1140,31 @@ void test_color_management() { ColorConfig config; + auto processor = config.createColorProcessor("lin_srgb", "srgb"); + // These color spaces might not be found if the site running this test + // has a weirdo OCIO config that doesn't contain those names. If we fail, + // try again using the built-in config (OCIO 2.2+) and hope for the best. + if (!processor) + processor = ColorConfig("ocio://default") + .createColorProcessor("lin_srgb", "srgb"); + OIIO_CHECK_ASSERT(processor); // Test the IBA::colorconvert version that works on a color at a time { - auto processor = config.createColorProcessor("lin_srgb", "srgb"); - float rgb[3] = { 0.5f, 0.5f, 0.5f }; - ImageBufAlgo::colorconvert(rgb, processor.get(), false); + float rgb[3] = { 0.5f, 0.5f, 0.5f }; + bool r = ImageBufAlgo::colorconvert(rgb, processor.get(), false); + OIIO_CHECK_ASSERT(r); + if (!r) + OIIO::print("colorconvert error: {}\n", OIIO::geterror()); OIIO_CHECK_EQUAL_THRESH(rgb[1], 0.735356983052449f, 1.0e-5); } { - auto processor = config.createColorProcessor("lin_srgb", "srgb"); - float rgb[4] = { 0.5f, 0.5f, 0.5f, 1.0f }; - ImageBufAlgo::colorconvert(rgb, processor.get(), true); - OIIO_CHECK_EQUAL_THRESH(rgb[1], 0.735356983052449f, 1.0e-5); + float rgba[4] = { 0.5f, 0.5f, 0.5f, 1.0f }; + bool r = ImageBufAlgo::colorconvert(rgba, processor.get(), true); + OIIO_CHECK_ASSERT(r); + if (!r) + OIIO::print("colorconvert error: {}\n", OIIO::geterror()); + OIIO_CHECK_EQUAL_THRESH(rgba[1], 0.735356983052449f, 1.0e-5); } }