diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2011-05-24 20:52:27 +0000 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-07-06 07:31:54 +0300 |
commit | 48fdd3d9268b55fe7e1743b43699b2650fb0db55 (patch) | |
tree | 4266f5dfd81cf366ec2ce4dac3968c1c57b9f6ad /libvo/vo_gl2.c | |
parent | 94d3e6a710c40806f44c1d39aaa0388c05487b8f (diff) | |
download | mpv-48fdd3d9268b55fe7e1743b43699b2650fb0db55.tar.bz2 mpv-48fdd3d9268b55fe7e1743b43699b2650fb0db55.tar.xz |
vo_gl: Support 9- and 10-bit YUV input for OpenGL VOs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33502 b3059339-0415-0410-9bf9-f77b7e298cf2
Fix clear/border color of chroma texture for 9- and 10-bit formats.
Avoids pink borders for those formats.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33504 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_gl2.c')
-rw-r--r-- | libvo/vo_gl2.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 21f779866c..ac1d957136 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -273,14 +273,18 @@ static int initTextures(void) glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); if (is_yuv) { - int xs, ys; - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + int xs, ys, depth; + int chroma_clear_val = 128; + mp_get_chroma_shift(image_format, &xs, &ys, &depth); + chroma_clear_val >>= -depth & 7; mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); mpglActiveTexture(GL_TEXTURE0); } @@ -559,7 +563,7 @@ static int initGl(uint32_t d_width, uint32_t d_height) glDisable(GL_CULL_FACE); glEnable (GL_TEXTURE_2D); if (is_yuv) { - int xs, ys; + int xs, ys, depth; gl_conversion_params_t params = {GL_TEXTURE_2D, use_yuv, {-1, -1, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0}, texture_width, texture_height, 0, 0, 0}; @@ -580,9 +584,10 @@ static int initGl(uint32_t d_width, uint32_t d_height) mpglBindProgram(GL_FRAGMENT_PROGRAM, fragprog); break; } - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + mp_get_chroma_shift(image_format, &xs, &ys, &depth); params.chrom_texw = params.texw >> xs; params.chrom_texh = params.texh >> ys; + params.csp_params.input_shift = -depth & 7; glSetupYUVConversion(¶ms); } @@ -804,7 +809,7 @@ query_format(uint32_t format) { int depth; if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) && - (depth == 8 || depth == 16) && + (depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) && (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format))) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; |