Mercurial > mplayer.hg
changeset 26836:ba086caf1230
Add a filter strength parameter for blurring/sharpening scalers.
author | reimar |
---|---|
date | Sat, 24 May 2008 11:19:38 +0000 |
parents | 315e911d5762 |
children | e564a1f2f762 |
files | libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c |
diffstat | 3 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/gl_common.c Sat May 24 11:04:18 2008 +0000 +++ b/libvo/gl_common.c Sat May 24 11:19:38 2008 +0000 @@ -768,7 +768,7 @@ "TEX b.g, coord2.zwzw, texture[%c], %s;" "DP3 b, b, {0.25, 0.25, 0.25};" "SUB b.r, a.r, b.r;" - "MAD yuv.%c, b.r, %s, a.r;"; + "MAD yuv.%c, b.r, {%f}, a.r;"; static const char *unsharp_filt_template2 = "PARAM dcoord%c = {%f, %f, %f, %f};" @@ -792,7 +792,7 @@ "TEX b.g, coord2.zwzw, texture[%c], %s;" "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};" "MAD b.r, a.r, {0.859375}, b.r;" - "MAD yuv.%c, b.r, %s, a.r;"; + "MAD yuv.%c, b.r, {%f}, a.r;"; static const char *yuv_prog_template = "PARAM ycoef = {%.4f, %.4f, %.4f};" @@ -1030,7 +1030,8 @@ * \param texh height of the in_tex texture */ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs, - char in_tex, char out_comp, int rect, int texw, int texh) { + char in_tex, char out_comp, int rect, int texw, int texh, + double strength) { const char *ttype = rect ? "RECT" : "2D"; const float ptw = rect ? 1.0 : 1.0 / texw; const float pth = rect ? 1.0 : 1.0 / texh; @@ -1076,7 +1077,7 @@ out_comp, 0.5 * ptw, 0.5 * pth, 0.5 * ptw, -0.5 * pth, in_tex, out_comp, in_tex, out_comp, in_tex, in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, - in_tex, ttype, out_comp, "{0.5}"); + in_tex, ttype, out_comp, strength); break; case YUV_SCALER_UNSHARP2: snprintf(*prog_pos, *remain, unsharp_filt_template2, @@ -1086,7 +1087,7 @@ in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, out_comp, in_tex, out_comp, in_tex, ttype, in_tex, ttype, in_tex, ttype, - in_tex, ttype, out_comp, "{0.5}"); + in_tex, ttype, out_comp, strength); break; } *remain -= strlen(*prog_pos); @@ -1203,11 +1204,11 @@ prog_pos = yuv_prog + sizeof(prog_hdr) - 1; prog_remain = MAX_PROGSZ - sizeof(prog_hdr); add_scaler(YUV_LUM_SCALER(type), &prog_pos, &prog_remain, lum_scale_texs, - '0', 'r', rect, texw, texh); + '0', 'r', rect, texw, texh, params->filter_strength); add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, - '1', 'g', rect, texw / 2, texh / 2); + '1', 'g', rect, texw / 2, texh / 2, params->filter_strength); add_scaler(YUV_CHROM_SCALER(type), &prog_pos, &prog_remain, chrom_scale_texs, - '2', 'b', rect, texw / 2, texh / 2); + '2', 'b', rect, texw / 2, texh / 2, params->filter_strength); get_yuv2rgb_coeffs(params, &ry, &ru, &rv, &rc, &gy, &gu, &gv, &gc, &by, &bu, &bv, &bc); switch (YUV_CONVERSION(type)) {
--- a/libvo/gl_common.h Sat May 24 11:04:18 2008 +0000 +++ b/libvo/gl_common.h Sat May 24 11:19:38 2008 +0000 @@ -275,6 +275,7 @@ float bgamma; int texw; int texh; + float filter_strength; } gl_conversion_params_t; void glSetupYUVConversion(gl_conversion_params_t *params);
--- a/libvo/vo_gl.c Sat May 24 11:04:18 2008 +0000 +++ b/libvo/vo_gl.c Sat May 24 11:19:38 2008 +0000 @@ -74,6 +74,7 @@ static int use_yuv; static int lscale; static int cscale; +static float filter_strength; static int yuvconvtype; static int use_rectangle; static int err_shown; @@ -181,7 +182,7 @@ float bgamma = exp(log(8.0) * eq_bgamma / 100.0); gl_conversion_params_t params = {gl_target, yuvconvtype, bri, cont, hue, sat, rgamma, ggamma, bgamma, - texture_width, texture_height}; + texture_width, texture_height, filter_strength}; glSetupYUVConversion(¶ms); if (custom_prog) { FILE *f = fopen(custom_prog, "r"); @@ -809,6 +810,7 @@ {"yuv", OPT_ARG_INT, &use_yuv, (opt_test_f)int_non_neg}, {"lscale", OPT_ARG_INT, &lscale, (opt_test_f)int_non_neg}, {"cscale", OPT_ARG_INT, &cscale, (opt_test_f)int_non_neg}, + {"filter-strength", OPT_ARG_FLOAT, &filter_strength, NULL}, {"ati-hack", OPT_ARG_BOOL, &ati_hack, NULL}, {"force-pbo", OPT_ARG_BOOL, &force_pbo, NULL}, {"glfinish", OPT_ARG_BOOL, &use_glFinish, NULL}, @@ -831,6 +833,7 @@ use_yuv = 0; lscale = 0; cscale = 0; + filter_strength = 0.5; use_rectangle = 0; use_glFinish = 0; ati_hack = 0;