summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/mplayer.12
-rw-r--r--libvo/gl_common.c35
-rw-r--r--libvo/gl_common.h1
-rw-r--r--libvo/vo_gl.c1
4 files changed, 39 insertions, 0 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index f8431cae0e..16bf53477f 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -3654,6 +3654,8 @@ Older cards will not be able to handle this for chroma at least in fullscreen mo
Works on a few more cards than method 1.
.br
3: Same as 1 but does not use a lookup texture. Might be faster on some cards.
+.br
+4: Use unsharp masking with 3x3 support and a strength of 0.5. Experimental.
.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 7afb1a9c34..4117d6de9f 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -756,6 +756,26 @@ static const char *bicub_x_filt_template_RECT =
"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 scaler, int *texu, char *texs) {
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 **prog_pos, int *remain, char *texs,
(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);
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index a2e7467193..607cf8cf17 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -243,6 +243,7 @@ int loadGPUProgram(GLenum target, char *prog);
#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
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 8dc7150168..4cd5c049f2 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -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"