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

Function CompareRender

tests/cpu/OpOptimizers_tests.cpp:29–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void CompareRender(OCIO::OpRcPtrVec & ops1, OCIO::OpRcPtrVec & ops2,
30 unsigned line, float errorThreshold,
31 bool forceAlphaInRange = false)
32{
33 std::vector<float> img1 = {
34 0.778f, 0.824f, 0.885f, 0.153f,
35 0.044f, 0.014f, 0.088f, 0.999f,
36 0.488f, 0.381f, 0.f, 0.f,
37 1.000f, 1.52e-4f, 0.0229f, 1.f,
38 0.f, -0.1f, -2.f, -0.1f,
39 2.f, 1.9f, 0.f, 2.f };
40
41 if (forceAlphaInRange)
42 {
43 img1[19] = 0.f;
44 }
45
46 std::vector<float> img2 = img1;
47
48 const long nbPixels = (long)img1.size() / 4;
49
50 for (const auto & op : ops1)
51 {
52 // NB: This hard-codes OPTIMIZATION_FAST_LOG_EXP_POW to off, see Op.h.
53 op->apply(&img1[0], &img1[0], nbPixels);
54 }
55
56 for (const auto & op : ops2)
57 {
58 op->apply(&img2[0], &img2[0], nbPixels);
59 }
60
61 for (size_t idx = 0; idx < img1.size(); ++idx)
62 {
63 OCIO_CHECK_CLOSE_FROM(img1[idx], img2[idx], errorThreshold, line);
64 }
65}
66
67} // namespace
68

Callers 1

OCIO_ADD_TESTFunction · 0.85

Calls 2

sizeMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected