| 122 | } |
| 123 | |
| 124 | bool IsEquivalentColorSpace(const std::string_view& colorspace1, |
| 125 | const std::string_view& colorspace2) { |
| 126 | EnsureOpenImageIOInitialized(); |
| 127 | #if OIIO_VERSION >= OIIO_MAKE_VERSION(3, 0, 0) |
| 128 | return OIIO::equivalent_colorspace(colorspace1, colorspace2); |
| 129 | #else |
| 130 | // Poor (wo)man's version of available functionality in recent OIIO versions. |
| 131 | auto is_linear_srgb = [](const std::string_view& colorspace) { |
| 132 | return colorspace == "linear" || colorspace == "lin_srgb" || |
| 133 | colorspace == "lin_rec709P"; |
| 134 | }; |
| 135 | if (is_linear_srgb(colorspace1) && is_linear_srgb(colorspace2)) { |
| 136 | return true; |
| 137 | } else { |
| 138 | return colorspace1 == colorspace2; |
| 139 | } |
| 140 | #endif |
| 141 | } |
| 142 | |
| 143 | } // namespace |
| 144 |
no test coverage detected