X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=gamma_expansion_effect_test.cpp;h=1e399dc87be126e0059d78f1872a0228e0df04bc;hp=0e7670d093876d5c845278a841630fc28bf6fd11;hb=12a1f8177c22386171ded47947b9422f27f5f1b2;hpb=9651a4eaae012cdc49c1aa38197861e04f62e91e diff --git a/gamma_expansion_effect_test.cpp b/gamma_expansion_effect_test.cpp index 0e7670d..1e399dc 100644 --- a/gamma_expansion_effect_test.cpp +++ b/gamma_expansion_effect_test.cpp @@ -1,6 +1,6 @@ // Unit tests for GammaExpansionEffect. -#include +#include #include #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