summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-11 14:59:08 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-11 14:59:08 +0000
commitc9c2f7332e2af9aaa2800d787ed8f6777da2541f (patch)
treee77c0c1be4bb70f915eddb2b977c3df628e858fc /libvo
parentc60af33716cee5c4f515b47308c5a43556624990 (diff)
downloadmpv-c9c2f7332e2af9aaa2800d787ed8f6777da2541f.tar.bz2
mpv-c9c2f7332e2af9aaa2800d787ed8f6777da2541f.tar.xz
Add a new GPU-based scaling method to vo gl
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22507 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c32
-rw-r--r--libvo/vo_gl.c1
2 files changed, 33 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index ef81d9d189..2804187e49 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -708,6 +708,26 @@ static const char *bicub_filt_template_RECT =
"MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};"
BICUB_FILT_MAIN("RECT");
+#define BICUB_X_FILT_MAIN(textype) \
+ "ADD coord, fragment.texcoord[%c].xyxy, cdelta.xyxw;" \
+ "ADD coord2, fragment.texcoord[%c].xyxy, cdelta.zyzw;" \
+ "TEX a.r, coord, texture[%c], "textype";" \
+ "TEX b.r, coord2, texture[%c], "textype";" \
+ /* x-interpolation */ \
+ "LRP yuv.%c, parmx.b, a.rrrr, b.rrrr;"
+
+static const char *bicub_x_filt_template_2D =
+ "MAD coord.x, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};"
+ "TEX parmx, coord, texture[%c], 1D;"
+ "MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};"
+ BICUB_X_FILT_MAIN("2D");
+
+static const char *bicub_x_filt_template_RECT =
+ "ADD coord.x, fragment.texcoord[%c], {0.5, 0.5};"
+ "TEX parmx, coord, texture[%c], 1D;"
+ "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};"
+ BICUB_X_FILT_MAIN("RECT");
+
static const char *yuv_prog_template =
"PARAM ycoef = {%.4f, %.4f, %.4f};"
"PARAM ucoef = {%.4f, %.4f, %.4f};"
@@ -765,6 +785,7 @@ static void create_scaler_textures(int scaler, int *texu, char *texs) {
case YUV_SCALER_BILIN:
break;
case YUV_SCALER_BICUB:
+ case YUV_SCALER_BICUB_X:
texs[0] = (*texu)++;
gen_spline_lookup_tex(GL_TEXTURE0 + texs[0]);
texs[0] += '0';
@@ -960,6 +981,17 @@ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs,
texs[0], (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_BICUB_X:
+ if (rect)
+ snprintf(*prog_pos, *remain, bicub_x_filt_template_RECT,
+ in_tex, texs[0],
+ in_tex, in_tex, in_tex, in_tex, out_comp);
+ else
+ snprintf(*prog_pos, *remain, bicub_x_filt_template_2D,
+ in_tex, (float)texw, (float)texh,
+ texs[0], (float)1.0 / texw, (float)1.0 / texw,
+ in_tex, in_tex, in_tex, in_tex, out_comp);
+ break;
}
*remain -= strlen(*prog_pos);
*prog_pos += strlen(*prog_pos);
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 6c33c19625..4daf5d219f 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -894,6 +894,7 @@ static int preinit(const char *arg)
" lscale=<n>\n"
" 0: use standard bilinear scaling for luma.\n"
" 1: use improved bicubic scaling for luma.\n"
+ " 2: use cubic in X, linear in Y direction scaling for luma.\n"
" cscale=<n>\n"
" as lscale but for chroma (2x slower with little visible effect).\n"
" customprog=<filename>\n"