Mercurial > mplayer.hg
changeset 36111:55bd3eed6c9a
Add xyz support for -vo gl.
author | reimar |
---|---|
date | Wed, 01 May 2013 18:52:42 +0000 |
parents | c6215f816368 |
children | e2e188ede1d1 |
files | libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c |
diffstat | 3 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/gl_common.c Wed May 01 18:52:41 2013 +0000 +++ b/libvo/gl_common.c Wed May 01 18:52:42 2013 +0000 @@ -1459,12 +1459,24 @@ strcpy(yuv_prog, prog_hdr); prog_pos = yuv_prog + sizeof(prog_hdr) - 1; prog_remain = MAX_PROGSZ - sizeof(prog_hdr); + if (!params->is_planar) { + // interleaved + snprintf(prog_pos, prog_remain, "TEX yuv.rgb, fragment.texcoord[0], texture[0], %s;\n", rect ? "RECT" : "2D"); + prog_remain -= strlen(prog_pos); + prog_pos += strlen(prog_pos); + } else { add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs, '0', 'r', rect, texw, texh, params->filter_strength); add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, '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); + } + if (params->csp_params.format == MP_CSP_XYZ) { + snprintf(prog_pos, prog_remain, "PARAM xyzgamma = {2.6};\nPOW yuv.r, yuv.r, xyzgamma.r;\nPOW yuv.g, yuv.g, xyzgamma.r;\nPOW yuv.b, yuv.b, xyzgamma.r;\n"); + prog_remain -= strlen(prog_pos); + prog_pos += strlen(prog_pos); + } mp_get_yuv2rgb_coeffs(¶ms->csp_params, yuv2rgb); // enable/disable gamma on demand
--- a/libvo/gl_common.h Wed May 01 18:52:41 2013 +0000 +++ b/libvo/gl_common.h Wed May 01 18:52:42 2013 +0000 @@ -157,6 +157,7 @@ int texh; int chrom_texw; int chrom_texh; + int is_planar; float filter_strength; float noise_strength; int has_alpha_tex;
--- a/libvo/vo_gl.c Wed May 01 18:52:41 2013 +0000 +++ b/libvo/vo_gl.c Wed May 01 18:52:42 2013 +0000 @@ -111,6 +111,7 @@ static int colorspace; static int levelconv; static int is_yuv; +static int is_xyz; static int lscale; static int cscale; static float filter_strength; @@ -259,6 +260,14 @@ params.chrom_texw = params.texw >> xs; params.chrom_texh = params.texh >> ys; params.csp_params.input_shift = -depth & 7; + params.is_planar = is_yuv; + if (is_xyz) { + params.csp_params.format = MP_CSP_XYZ; + params.csp_params.input_shift = 0; + params.csp_params.rgamma *= 2.2; + params.csp_params.ggamma *= 2.2; + params.csp_params.bgamma *= 2.2; + } glSetupYUVConversion(¶ms); if (custom_prog) { FILE *f = fopen(custom_prog, "rb"); @@ -568,7 +577,7 @@ if (mipmap_gen) mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); - if (is_yuv || stereo_mode == GL_3D_STIPPLE) { + if (is_yuv || is_xyz || custom_prog || stereo_mode == GL_3D_STIPPLE) { int i; mpglGenTextures(21, default_texs); default_texs[21] = 0; @@ -602,7 +611,7 @@ mpglActiveTexture(GL_TEXTURE0); mpglBindTexture(gl_target, 0); } - if (is_yuv || custom_prog) + if (is_yuv || is_xyz || custom_prog) { if ((MASK_NOT_COMBINERS & (1 << use_yuv)) || custom_prog) { if (!mpglGenPrograms || !mpglBindProgram) { @@ -710,6 +719,7 @@ image_format = format; is_yuv = mp_get_chroma_shift(image_format, &xs, &ys, NULL) > 0; is_yuv |= (xs << 8) | (ys << 16); + is_xyz = IMGFMT_IS_XYZ(image_format); glFindFormat(format, NULL, &gl_texfmt, &gl_format, &gl_type); if (glctx.type == GLTYPE_OSX && vo_doublebuffering && !is_yuv) { @@ -888,7 +898,7 @@ static void do_render(void) { mpglColor4f(1,1,1,1); - if (is_yuv || custom_prog) + if (is_yuv || is_xyz || custom_prog) glEnableYUVConversion(gl_target, yuvconvtype); if (stereo_mode) { glEnable3DLeft(stereo_mode); @@ -911,7 +921,7 @@ using_tex_rect, is_yuv, mpi_flipped ^ vo_flipped, 0); } - if (is_yuv || custom_prog) + if (is_yuv || is_xyz || custom_prog) glDisableYUVConversion(gl_target, yuvconvtype); did_render = 1; } @@ -1188,6 +1198,8 @@ (depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) && (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format))) return caps; + if ((MASK_NOT_COMBINERS & (1 << use_yuv)) && IMGFMT_IS_XYZ(format)) + return caps; // HACK, otherwise we get only b&w with some filters (e.g. -vf eq) // ideally MPlayer should be fixed instead not to use Y800 when it has the choice if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800))