changeset 22489:7589c6f9880a

Add a new GPU-based scaling method to vo gl
author reimar
date Sun, 11 Mar 2007 14:59:08 +0000
parents b6aa3eedf49b
children 0d0fb73c9ea1
files libvo/gl_common.c libvo/vo_gl.c
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Sun Mar 11 06:16:14 2007 +0000
+++ b/libvo/gl_common.c	Sun Mar 11 14:59:08 2007 +0000
@@ -708,6 +708,26 @@
   "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 @@
     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 @@
                  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);
--- a/libvo/vo_gl.c	Sun Mar 11 06:16:14 2007 +0000
+++ b/libvo/vo_gl.c	Sun Mar 11 14:59:08 2007 +0000
@@ -894,6 +894,7 @@
               "  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"