summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-04 10:46:31 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-04 10:46:31 +0000
commitdc804a95364685091889fb97ac45abec3bfd9ad8 (patch)
tree7585dc423cb56eb860fff828a2973bd2251637d0 /libvo
parent527d29313917647e2bcf07bf85d77451dc89e6b7 (diff)
downloadmpv-dc804a95364685091889fb97ac45abec3bfd9ad8.tar.bz2
mpv-dc804a95364685091889fb97ac45abec3bfd9ad8.tar.xz
Add a bicubic scaler that needs a lot more instruction but no
extra texture lookup git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24338 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/gl_common.c40
-rw-r--r--libvo/gl_common.h2
2 files changed, 42 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index a123f582b9..247f7269c6 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -708,6 +708,34 @@ static const char *bicub_filt_template_RECT =
"MUL cdelta.yw, parmy.rrgg, {0, -1, 0, 1};"
BICUB_FILT_MAIN("RECT");
+#define CALCWEIGHTS(t, s) \
+ "MAD "t", {-0.5, 0.1666, 0.3333, -0.3333}, "s", {1, 0, -0.5, 0.5};" \
+ "MAD "t", "t", "s", {0, 0, -0.5, 0.5};" \
+ "MAD "t", "t", "s", {-0.6666, 0, 0.8333, 0.1666};" \
+ "RCP a.x, "t".z;" \
+ "RCP a.y, "t".w;" \
+ "MAD "t".xy, "t".xyxy, a.xyxy, {1, 1, 0, 0};" \
+ "ADD "t".x, "t".xxxx, "s";" \
+ "SUB "t".y, "t".yyyy, "s";"
+
+static const char *bicub_notex_filt_template_2D =
+ "MAD coord.xy, fragment.texcoord[%c], {%f, %f}, {0.5, 0.5};"
+ "FRC coord.xy, coord.xyxy;"
+ CALCWEIGHTS("parmx", "coord.xxxx")
+ "MUL cdelta.xz, parmx.rrgg, {-%f, 0, %f, 0};"
+ CALCWEIGHTS("parmy", "coord.yyyy")
+ "MUL cdelta.yw, parmy.rrgg, {0, -%f, 0, %f};"
+ BICUB_FILT_MAIN("2D");
+
+static const char *bicub_notex_filt_template_RECT =
+ "ADD coord, fragment.texcoord[%c], {0.5, 0.5};"
+ "FRC coord.xy, coord.xyxy;"
+ CALCWEIGHTS("parmx", "coord.xxxx")
+ "MUL cdelta.xz, parmx.rrgg, {-1, 0, 1, 0};"
+ CALCWEIGHTS("parmy", "coord.yyyy")
+ "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;" \
@@ -992,6 +1020,18 @@ static void add_scaler(int scaler, char **prog_pos, int *remain, char *texs,
texs[0], (float)1.0 / texw, (float)1.0 / texw,
in_tex, in_tex, in_tex, in_tex, out_comp);
break;
+ case YUV_SCALER_BICUB_NOTEX:
+ if (rect)
+ snprintf(*prog_pos, *remain, bicub_notex_filt_template_RECT,
+ in_tex,
+ in_tex, in_tex, in_tex, in_tex, in_tex, in_tex, out_comp);
+ else
+ snprintf(*prog_pos, *remain, bicub_notex_filt_template_2D,
+ in_tex, (float)texw, (float)texh,
+ (float)1.0 / texw, (float)1.0 / texw,
+ (float)1.0 / texh, (float)1.0 / texh,
+ in_tex, in_tex, in_tex, in_tex, in_tex, in_tex, out_comp);
+ break;
}
*remain -= strlen(*prog_pos);
*prog_pos += strlen(*prog_pos);
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index 53ee8ef08d..1d5ab8dede 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -241,6 +241,8 @@ int loadGPUProgram(GLenum target, char *prog);
#define YUV_SCALER_BICUB 1
//! use cubic scaling in X and normal linear scaling in Y direction
#define YUV_SCALER_BICUB_X 2
+//! use cubic scaling without additional lookup texture
+#define YUV_SCALER_BICUB_NOTEX 3
//! mask for conversion type
#define YUV_CONVERSION_MASK 0xF
//! mask for scaler type