[MPlayer-cvslog] r36205 - in trunk/libvo: gl_common.c gl_common.h vo_gl.c
reimar
subversion at mplayerhq.hu
Wed May 1 20:52:43 CEST 2013
Author: reimar
Date: Wed May 1 20:52:42 2013
New Revision: 36205
Log:
Add xyz support for -vo gl.
Modified:
trunk/libvo/gl_common.c
trunk/libvo/gl_common.h
trunk/libvo/vo_gl.c
Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c Wed May 1 20:52:41 2013 (r36204)
+++ trunk/libvo/gl_common.c Wed May 1 20:52:42 2013 (r36205)
@@ -1459,12 +1459,24 @@ static void glSetupYUVFragprog(gl_conver
strcpy(yuv_prog, prog_hdr);
prog_pos = yuv_prog + sizeof(prog_hdr) - 1;
prog_remain = MAX_PROGSZ - sizeof(prog_hdr);
+ if (!params->is_planar) {
+ // interleaved
+ snprintf(prog_pos, prog_remain, "TEX yuv.rgb, fragment.texcoord[0], texture[0], %s;\n", rect ? "RECT" : "2D");
+ prog_remain -= strlen(prog_pos);
+ prog_pos += strlen(prog_pos);
+ } else {
add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs,
'0', 'r', rect, texw, texh, params->filter_strength);
add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs,
'1', 'g', rect, params->chrom_texw, params->chrom_texh, params->filter_strength);
add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs,
'2', 'b', rect, params->chrom_texw, params->chrom_texh, params->filter_strength);
+ }
+ if (params->csp_params.format == MP_CSP_XYZ) {
+ snprintf(prog_pos, prog_remain, "PARAM xyzgamma = {2.6};\nPOW yuv.r, yuv.r, xyzgamma.r;\nPOW yuv.g, yuv.g, xyzgamma.r;\nPOW yuv.b, yuv.b, xyzgamma.r;\n");
+ prog_remain -= strlen(prog_pos);
+ prog_pos += strlen(prog_pos);
+ }
mp_get_yuv2rgb_coeffs(¶ms->csp_params, yuv2rgb);
// enable/disable gamma on demand
Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h Wed May 1 20:52:41 2013 (r36204)
+++ trunk/libvo/gl_common.h Wed May 1 20:52:42 2013 (r36205)
@@ -157,6 +157,7 @@ typedef struct {
int texh;
int chrom_texw;
int chrom_texh;
+ int is_planar;
float filter_strength;
float noise_strength;
int has_alpha_tex;
Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c Wed May 1 20:52:41 2013 (r36204)
+++ trunk/libvo/vo_gl.c Wed May 1 20:52:42 2013 (r36205)
@@ -111,6 +111,7 @@ static int use_yuv;
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 @@ static void update_yuvconv(void) {
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 @@ static int initGl(uint32_t d_width, uint
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 @@ static int initGl(uint32_t d_width, uint
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 @@ config(uint32_t width, uint32_t height,
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 draw_osd(void)
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 @@ static void do_render(void) {
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 @@ query_format(uint32_t format)
(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))
More information about the MPlayer-cvslog
mailing list