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

reimar subversion at mplayerhq.hu
Fri Aug 26 21:24:12 CEST 2011


Author: reimar
Date: Fri Aug 26 21:24:12 2011
New Revision: 34015

Log:
Hook up -vo gl noise support.

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

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

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Fri Aug 26 20:51:51 2011	(r34014)
+++ trunk/Changelog	Fri Aug 26 21:24:12 2011	(r34015)
@@ -13,6 +13,7 @@ MPlayer (1.0)
     * delogo: allow to change the rectangle based on the time.
 
     Other:
+    * support adding noise at output resolution with -vo gl:noise-strength=8
     * experimental support for PGS (BluRay-compatible), DVB and XSUB subtitles.
     * experimental af_cmdline slave command to change e.g. audio equalizer options at runtime.
 

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Fri Aug 26 20:51:51 2011	(r34014)
+++ trunk/libvo/gl_common.c	Fri Aug 26 21:24:12 2011	(r34015)
@@ -1341,12 +1341,12 @@ static void glSetupYUVFragprog(gl_conver
   char lum_scale_texs[1];
   char chrom_scale_texs[1];
   char conv_texs[1];
-  char filt_texs[1];
+  char filt_texs[1] = {0};
   GLint i;
   // this is the conversion matrix, with y, u, v factors
   // for red, green, blue and the constant offsets
   float yuv2rgb[3][4];
-  int noise = 0;
+  int noise = params->noise_strength != 0;
   create_conv_textures(params, &cur_texu, conv_texs);
   create_scaler_textures(YUV_LUM_SCALER(type), &cur_texu, lum_scale_texs);
   if (YUV_CHROM_SCALER(type) == YUV_LUM_SCALER(type))
@@ -1414,7 +1414,8 @@ static void glSetupYUVFragprog(gl_conver
   prog_pos    += strlen(prog_pos);
 
   if (noise) {
-    double str = 1.0 / 8;
+    // 1.0 strength is suitable for dithering 8 to 6 bit
+    double str = params->noise_strength * (1.0 / 64);
     double scale_x = (double)NOISE_RES / texw;
     double scale_y = (double)NOISE_RES / texh;
     if (rect) {

Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h	Fri Aug 26 20:51:51 2011	(r34014)
+++ trunk/libvo/gl_common.h	Fri Aug 26 21:24:12 2011	(r34015)
@@ -376,6 +376,7 @@ typedef struct {
   int chrom_texw;
   int chrom_texh;
   float filter_strength;
+  float noise_strength;
 } gl_conversion_params_t;
 
 int glAutodetectYUVConversion(void);

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	Fri Aug 26 20:51:51 2011	(r34014)
+++ trunk/libvo/vo_gl.c	Fri Aug 26 21:24:12 2011	(r34015)
@@ -118,6 +118,7 @@ static int is_yuv;
 static int lscale;
 static int cscale;
 static float filter_strength;
+static float noise_strength;
 static int yuvconvtype;
 static int use_rectangle;
 static int err_shown;
@@ -240,7 +241,7 @@ static void update_yuvconv(void) {
   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, 0},
-      texture_width, texture_height, 0, 0, filter_strength};
+      texture_width, texture_height, 0, 0, filter_strength, noise_strength};
   mp_get_chroma_shift(image_format, &xs, &ys, &depth);
   params.chrom_texw = params.texw >> xs;
   params.chrom_texh = params.texh >> ys;
@@ -1139,6 +1140,7 @@ static const opt_t subopts[] = {
   {"lscale",       OPT_ARG_INT,  &lscale,       int_non_neg},
   {"cscale",       OPT_ARG_INT,  &cscale,       int_non_neg},
   {"filter-strength", OPT_ARG_FLOAT, &filter_strength, NULL},
+  {"noise-strength", OPT_ARG_FLOAT, &noise_strength, NULL},
   {"ati-hack",     OPT_ARG_BOOL, &ati_hack,     NULL},
   {"force-pbo",    OPT_ARG_BOOL, &force_pbo,    NULL},
   {"mesa-buffer",  OPT_ARG_BOOL, &mesa_buffer,  NULL},
@@ -1169,6 +1171,7 @@ static int preinit_internal(const char *
     lscale = 0;
     cscale = 0;
     filter_strength = 0.5;
+    noise_strength = 0.0;
     use_rectangle = -1;
     use_glFinish = 0;
     ati_hack = -1;
@@ -1244,6 +1247,8 @@ static int preinit_internal(const char *
               "    as lscale but for chroma (2x slower with little visible effect).\n"
               "  filter-strength=<value>\n"
               "    set the effect strength for some lscale/cscale filters\n"
+              "  noise-strength=<value>\n"
+              "    set how much noise to add. 1.0 is suitable for dithering to 6 bit.\n"
               "  customprog=<filename>\n"
               "    use a custom YUV conversion program\n"
               "  customtex=<filename>\n"


More information about the MPlayer-cvslog mailing list