diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-05-24 11:19:38 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-05-24 11:19:38 +0000 |
commit | 6689fe364e24bda5be2b8f45a4cf566347d300ef (patch) | |
tree | ed69d10dbc2ab880634e391f247e2155f821a85c | |
parent | dbe3c2994a3ae8c5feebf47318c7a4256fc0e998 (diff) | |
download | mpv-6689fe364e24bda5be2b8f45a4cf566347d300ef.tar.bz2 mpv-6689fe364e24bda5be2b8f45a4cf566347d300ef.tar.xz |
Add a filter strength parameter for blurring/sharpening scalers.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26868 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/gl_common.c | 17 | ||||
-rw-r--r-- | libvo/gl_common.h | 1 | ||||
-rw-r--r-- | libvo/vo_gl.c | 5 |
3 files changed, 14 insertions, 9 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 275b6af375..f9715b7b43 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -768,7 +768,7 @@ static const char *unsharp_filt_template = "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 @@ static const char *unsharp_filt_template2 = "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 @@ static void create_conv_textures(gl_conversion_params_t *params, int *texu, char * \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 @@ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs, 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 @@ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs, 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 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) { 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)) { diff --git a/libvo/gl_common.h b/libvo/gl_common.h index d9ce734bb0..1c106dd5b5 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -275,6 +275,7 @@ typedef struct { float bgamma; int texw; int texh; + float filter_strength; } gl_conversion_params_t; void glSetupYUVConversion(gl_conversion_params_t *params); diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index d938d8fd21..019e644277 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -74,6 +74,7 @@ static int use_aspect; 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 @@ static void update_yuvconv(void) { 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 @@ static opt_t subopts[] = { {"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 @@ static int preinit(const char *arg) use_yuv = 0; lscale = 0; cscale = 0; + filter_strength = 0.5; use_rectangle = 0; use_glFinish = 0; ati_hack = 0; |