X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=gamma_expansion_effect.cpp;h=bfccaa04b925a3aacd6d359a8b9680a2d1899373;hp=efec55379740d8253ff9eeccbd95bbb6847c132f;hb=245513f7873fca03be3f031beddaca716d7536d9;hpb=9a00101dbb6f98d21c6b8ce4d33200af840ea908 diff --git a/gamma_expansion_effect.cpp b/gamma_expansion_effect.cpp index efec553..bfccaa0 100644 --- a/gamma_expansion_effect.cpp +++ b/gamma_expansion_effect.cpp @@ -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);