# HG changeset patch # User reimar # Date 1314386652 0 # Node ID 9bb97722d8c73d629ac5c32a828a28dfa49e0ff8 # Parent 6e3f257d7b05799116ef87f0275e1ab96d118ea2 Hook up -vo gl noise support. diff -r 6e3f257d7b05 -r 9bb97722d8c7 Changelog --- a/Changelog Fri Aug 26 18:51:51 2011 +0000 +++ b/Changelog Fri Aug 26 19:24:12 2011 +0000 @@ -13,6 +13,7 @@ * 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. diff -r 6e3f257d7b05 -r 9bb97722d8c7 DOCS/man/en/mplayer.1 --- a/DOCS/man/en/mplayer.1 Fri Aug 26 18:51:51 2011 +0000 +++ b/DOCS/man/en/mplayer.1 Fri Aug 26 19:24:12 2011 +0000 @@ -4256,6 +4256,9 @@ For details see lscale. .IPs filter-strength= Set the effect strength for the lscale/cscale filters that support it. +.IPs noise-strength= +Set how much noise to add. 0 to disable (default), 1.0 for level suitable +for dithering to 6 bit. .IPs stereo= Select a method for stereo display. You may have to use \-aspect to fix the aspect value. diff -r 6e3f257d7b05 -r 9bb97722d8c7 libvo/gl_common.c --- a/libvo/gl_common.c Fri Aug 26 18:51:51 2011 +0000 +++ b/libvo/gl_common.c Fri Aug 26 19:24:12 2011 +0000 @@ -1341,12 +1341,12 @@ 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 @@ 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) { diff -r 6e3f257d7b05 -r 9bb97722d8c7 libvo/gl_common.h --- a/libvo/gl_common.h Fri Aug 26 18:51:51 2011 +0000 +++ b/libvo/gl_common.h Fri Aug 26 19:24:12 2011 +0000 @@ -376,6 +376,7 @@ int chrom_texw; int chrom_texh; float filter_strength; + float noise_strength; } gl_conversion_params_t; int glAutodetectYUVConversion(void); diff -r 6e3f257d7b05 -r 9bb97722d8c7 libvo/vo_gl.c --- a/libvo/vo_gl.c Fri Aug 26 18:51:51 2011 +0000 +++ b/libvo/vo_gl.c Fri Aug 26 19:24:12 2011 +0000 @@ -118,6 +118,7 @@ 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 @@ 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 @@ {"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 @@ 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 @@ " as lscale but for chroma (2x slower with little visible effect).\n" " filter-strength=\n" " set the effect strength for some lscale/cscale filters\n" + " noise-strength=\n" + " set how much noise to add. 1.0 is suitable for dithering to 6 bit.\n" " customprog=\n" " use a custom YUV conversion program\n" " customtex=\n"