[MPlayer-cvslog] r34566 - trunk/libvo/gl_common.c

reimar subversion at mplayerhq.hu
Sat Jan 14 16:49:54 CET 2012


Author: reimar
Date: Sat Jan 14 16:49:54 2012
New Revision: 34566

Log:
Fix vo_gl unsharp filter for chroma.

The syntax is a bit strange, since for inputs the components
indicate swizzles, while for outputs it is only a write mask,
thus the result must be at the correct position regardless
of the component specified for the output.
So use a 3-component vector for the constant factor.
Also make the input swizzles explicit in an attempt to make
the code less confusing (that part does change what the code
actually does).
Previous code would result in a filter strength of 0 always
being used for chroma.

Modified:
   trunk/libvo/gl_common.c

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Sat Jan 14 16:46:58 2012	(r34565)
+++ trunk/libvo/gl_common.c	Sat Jan 14 16:49:54 2012	(r34566)
@@ -1034,7 +1034,9 @@ static const char unsharp_filt_template[
   "TEX b.g, coord2.zwzw, texture[%c], %s;\n"
   "DP3 b, b, {0.25, 0.25, 0.25};\n"
   "SUB b.r, a.r, b.r;\n"
-  "MAD yuv.%c, b.r, {%e}, a.r;\n";
+  // NOTE: destination component is only write mask, not swizzle
+  // so calculate result in all three components
+  "MAD yuv.%c, b.rrrr, {%e, %e, %e}, a.rrrr;\n";
 
 static const char unsharp_filt_template2[] =
   "PARAM dcoord%c = {%e, %e, %e, %e};\n"
@@ -1058,7 +1060,9 @@ static const char unsharp_filt_template2
   "TEX b.g, coord2.zwzw, texture[%c], %s;\n"
   "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};\n"
   "MAD b.r, a.r, {0.859375}, b.r;\n"
-  "MAD yuv.%c, b.r, {%e}, a.r;\n";
+  // NOTE: destination component is only write mask, not swizzle
+  // so calculate result in all three components
+  "MAD yuv.%c, b.rrrr, {%e, %e, %e}, a.rrrr;\n";
 
 static const char yuv_prog_template[] =
   "PARAM ycoef = {%e, %e, %e};\n"
@@ -1258,7 +1262,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, strength);
+               in_tex, ttype, out_comp, strength, strength, strength);
       break;
     case YUV_SCALER_UNSHARP2:
       snprintf(*prog_pos, *remain, unsharp_filt_template2,
@@ -1268,7 +1272,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, strength);
+               in_tex, ttype, out_comp, strength, strength, strength);
       break;
   }
   *remain -= strlen(*prog_pos);


More information about the MPlayer-cvslog mailing list