[MPlayer-cvslog] r26868 - in trunk/libvo: gl_common.c gl_common.h vo_gl.c

reimar subversion at mplayerhq.hu
Sat May 24 13:19:39 CEST 2008


Author: reimar
Date: Sat May 24 13:19:38 2008
New Revision: 26868

Log:
Add a filter strength parameter for blurring/sharpening scalers.


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

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	(original)
+++ trunk/libvo/gl_common.c	Sat May 24 13:19:38 2008
@@ -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_template
   "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_conv
  * \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 
                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 
                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_conver
   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)) {

Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h	(original)
+++ trunk/libvo/gl_common.h	Sat May 24 13:19:38 2008
@@ -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);

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	(original)
+++ trunk/libvo/vo_gl.c	Sat May 24 13:19:38 2008
@@ -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(&params);
   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;



More information about the MPlayer-cvslog mailing list