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

reimar subversion at mplayerhq.hu
Sun Mar 11 15:59:08 CET 2007


Author: reimar
Date: Sun Mar 11 15:59:08 2007
New Revision: 22507

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

Log:
Add a new GPU-based scaling method to vo gl


Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	(original)
+++ trunk/libvo/gl_common.c	Sun Mar 11 15:59:08 2007
@@ -708,6 +708,26 @@ static const char *bicub_filt_template_R
   "MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};"
   BICUB_FILT_MAIN("RECT");
 
+#define BICUB_X_FILT_MAIN(textype) \
+  "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;" \
+  "ADD coord2, fragment.texcoord[%c].xyxy, cdelta.zyzw;" \
+  "TEX a.r, coord, texture[%c], "textype";" \
+  "TEX b.r, coord2, texture[%c], "textype";" \
+  /* x-interpolation */ \
+  "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;"
+
+static const char *bicub_x_filt_template_2D =
+  "MAD coord.x, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};"
+  "TEX parmx, coord, texture[%c], 1D;"
+  "MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};"
+  BICUB_X_FILT_MAIN("2D");
+
+static const char *bicub_x_filt_template_RECT =
+  "ADD coord.x, fragment.texcoord[%c], {0.5, 0.5};"
+  "TEX parmx, coord, texture[%c], 1D;"
+  "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};"
+  BICUB_X_FILT_MAIN("RECT");
+
 static const char *yuv_prog_template =
   "PARAM ycoef = {%.4f, %.4f, %.4f};"
   "PARAM ucoef = {%.4f, %.4f, %.4f};"
@@ -765,6 +785,7 @@ static void create_scaler_textures(int s
     case YUV_SCALER_BILIN:
       break;
     case YUV_SCALER_BICUB:
+    case YUV_SCALER_BICUB_X:
       texs[0] = (*texu)++;
       gen_spline_lookup_tex(GL_TEXTURE0 + texs[0]);
       texs[0] += '0';
@@ -960,6 +981,17 @@ static void add_scaler(int scaler, char 
                  texs[0], (float)1.0 / texh, (float)1.0 / texh,
                  in_tex, in_tex, in_tex, in_tex, in_tex, in_tex, out_comp);
       break;
+    case YUV_SCALER_BICUB_X:
+      if (rect)
+        snprintf(*prog_pos, *remain, bicub_x_filt_template_RECT,
+                 in_tex, texs[0],
+                 in_tex, in_tex, in_tex, in_tex, out_comp);
+      else
+        snprintf(*prog_pos, *remain, bicub_x_filt_template_2D,
+                 in_tex, (float)texw, (float)texh,
+                 texs[0], (float)1.0 / texw, (float)1.0 / texw,
+                 in_tex, in_tex, in_tex, in_tex, out_comp);
+      break;
   }
   *remain -= strlen(*prog_pos);
   *prog_pos += strlen(*prog_pos);

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	(original)
+++ trunk/libvo/vo_gl.c	Sun Mar 11 15:59:08 2007
@@ -894,6 +894,7 @@ static int preinit(const char *arg)
               "  lscale=<n>\n"
               "    0: use standard bilinear scaling for luma.\n"
               "    1: use improved bicubic scaling for luma.\n"
+              "    2: use cubic in X, linear in Y direction scaling for luma.\n"
               "  cscale=<n>\n"
               "    as lscale but for chroma (2x slower with little visible effect).\n"
               "  customprog=<filename>\n"



More information about the MPlayer-cvslog mailing list