Mercurial > mplayer.hg
changeset 33416:b7b169f5abda
Fix clear/border color of chroma texture for 9- and 10-bit formats.
Avoids pink borders for those formats.
author | reimar |
---|---|
date | Wed, 25 May 2011 18:23:11 +0000 |
parents | 53073a44a899 |
children | 4855450375d1 |
files | libvo/vo_gl.c libvo/vo_gl2.c |
diffstat | 2 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_gl.c Wed May 25 13:46:32 2011 +0000 +++ b/libvo/vo_gl.c Wed May 25 18:23:11 2011 +0000 @@ -550,9 +550,11 @@ if (is_yuv) { int i; - int xs, ys; + int xs, ys, depth; + int chroma_clear_val = 128; scale_type = get_scale_type(1); - mp_get_chroma_shift(image_format, &xs, &ys, NULL); + mp_get_chroma_shift(image_format, &xs, &ys, &depth); + chroma_clear_val >>= -depth & 7; mpglGenTextures(21, default_texs); default_texs[21] = 0; for (i = 0; i < 7; i++) { @@ -563,12 +565,14 @@ } mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); if (mipmap_gen) mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, - texture_width >> xs, texture_height >> ys, 128); + texture_width >> xs, texture_height >> ys, + chroma_clear_val); if (mipmap_gen) mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); mpglActiveTexture(GL_TEXTURE0);
--- a/libvo/vo_gl2.c Wed May 25 13:46:32 2011 +0000 +++ b/libvo/vo_gl2.c Wed May 25 18:23:11 2011 +0000 @@ -274,14 +274,18 @@ 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); }