]> git.sesse.net Git - movit/blobdiff - gamma_expansion_effect.cpp
Use the ResourcePool to allocate RTT textures in EffectChain.
[movit] / gamma_expansion_effect.cpp
index efec55379740d8253ff9eeccbd95bbb6847c132f..bfccaa04b925a3aacd6d359a8b9680a2d1899373 100644 (file)
@@ -32,7 +32,7 @@ void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const std::stri
        // very low values (up to some β) are linear. Above β, we have a power curve
        // that looks like this:
        //
-       //   y = ((x + ɑ - 1) / ɑ)^β
+       //   y = ((x + ɑ - 1) / ɑ)^ɣ
        //
        // However, pow() is relatively slow in GLSL, so we approximate this
        // part by a minimax polynomial, whose coefficients are precalculated
@@ -72,8 +72,11 @@ void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const std::stri
                // From the Wikipedia article on sRGB; ɑ (called a+1 there) = 1.055,
                // β = 0.04045, ɣ = 2.4.
                // maxerror      = 0.000094
-               // error at beta = 0.000094
-               // error at 1.0  = 0.000094
+               // error at beta = 0.000012
+               // error at 1.0  = 0.000012
+               //
+               // Note that the worst _relative_ error by far is just at the beginning
+               // of the exponential curve, ie., just around β.
                set_uniform_float(glsl_program_num, prefix, "linear_scale", 1.0 / 12.92);
                set_uniform_float(glsl_program_num, prefix, "c0", 0.001324469581);
                set_uniform_float(glsl_program_num, prefix, "c1", 0.02227416690);