Define a set of test values to use for a config and store them in the fingerprints struct. An attempt is made to convert them to the reference spaces of the config being used. There are separate values for scene-referred and display-referred color spaces.
| 1237 | // There are separate values for scene-referred and display-referred color spaces. |
| 1238 | // |
| 1239 | void initializeTestVals(ColorSpaceFingerprints & fingerprints, const ConstConfigRcPtr & config) |
| 1240 | { |
| 1241 | // Define a set of test values that are slightly inside the Rec.709 gamut |
| 1242 | // for the most common scene-referred and display-referred reference spaces. |
| 1243 | |
| 1244 | // TODO: Including negative values would exclude some matches that are probably |
| 1245 | // desirable, it's an open question how strict the matching should be. |
| 1246 | |
| 1247 | std::vector<float> ACESvals = { |
| 1248 | 0.408933127871f, 0.106169822808f, 0.027842572707f, 0.f, // lin_rec709 {0.9, 0.03, 0.01} |
| 1249 | 0.374615373650f, 0.739417755017f, 0.118862613721f, 0.f, // lin_rec709 {0.06, 0.9, 0.02} |
| 1250 | 0.171696591718f, 0.104272268468f, 0.786227391453f, 0.f, // lin_rec709 {0.01, 0.02, 0.9} |
| 1251 | 0.f , 0.f , 0.f , 0.5f, |
| 1252 | 0.037018876439f, 0.030827687576f, 0.021641700645f, 0.f, // lin_rec709 {0.05, 0.03, 0.02} |
| 1253 | 1.f , 1.f , 1.f , 1.f }; |
| 1254 | |
| 1255 | std::vector<float> XYZvals = { |
| 1256 | // Adjusted to keep it inside both Rec.601 and Rec.601 PAL. |
| 1257 | 0.383684057405f, 0.213552088801f, 0.030478901760f, 0.f, // lin_rec709 {0.9, 0.03, 0.01} |
| 1258 | 0.350178969169f, 0.657853997550f, 0.127445793983f, 0.f, // lin_rec709 {0.06, 0.9, 0.02} |
| 1259 | 0.173708304342f, 0.081402847459f, 0.858056140808f, 0.f, // lin_rec709 {0.01, 0.02, 0.9} |
| 1260 | 0.f , 0.f , 0.f , 0.5f, |
| 1261 | 0.034956685913f, 0.033530856964f, 0.023553027375f, 0.f, // lin_rec709 {0.05, 0.03, 0.02} |
| 1262 | 0.950455927052f, 1.f , 1.089057750760f, 1.f }; |
| 1263 | |
| 1264 | // Try to convert to the actual reference spaces of the config. |
| 1265 | |
| 1266 | fingerprints.sceneRefTestVals = ACESvals; |
| 1267 | fingerprints.displayRefTestVals = XYZvals; |
| 1268 | |
| 1269 | ConstProcessorRcPtr p; |
| 1270 | try |
| 1271 | { |
| 1272 | // First check if the config recognizes one of the common names. |
| 1273 | ConstColorSpaceRcPtr cs; |
| 1274 | cs = config->getColorSpace("aces_interchange"); |
| 1275 | if (!cs) |
| 1276 | { |
| 1277 | cs = config->getColorSpace("ACES2065-1"); |
| 1278 | if (!cs) |
| 1279 | { |
| 1280 | cs = config->getColorSpace("lin_ap0_scene"); |
| 1281 | if (!cs) |
| 1282 | { |
| 1283 | // Otherwise, see if it's present using a different name. |
| 1284 | ConstConfigRcPtr builtinConfig = Config::CreateFromBuiltinConfig("ocio://cg-config-latest"); |
| 1285 | // This throws if it cannot find the requested space. |
| 1286 | const char * cs_name = |
| 1287 | Config::IdentifyBuiltinColorSpace(config, builtinConfig, "aces_interchange"); |
| 1288 | cs = config->getColorSpace(cs_name); |
| 1289 | } |
| 1290 | } |
| 1291 | } |
| 1292 | |
| 1293 | ConstTransformRcPtr toRef = getTransformForDir(cs, COLORSPACE_DIR_TO_REFERENCE); |
| 1294 | p = config->getProcessor(toRef); |
| 1295 | |
| 1296 | const size_t n = ACESvals.size(); |
no test coverage detected