]> git.sesse.net Git - movit/blobdiff - gamma_expansion_effect.cpp
Move to 'using namespace std;' in all .cpp files.
[movit] / gamma_expansion_effect.cpp
index 9025b0b9ac767731d3bb60806fb9372e8b2ef6cc..f51dc21c17dad084e98491227fffe35e3e4f474e 100644 (file)
@@ -5,13 +5,15 @@
 #include "gamma_expansion_effect.h"
 #include "util.h"
 
+using namespace std;
+
 GammaExpansionEffect::GammaExpansionEffect()
        : source_curve(GAMMA_LINEAR)
 {
        register_int("source_curve", (int *)&source_curve);
 }
 
-std::string GammaExpansionEffect::output_fragment_shader()
+string GammaExpansionEffect::output_fragment_shader()
 {
        if (source_curve == GAMMA_LINEAR) {
                return read_file("identity.frag");
@@ -24,7 +26,7 @@ std::string GammaExpansionEffect::output_fragment_shader()
        assert(false);
 }
 
-void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num)
+void GammaExpansionEffect::set_gl_state(GLuint glsl_program_num, const string &prefix, unsigned *sampler_num)
 {
        Effect::set_gl_state(glsl_program_num, prefix, sampler_num);
 
@@ -72,8 +74,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);