[MPlayer-cvslog] r25757 - in trunk: DOCS/man/en/mplayer.1 libvo/gl_common.c libvo/gl_common.h libvo/vo_gl.c

reimar subversion at mplayerhq.hu
Tue Jan 15 18:59:20 CET 2008


Author: reimar
Date: Tue Jan 15 18:59:20 2008
New Revision: 25757

Log:
Add experimental unsharp-mask OpenGL scaler. Certainly not yet perfect.


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

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	(original)
+++ trunk/libvo/gl_common.c	Tue Jan 15 18:59:20 2008
@@ -756,6 +756,26 @@ static const char *bicub_x_filt_template
   "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};"
   BICUB_X_FILT_MAIN("RECT");
 
+#define UNSHARP_FILT_MAIN(textype) \
+  "TEX a.r, fragment.texcoord[%c], texture[%c], "textype";" \
+  "TEX b.r, coord.xyxy, texture[%c], "textype";" \
+  "TEX b.g, coord.zwzw, texture[%c], "textype";" \
+  "TEX b.b, coord2.xyxy, texture[%c], "textype";" \
+  "TEX b.a, coord2.zwzw, texture[%c], "textype";" \
+  "DP4 b, b, {0.25, 0.25, 0.25, 0.25};" \
+  "SUB b.r, a.r, b.r;" \
+  "MAD yuv.%c, b.r, %s, a.r;"
+
+static const char *unsharp_filt_template_2D =
+  "ADD coord, fragment.texcoord[%c].xyxy, {%f, %f, -%f, -%f};"
+  "ADD coord2, fragment.texcoord[%c].xyxy, {%f, -%f, -%f, %f};"
+  UNSHARP_FILT_MAIN("2D");
+
+static const char *unsharp_filt_template_RECT =
+  "ADD coord, fragment.texcoord[%c].xyxy, {0.5, 0.5, -0.5, -0.5};"
+  "ADD coord2, fragment.texcoord[%c].xyxy, {0.5, -0.5, -0.5, 0.5};" 
+  UNSHARP_FILT_MAIN("RECT");
+
 static const char *yuv_prog_template =
   "PARAM ycoef = {%.4f, %.4f, %.4f};"
   "PARAM ucoef = {%.4f, %.4f, %.4f};"
@@ -812,6 +832,7 @@ static void create_scaler_textures(int s
   switch (scaler) {
     case YUV_SCALER_BILIN:
     case YUV_SCALER_BICUB_NOTEX:
+    case YUV_SCALER_UNSHARP:
       break;
     case YUV_SCALER_BICUB:
     case YUV_SCALER_BICUB_X:
@@ -1033,6 +1054,20 @@ static void add_scaler(int scaler, char 
                  (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_UNSHARP:
+      if (rect)
+        snprintf(*prog_pos, *remain, unsharp_filt_template_RECT,
+                 in_tex,
+                 in_tex,
+                 in_tex, in_tex, in_tex, in_tex, in_tex, in_tex, out_comp,
+                 "{0.5}");
+      else
+        snprintf(*prog_pos, *remain, unsharp_filt_template_2D,
+                 in_tex, (float)0.5 / texw, (float)0.5 / texh, (float)0.5 / texw, (float)0.5 / texh,
+                 in_tex, (float)0.5 / texw, (float)0.5 / texh, (float)0.5 / texw, (float)0.5 / texh,
+                 in_tex, in_tex, in_tex, in_tex, in_tex, in_tex, out_comp,
+                 "{0.5}");
+      break;
   }
   *remain -= strlen(*prog_pos);
   *prog_pos += strlen(*prog_pos);

Modified: trunk/libvo/gl_common.h
==============================================================================
--- trunk/libvo/gl_common.h	(original)
+++ trunk/libvo/gl_common.h	Tue Jan 15 18:59:20 2008
@@ -243,6 +243,7 @@ int loadGPUProgram(GLenum target, char *
 #define YUV_SCALER_BICUB_X 2
 //! use cubic scaling without additional lookup texture
 #define YUV_SCALER_BICUB_NOTEX 3
+#define YUV_SCALER_UNSHARP 4
 //! mask for conversion type
 #define YUV_CONVERSION_MASK 0xF
 //! mask for scaler type

Modified: trunk/libvo/vo_gl.c
==============================================================================
--- trunk/libvo/vo_gl.c	(original)
+++ trunk/libvo/vo_gl.c	Tue Jan 15 18:59:20 2008
@@ -856,6 +856,7 @@ static int preinit(const char *arg)
               "    1: use improved bicubic scaling for luma.\n"
               "    2: use cubic in X, linear in Y direction scaling for luma.\n"
               "    3: as 1 but without using a lookup texture.\n"
+              "    4: experimental unsharp masking.\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