Mercurial > mplayer.hg
diff libvo/vo_gl.c @ 36111:55bd3eed6c9a
Add xyz support for -vo gl.
author | reimar |
---|---|
date | Wed, 01 May 2013 18:52:42 +0000 |
parents | 959e6a52e5b0 |
children | d4b701cdd763 |
line wrap: on
line diff
--- 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))