]> git.sesse.net Git - movit/blobdiff - gamma_compression_effect_test.cpp
Hard-assert on something that has bitten me too many times now.
[movit] / gamma_compression_effect_test.cpp
index 6efbdea0944211a82e157518b616fb71b0cdf0a1..db2023457142411415a4a2ad5aa57916458a774b 100644 (file)
@@ -26,7 +26,7 @@ TEST(GammaCompressionEffectTest, sRGB_KeyValues) {
                0.040f, 0.041f,
                0.0f, 1.0f,
        };
-       float out_data[4];
+       float out_data[6];
        EffectChainTester tester(data, 2, 3, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR);
        tester.run(out_data, GL_RED, COLORSPACE_sRGB, GAMMA_sRGB);
 
@@ -54,13 +54,7 @@ TEST(GammaCompressionEffectTest, sRGB_Accuracy) {
                double x = i / 255.0;
 
                expected_data[i] = x;
-
-               // From the Wikipedia article on sRGB.
-               if (x < 0.04045) {
-                       data[i] = x / 12.92;
-               } else {
-                       data[i] = pow((x + 0.055) / 1.055, 2.4);
-               }
+               data[i] = srgb_to_linear(x);
        }
 
        EffectChainTester tester(data, 256, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_LINEAR, GL_RGBA32F);