summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-01 19:14:01 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-02-01 19:14:01 +0000
commit3540bd7af543587be1bf3f58b21f25697c4a76d6 (patch)
tree6b15f98a374fc63057a8bb2cc7ba490d506b895d
parent92f21ea5ccfc33ed6dd37d5b67800a9c5a9c4cc6 (diff)
downloadmpv-3540bd7af543587be1bf3f58b21f25697c4a76d6.tar.bz2
mpv-3540bd7af543587be1bf3f58b21f25697c4a76d6.tar.xz
Fix -vf tfields=1 so it does not read out of bounds or leave parts of the
output frame uninitialized. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30483 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpcodecs/vf_tfields.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c
index 851d3f24da..b4768e2060 100644
--- a/libmpcodecs/vf_tfields.c
+++ b/libmpcodecs/vf_tfields.c
@@ -43,13 +43,16 @@ static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w
int x, y;
src += ss;
dest += ds;
+ h--;
if (field) {
+ fast_memcpy(dest - ds, src - ss, w);
src += ss;
dest += ds;
- h -= 2;
+ h--;
}
- for (y=h/2; y; y--) {
- for (x=0; x<w; x++) {
+ for (y=h/2; y > 0; y--) {
+ dest[0] = src[0];
+ for (x=1; x<w-1; x++) {
if (((src[x-ss] < src[x]) && (src[x+ss] < src[x])) ||
((src[x-ss] > src[x]) && (src[x+ss] > src[x]))) {
//dest[x] = (src[x+ss] + src[x-ss])>>1;
@@ -59,9 +62,12 @@ static void deint(unsigned char *dest, int ds, unsigned char *src, int ss, int w
}
else dest[x] = src[x];
}
+ dest[w-1] = src[w-1];
dest += ds<<1;
src += ss<<1;
}
+ if (h & 1)
+ fast_memcpy(dest, src, w);
}
#if HAVE_AMD3DNOW