csputils, vo_opengl: remove per-component gamma

There was some code accounting for different gamma values for R/G/B.
It's inherited from an old, undocumented MPlayer feature, which was at
some point disabled for convenience by myself (meaning you couldn't
actually set separate gamma because it was removed from the property
interface - mp_csp_copy_equalizer_values() just set them to the same
value). Get rid of these meaningless leftovers.
This commit is contained in:
wm4 2015-02-03 16:52:44 +01:00
parent 0f560bbf8a
commit f296dcb248
4 changed files with 7 additions and 15 deletions

View File

@ -633,10 +633,7 @@ void mp_csp_copy_equalizer_values(struct mp_csp_params *params,
params->contrast = (eq->values[MP_CSP_EQ_CONTRAST] + 100) / 100.0; params->contrast = (eq->values[MP_CSP_EQ_CONTRAST] + 100) / 100.0;
params->hue = eq->values[MP_CSP_EQ_HUE] / 100.0 * M_PI; params->hue = eq->values[MP_CSP_EQ_HUE] / 100.0 * M_PI;
params->saturation = (eq->values[MP_CSP_EQ_SATURATION] + 100) / 100.0; params->saturation = (eq->values[MP_CSP_EQ_SATURATION] + 100) / 100.0;
float gamma = exp(log(8.0) * eq->values[MP_CSP_EQ_GAMMA] / 100.0); params->gamma = exp(log(8.0) * eq->values[MP_CSP_EQ_GAMMA] / 100.0);
params->rgamma = gamma;
params->ggamma = gamma;
params->bgamma = gamma;
} }
static int find_eq(int capabilities, const char *name) static int find_eq(int capabilities, const char *name)

View File

@ -114,9 +114,7 @@ struct mp_csp_params {
float contrast; float contrast;
float hue; float hue;
float saturation; float saturation;
float rgamma; float gamma;
float ggamma;
float bgamma;
// discard U/V components // discard U/V components
bool gray; bool gray;
// texture_bits/input_bits is for rescaling fixed point input to range [0,1] // texture_bits/input_bits is for rescaling fixed point input to range [0,1]
@ -132,8 +130,7 @@ struct mp_csp_params {
.levels_in = MP_CSP_LEVELS_TV, \ .levels_in = MP_CSP_LEVELS_TV, \
.levels_out = MP_CSP_LEVELS_PC, \ .levels_out = MP_CSP_LEVELS_PC, \
.brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \ .brightness = 0, .contrast = 1, .hue = 0, .saturation = 1, \
.rgamma = 1, .ggamma = 1, .bgamma = 1, \ .gamma = 1, .texture_bits = 8, .input_bits = 8}
.texture_bits = 8, .input_bits = 8}
struct mp_image_params; struct mp_image_params;
void mp_csp_set_image_params(struct mp_csp_params *params, void mp_csp_set_image_params(struct mp_csp_params *params,

View File

@ -567,10 +567,8 @@ static void update_uniforms(struct gl_video *p, GLuint program)
gl->Uniform1f(gl->GetUniformLocation(program, "sig_offset"), sig_offset); gl->Uniform1f(gl->GetUniformLocation(program, "sig_offset"), sig_offset);
float gamma = p->opts.gamma ? p->opts.gamma : 1.0; float gamma = p->opts.gamma ? p->opts.gamma : 1.0;
gl->Uniform3f(gl->GetUniformLocation(program, "inv_gamma"), gl->Uniform1f(gl->GetUniformLocation(program, "inv_gamma"),
1.0 / (cparams.rgamma * gamma), 1.0 / (cparams.gamma * gamma));
1.0 / (cparams.ggamma * gamma),
1.0 / (cparams.bgamma * gamma));
for (int n = 0; n < p->plane_count; n++) { for (int n = 0; n < p->plane_count; n++) {
char textures_n[32]; char textures_n[32];

View File

@ -178,7 +178,7 @@ uniform mat3 colormatrix;
uniform vec3 colormatrix_c; uniform vec3 colormatrix_c;
uniform mat3 cms_matrix; uniform mat3 cms_matrix;
uniform mat2 dither_trafo; uniform mat2 dither_trafo;
uniform vec3 inv_gamma; uniform float inv_gamma;
uniform float input_gamma; uniform float input_gamma;
uniform float conv_gamma; uniform float conv_gamma;
uniform float sig_center; uniform float sig_center;
@ -495,7 +495,7 @@ void main() {
color = clamp(color, 0.0, 1.0); color = clamp(color, 0.0, 1.0);
#ifdef USE_GAMMA_POW #ifdef USE_GAMMA_POW
// User-defined gamma correction factor (via the gamma sub-option) // User-defined gamma correction factor (via the gamma sub-option)
color = pow(color, inv_gamma); color = pow(color, vec3(inv_gamma));
#endif #endif
#ifdef USE_3DLUT #ifdef USE_3DLUT
// For the 3DLUT we are arbitrarily using 2.4 as input gamma to reduce // For the 3DLUT we are arbitrarily using 2.4 as input gamma to reduce