comparison libvo/vo_gl.c @ 33414:9bc9e1851a13

Support 9- and 10-bit YUV input for OpenGL vos.
author reimar
date Tue, 24 May 2011 20:52:27 +0000
parents 706871635af7
children b7b169f5abda
comparison
equal deleted inserted replaced
33413:08da81bcc970 33414:9bc9e1851a13
228 } 228 }
229 229
230 //! maximum size of custom fragment program 230 //! maximum size of custom fragment program
231 #define MAX_CUSTOM_PROG_SIZE (1024 * 1024) 231 #define MAX_CUSTOM_PROG_SIZE (1024 * 1024)
232 static void update_yuvconv(void) { 232 static void update_yuvconv(void) {
233 int xs, ys; 233 int xs, ys, depth;
234 float bri = eq_bri / 100.0; 234 float bri = eq_bri / 100.0;
235 float cont = (eq_cont + 100) / 100.0; 235 float cont = (eq_cont + 100) / 100.0;
236 float hue = eq_hue / 100.0 * 3.1415927; 236 float hue = eq_hue / 100.0 * 3.1415927;
237 float sat = (eq_sat + 100) / 100.0; 237 float sat = (eq_sat + 100) / 100.0;
238 float rgamma = exp(log(8.0) * eq_rgamma / 100.0); 238 float rgamma = exp(log(8.0) * eq_rgamma / 100.0);
239 float ggamma = exp(log(8.0) * eq_ggamma / 100.0); 239 float ggamma = exp(log(8.0) * eq_ggamma / 100.0);
240 float bgamma = exp(log(8.0) * eq_bgamma / 100.0); 240 float bgamma = exp(log(8.0) * eq_bgamma / 100.0);
241 gl_conversion_params_t params = {gl_target, yuvconvtype, 241 gl_conversion_params_t params = {gl_target, yuvconvtype,
242 {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma}, 242 {colorspace, levelconv, bri, cont, hue, sat, rgamma, ggamma, bgamma, 0},
243 texture_width, texture_height, 0, 0, filter_strength}; 243 texture_width, texture_height, 0, 0, filter_strength};
244 mp_get_chroma_shift(image_format, &xs, &ys, NULL); 244 mp_get_chroma_shift(image_format, &xs, &ys, &depth);
245 params.chrom_texw = params.texw >> xs; 245 params.chrom_texw = params.texw >> xs;
246 params.chrom_texh = params.texh >> ys; 246 params.chrom_texh = params.texh >> ys;
247 params.csp_params.input_shift = -depth & 7;
247 glSetupYUVConversion(&params); 248 glSetupYUVConversion(&params);
248 if (custom_prog) { 249 if (custom_prog) {
249 FILE *f = fopen(custom_prog, "rb"); 250 FILE *f = fopen(custom_prog, "rb");
250 if (!f) { 251 if (!f) {
251 mp_msg(MSGT_VO, MSGL_WARN, 252 mp_msg(MSGT_VO, MSGL_WARN,
1079 if (use_osd) 1080 if (use_osd)
1080 caps |= VFCAP_OSD | VFCAP_EOSD | (scaled_osd ? 0 : VFCAP_EOSD_UNSCALED); 1081 caps |= VFCAP_OSD | VFCAP_EOSD | (scaled_osd ? 0 : VFCAP_EOSD_UNSCALED);
1081 if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA) 1082 if (format == IMGFMT_RGB24 || format == IMGFMT_RGBA)
1082 return caps; 1083 return caps;
1083 if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) && 1084 if (use_yuv && mp_get_chroma_shift(format, NULL, NULL, &depth) &&
1084 (depth == 8 || depth == 16) && 1085 (depth == 8 || depth == 16 || glYUVLargeRange(use_yuv)) &&
1085 (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format))) 1086 (IMGFMT_IS_YUVP16_NE(format) || !IMGFMT_IS_YUVP16(format)))
1086 return caps; 1087 return caps;
1087 // HACK, otherwise we get only b&w with some filters (e.g. -vf eq) 1088 // HACK, otherwise we get only b&w with some filters (e.g. -vf eq)
1088 // ideally MPlayer should be fixed instead not to use Y800 when it has the choice 1089 // ideally MPlayer should be fixed instead not to use Y800 when it has the choice
1089 if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800)) 1090 if (!use_yuv && (format == IMGFMT_Y8 || format == IMGFMT_Y800))