[MPlayer-cvslog] r36199 - in trunk: DOCS/man/en/mplayer.1 libvo/gl_common.c libvo/vo_gl.c

reimar subversion at mplayerhq.hu
Wed May 1 20:27:38 CEST 2013


Author: reimar
Date: Wed May  1 20:27:38 2013
New Revision: 36199

Log:
Enable/disable extra instructions for gamma correction
at runtime, on-demand.

Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/vo_gl.c

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Wed May  1 13:18:58 2013	(r36198)
+++ trunk/libvo/gl_common.c	Wed May  1 20:27:38 2013	(r36199)
@@ -1405,6 +1405,8 @@ static void glSetupYUVFragprog(gl_conver
   int texw = params->texw;
   int texh = params->texh;
   int rect = params->target == GL_TEXTURE_RECTANGLE;
+  int convtype = YUV_CONVERSION(type);
+  int has_gamma = params->csp_params.rgamma != 1 || params->csp_params.bgamma != 1 || params->csp_params.bgamma != 1;
   static const char prog_hdr[] =
     "!!ARBfp1.0\n"
     "OPTION ARB_precision_hint_fastest;\n"
@@ -1455,7 +1457,13 @@ static void glSetupYUVFragprog(gl_conver
   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);
   mp_get_yuv2rgb_coeffs(&params->csp_params, yuv2rgb);
-  switch (YUV_CONVERSION(type)) {
+
+  // enable/disable gamma on demand
+  if (has_gamma && convtype == YUV_CONVERSION_FRAGMENT) convtype = YUV_CONVERSION_FRAGMENT_POW;
+  else if (!has_gamma && (convtype == YUV_CONVERSION_FRAGMENT_POW || convtype == YUV_CONVERSION_FRAGMENT_LOOKUP))
+    convtype = YUV_CONVERSION_FRAGMENT;
+
+  switch (convtype) {
     case YUV_CONVERSION_FRAGMENT:
       snprintf(prog_pos, prog_remain, yuv_prog_template,
                yuv2rgb[ROW_R][COL_Y], yuv2rgb[ROW_G][COL_Y], yuv2rgb[ROW_B][COL_Y],

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Wed May  1 13:18:58 2013	(r36198)
+++ trunk/libvo/vo_gl.c	Wed May  1 20:27:38 2013	(r36199)
@@ -106,7 +106,7 @@ static int use_aspect;
 static int use_ycbcr;
 #define MASK_ALL_YUV (~(1 << YUV_CONVERSION_NONE))
 #define MASK_NOT_COMBINERS (~((1 << YUV_CONVERSION_NONE) | (1 << YUV_CONVERSION_COMBINERS)))
-#define MASK_GAMMA_SUPPORT (MASK_NOT_COMBINERS & ~(1 << YUV_CONVERSION_FRAGMENT))
+#define MASK_GAMMA_SUPPORT MASK_NOT_COMBINERS
 static int use_yuv;
 static int colorspace;
 static int levelconv;
@@ -1327,8 +1327,8 @@ static int preinit_internal(const char *
               "  yuv=<n>\n"
               "    0: use software YUV to RGB conversion.\n"
               "    1: use register combiners (nVidia only, for older cards).\n"
-              "    2: use fragment program.\n"
-              "    3: use fragment program with gamma correction.\n"
+              "    2: use fragment program with gamma correction.\n"
+              "    3: same as 2.\n"
               "    4: use fragment program with gamma correction via lookup.\n"
               "    5: use ATI-specific method (for older cards).\n"
               "    6: use lookup via 3D texture.\n"


More information about the MPlayer-cvslog mailing list