diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-01-18 19:05:29 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-01-18 19:05:29 +0000 |
commit | 6a6c3d8cbc5138e6b86bf1b133105290275b5d4a (patch) | |
tree | a458ef59d91ffcfcd00fccc22c0e8f8ac66f4ae4 | |
parent | 932f9595bb919ef5e98330117aafb2e3c94a20d2 (diff) | |
download | mpv-6a6c3d8cbc5138e6b86bf1b133105290275b5d4a.tar.bz2 mpv-6a6c3d8cbc5138e6b86bf1b133105290275b5d4a.tar.xz |
Add a fragment program for 5x5 unsharp masking
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25786 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | DOCS/man/en/mplayer.1 | 2 | ||||
-rw-r--r-- | libvo/gl_common.c | 34 | ||||
-rw-r--r-- | libvo/gl_common.h | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index bd0f45c53b..d6d1201365 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3657,6 +3657,8 @@ Works on a few more cards than method 1. Might be faster on some cards. .br 4: Use experimental unsharp masking with 3x3 support and a strength of 0.5. +.br +5: Use experimental unsharp masking with 5x5 support and a strength of 0.5. .RE .IPs cscale=<n> Select the scaling function to use for chrominance scaling. diff --git a/libvo/gl_common.c b/libvo/gl_common.c index fd0dee118c..d9d4cf531f 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -770,6 +770,30 @@ static const char *unsharp_filt_template = "SUB b.r, a.r, b.r;" "MAD yuv.%c, b.r, %s, a.r;"; +static const char *unsharp_filt_template2 = + "PARAM dcoord = {%f, %f, %f, %f};" + "PARAM dcoord2 = {%f, 0, 0, %f};" + "ADD coord, fragment.texcoord[%c].xyxy, dcoord;" + "SUB coord2, fragment.texcoord[%c].xyxy, dcoord;" + "TEX a.r, fragment.texcoord[%c], texture[%c], %s;" + "TEX b.r, coord.xyxy, texture[%c], %s;" + "TEX b.g, coord.zwzw, texture[%c], %s;" + "ADD b.r, b.r, b.g;" + "TEX b.b, coord2.xyxy, texture[%c], %s;" + "TEX b.g, coord2.zwzw, texture[%c], %s;" + "ADD b.r, b.r, b.b;" + "ADD b.a, b.r, b.g;" + "ADD coord, fragment.texcoord[%c].xyxy, dcoord2;" + "SUB coord2, fragment.texcoord[%c].xyxy, dcoord2;" + "TEX b.r, coord.xyxy, texture[%c], %s;" + "TEX b.g, coord.zwzw, texture[%c], %s;" + "ADD b.r, b.r, b.g;" + "TEX b.b, coord2.xyxy, texture[%c], %s;" + "TEX b.g, coord2.zwzw, texture[%c], %s;" + "DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.01953125};" + "MAD b.r, a.r, {0.859375}, b.r;" + "MAD yuv.%c, b.r, %s, a.r;"; + static const char *yuv_prog_template = "PARAM ycoef = {%.4f, %.4f, %.4f};" "PARAM ucoef = {%.4f, %.4f, %.4f};" @@ -827,6 +851,7 @@ static void create_scaler_textures(int scaler, int *texu, char *texs) { case YUV_SCALER_BILIN: case YUV_SCALER_BICUB_NOTEX: case YUV_SCALER_UNSHARP: + case YUV_SCALER_UNSHARP2: break; case YUV_SCALER_BICUB: case YUV_SCALER_BICUB_X: @@ -1055,6 +1080,15 @@ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs, in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, out_comp, "{0.5}"); break; + case YUV_SCALER_UNSHARP2: + snprintf(*prog_pos, *remain, unsharp_filt_template2, + 1.2 * ptw, 1.2 * pth, 1.2 * ptw, -1.2 * pth, + 1.5 * ptw, 1.5 * pth, + in_tex, in_tex, in_tex, + in_tex, ttype, in_tex, ttype, in_tex, ttype, in_tex, ttype, + in_tex, ttype, in_tex, in_tex, in_tex, ttype, in_tex, ttype, in_tex, ttype, + in_tex, ttype, out_comp, "{0.5}"); + break; } *remain -= strlen(*prog_pos); *prog_pos += strlen(*prog_pos); diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 607cf8cf17..5025c0a4e0 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -244,6 +244,7 @@ int loadGPUProgram(GLenum target, char *prog); //! use cubic scaling without additional lookup texture #define YUV_SCALER_BICUB_NOTEX 3 #define YUV_SCALER_UNSHARP 4 +#define YUV_SCALER_UNSHARP2 5 //! mask for conversion type #define YUV_CONVERSION_MASK 0xF //! mask for scaler type |