# HG changeset patch # User reimar # Date 1326556194 0 # Node ID 8e09f1cb3ecde1fd1fd3fe0fdca9afca26a95582 # Parent 980e3cb2a5a8db9fad8fdd4c371ae60cf03dfb73 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. diff -r 980e3cb2a5a8 -r 8e09f1cb3ecd libvo/gl_common.c --- a/libvo/gl_common.c Sat Jan 14 15:46:58 2012 +0000 +++ b/libvo/gl_common.c Sat Jan 14 15:49:54 2012 +0000 @@ -1034,7 +1034,9 @@ "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 @@ "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 @@ 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 @@ 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);