summaryrefslogtreecommitdiffstats
path: root/libvo/vo_gl.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2011-05-24 20:52:27 +0000
committerUoti Urpala <uau@mplayer2.org>2011-07-06 07:31:54 +0300
commit48fdd3d9268b55fe7e1743b43699b2650fb0db55 (patch)
tree4266f5dfd81cf366ec2ce4dac3968c1c57b9f6ad /libvo/vo_gl.c
parent94d3e6a710c40806f44c1d39aaa0388c05487b8f (diff)
downloadmpv-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_gl.c')
-rw-r--r--libvo/vo_gl.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index bc50e245b3..f23d44ba64 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -247,7 +247,7 @@ static void texSize(int w, int h, int *texw, int *texh) {
//! maximum size of custom fragment program
#define MAX_CUSTOM_PROG_SIZE (1024 * 1024)
static void update_yuvconv(void) {
- int xs, ys;
+ int xs, ys, depth;
float bri = eq_bri / 100.0;
float cont = (eq_cont + 100) / 100.0;
float hue = eq_hue / 100.0 * 3.1415927;
@@ -256,11 +256,12 @@ static void update_yuvconv(void) {
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,
- {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma},
+ {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma, 0},
texture_width, texture_height, 0, 0, filter_strength};
- 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(&params);
if (custom_prog) {
FILE *f = fopen(custom_prog, "rb");
@@ -566,9 +567,11 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
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++) {
@@ -579,12 +582,14 @@ static int initGl(uint32_t d_width, uint32_t d_height) {
}
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);
@@ -1097,7 +1102,7 @@ query_format(uint32_t format)
if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)
return caps;
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 caps;
// HACK, otherwise we get only b&w with some filters (e.g. -vf eq)