]> git.sesse.net Git - movit/blobdiff - gamma_expansion_effect_test.cpp
Minor improvement to a test name.
[movit] / gamma_expansion_effect_test.cpp
index 0e7670d093876d5c845278a841630fc28bf6fd11..1e399dc87be126e0059d78f1872a0228e0df04bc 100644 (file)
@@ -1,6 +1,6 @@
 // Unit tests for GammaExpansionEffect.
 
-#include <GL/glew.h>
+#include <epoxy/gl.h>
 #include <math.h>
 
 #include "gamma_expansion_effect.h"
@@ -8,6 +8,8 @@
 #include "gtest/gtest-message.h"
 #include "test_util.h"
 
+namespace movit {
+
 TEST(GammaExpansionEffectTest, sRGB_KeyValues) {
        float data[] = {
                0.0f, 1.0f,
@@ -60,13 +62,7 @@ TEST(GammaExpansionEffectTest, sRGB_Accuracy) {
                double x = i / 255.0;
 
                data[i] = x;
-
-               // From the Wikipedia article on sRGB.
-               if (x < 0.04045) {
-                       expected_data[i] = x / 12.92;
-               } else {
-                       expected_data[i] = pow((x + 0.055) / 1.055, 2.4);
-               }
+               expected_data[i] = srgb_to_linear(x);
        }
 
        EffectChainTester tester(data, 256, 1, FORMAT_GRAYSCALE, COLORSPACE_sRGB, GAMMA_sRGB, GL_RGBA32F);
@@ -250,3 +246,5 @@ TEST(GammaExpansionEffectTest, Rec2020_12Bit_Inaccuracy) {
        //
        test_accuracy(expected_data, out_data, 4096, 1e-3, 0.01, 2.50, 1e-4);
 }
+
+}  // namespace movit