Mercurial > mplayer.hg
changeset 30107:11e3ee8cd05e
Put the colourspace-related variables into a separate struct to ease
extracting the code and sharing with other vos.
author | reimar |
---|---|
date | Thu, 31 Dec 2009 18:07:37 +0000 |
parents | e0d36dce5d85 |
children | 0898adc64a6f |
files | libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c libvo/vo_gl2.c |
diffstat | 4 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/gl_common.c Thu Dec 31 16:47:53 2009 +0000 +++ b/libvo/gl_common.c Thu Dec 31 18:07:37 2009 +0000 @@ -1018,7 +1018,7 @@ #define COL_V 2 #define COL_C 3 -static void get_yuv2rgb_coeffs(gl_conversion_params_t *params, float yuv2rgb[3][4]) { +static void get_yuv2rgb_coeffs(struct mp_csp_params *params, float yuv2rgb[3][4]) { float uvcos = params->saturation * cos(params->hue); float uvsin = params->saturation * sin(params->hue); int i; @@ -1049,7 +1049,7 @@ * \param map where to store map. Must provide space for (size + 2)^3 elements * \param size size of the map, excluding border */ -static void gen_yuv2rgb_map(gl_conversion_params_t *params, unsigned char *map, int size) { +static void gen_yuv2rgb_map(struct mp_csp_params *params, unsigned char *map, int size) { int i, j, k, l; float step = 1.0 / size; float y, u, v; @@ -1101,9 +1101,9 @@ texs[0] = (*texu)++; ActiveTexture(GL_TEXTURE0 + texs[0]); lookup_data = malloc(4 * LOOKUP_RES); - gen_gamma_map(lookup_data, LOOKUP_RES, params->rgamma); - gen_gamma_map(&lookup_data[LOOKUP_RES], LOOKUP_RES, params->ggamma); - gen_gamma_map(&lookup_data[2 * LOOKUP_RES], LOOKUP_RES, params->bgamma); + gen_gamma_map(lookup_data, LOOKUP_RES, params->csp_params.rgamma); + gen_gamma_map(&lookup_data[LOOKUP_RES], LOOKUP_RES, params->csp_params.ggamma); + gen_gamma_map(&lookup_data[2 * LOOKUP_RES], LOOKUP_RES, params->csp_params.bgamma); glCreateClearTex(GL_TEXTURE_2D, GL_LUMINANCE8, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LINEAR, LOOKUP_RES, 4, 0); glUploadTex(GL_TEXTURE_2D, GL_LUMINANCE, GL_UNSIGNED_BYTE, lookup_data, @@ -1121,7 +1121,7 @@ texs[0] = (*texu)++; ActiveTexture(GL_TEXTURE0 + texs[0]); lookup_data = malloc(3 * sz * sz * sz); - gen_yuv2rgb_map(params, lookup_data, LOOKUP_3DRES); + gen_yuv2rgb_map(¶ms->csp_params, lookup_data, LOOKUP_3DRES); glAdjustAlignment(sz); PixelStorei(GL_UNPACK_ROW_LENGTH, 0); TexImage3D(GL_TEXTURE_3D, 0, 3, sz, sz, sz, 1, @@ -1330,7 +1330,7 @@ '1', 'g', rect, params->chrom_texw, params->chrom_texh, params->filter_strength); add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, '2', 'b', rect, params->chrom_texw, params->chrom_texh, params->filter_strength); - get_yuv2rgb_coeffs(params, yuv2rgb); + get_yuv2rgb_coeffs(¶ms->csp_params, yuv2rgb); switch (YUV_CONVERSION(type)) { case YUV_CONVERSION_FRAGMENT: snprintf(prog_pos, prog_remain, yuv_prog_template, @@ -1345,7 +1345,7 @@ yuv2rgb[ROW_R][COL_U], yuv2rgb[ROW_G][COL_U], yuv2rgb[ROW_B][COL_U], yuv2rgb[ROW_R][COL_V], yuv2rgb[ROW_G][COL_V], yuv2rgb[ROW_B][COL_V], yuv2rgb[ROW_R][COL_C], yuv2rgb[ROW_G][COL_C], yuv2rgb[ROW_B][COL_C], - (float)1.0 / params->rgamma, (float)1.0 / params->bgamma, (float)1.0 / params->bgamma); + (float)1.0 / params->csp_params.rgamma, (float)1.0 / params->csp_params.bgamma, (float)1.0 / params->csp_params.bgamma); break; case YUV_CONVERSION_FRAGMENT_LOOKUP: snprintf(prog_pos, prog_remain, yuv_lookup_prog_template, @@ -1397,8 +1397,8 @@ * \ingroup glconversion */ void glSetupYUVConversion(gl_conversion_params_t *params) { - float uvcos = params->saturation * cos(params->hue); - float uvsin = params->saturation * sin(params->hue); + float uvcos = params->csp_params.saturation * cos(params->csp_params.hue); + float uvsin = params->csp_params.saturation * sin(params->csp_params.hue); switch (YUV_CONVERSION(params->type)) { case YUV_CONVERSION_COMBINERS: glSetupYUVCombiners(uvcos, uvsin);
--- a/libvo/gl_common.h Thu Dec 31 16:47:53 2009 +0000 +++ b/libvo/gl_common.h Thu Dec 31 18:07:37 2009 +0000 @@ -327,9 +327,8 @@ //! extract chrominance scaler out of type #define YUV_CHROM_SCALER(t) ((t >> YUV_CHROM_SCALER_SHIFT) & YUV_SCALER_MASK) /** \} */ -typedef struct { - GLenum target; - int type; + +struct mp_csp_params { float brightness; float contrast; float hue; @@ -337,6 +336,12 @@ float rgamma; float ggamma; float bgamma; +}; + +typedef struct { + GLenum target; + int type; + struct mp_csp_params csp_params; int texw; int texh; int chrom_texw;
--- a/libvo/vo_gl.c Thu Dec 31 16:47:53 2009 +0000 +++ b/libvo/vo_gl.c Thu Dec 31 18:07:37 2009 +0000 @@ -216,7 +216,7 @@ float ggamma = exp(log(8.0) * eq_ggamma / 100.0); float bgamma = exp(log(8.0) * eq_bgamma / 100.0); gl_conversion_params_t params = {gl_target, yuvconvtype, - bri, cont, hue, sat, rgamma, ggamma, bgamma, + {bri, cont, hue, sat, rgamma, ggamma, bgamma}, texture_width, texture_height, 0, 0, filter_strength}; mp_get_chroma_shift(image_format, &xs, &ys); params.chrom_texw = params.texw >> xs;
--- a/libvo/vo_gl2.c Thu Dec 31 16:47:53 2009 +0000 +++ b/libvo/vo_gl2.c Thu Dec 31 18:07:37 2009 +0000 @@ -571,7 +571,7 @@ if (is_yuv) { int xs, ys; gl_conversion_params_t params = {GL_TEXTURE_2D, use_yuv, - 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, + {0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0}, texture_width, texture_height, 0, 0, 0}; switch (use_yuv) { case YUV_CONVERSION_FRAGMENT_LOOKUP: