X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=effect_chain_test.cpp;h=20fd9bc97395672921b05f677f34efdf0d35762b;hb=f0b80b6641dcc4a88398f4c20f4a38fb08fb3dc3;hp=0161a92cf6b6a15ee8c37c7a7319fa5618af013e;hpb=1bd28ba3c43338724457bd2cfeb3c15c33347d39;p=movit diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index 0161a92..20fd9bc 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -80,3 +80,32 @@ TEST(MirrorTest, BasicTest) { expect_equal(expected_data, out_data, 3, 2); } + +// The identity effect needs linear light, and thus will get conversions on both sides. +// Verify that sRGB data is properly converted to and from linear light for the entire ramp. +TEST(EffectChainTest, IdentityThroughsRGBConversions) { + float data[256]; + for (unsigned i = 0; i < 256; ++i) { + data[i] = i / 255.0; + }; + float out_data[256]; + EffectChainTester tester(data, 256, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_sRGB); + tester.get_chain()->add_effect(new IdentityEffect()); + tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_sRGB); + + expect_equal(data, out_data, 256, 1); +} + +// Same, for the Rec. 601/709 gamma curve. +TEST(EffectChainTest, IdentityThroughRec709) { + float data[256]; + for (unsigned i = 0; i < 256; ++i) { + data[i] = i / 255.0; + }; + float out_data[256]; + EffectChainTester tester(data, 256, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_REC_709); + tester.get_chain()->add_effect(new IdentityEffect()); + tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_REC_709); + + expect_equal(data, out_data, 256, 1); +}