From 3540bd7af543587be1bf3f58b21f25697c4a76d6 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Feb 2010 19:14:01 +0000 Subject: 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 --- libmpcodecs/vf_tfields.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libmpcodecs') 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 0; y--) { + dest[0] = src[0]; + for (x=1; x 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 -- cgit v1.2.3 From 2aa41effad0c9eb8efe5e2b471d4b83314f5e10a Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 1 Feb 2010 22:14:17 +0000 Subject: Enable query_format for vf_tfields to make sure it isn't used for formats that definitely do not work, e.g. RBG with tfields=1 mode. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30484 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_tfields.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c index b4768e2060..8147661244 100644 --- a/libmpcodecs/vf_tfields.c +++ b/libmpcodecs/vf_tfields.c @@ -455,11 +455,13 @@ static int continue_buffered_image(struct vf_instance_s *vf) return ret; } -#if 0 static int query_format(struct vf_instance_s* vf, unsigned int fmt) { - /* FIXME - figure out which other formats work */ + /* FIXME - figure out which formats exactly work */ switch (fmt) { + default: + if (vf->priv->mode == 1) + return 0; case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: @@ -467,7 +469,6 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt) } return 0; } -#endif static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, @@ -495,7 +496,7 @@ static int open(vf_instance_t *vf, char* args) struct vf_priv_s *p; vf->config = config; vf->put_image = put_image; - //vf->query_format = query_format; + vf->query_format = query_format; vf->uninit = uninit; vf->default_reqs = VFCAP_ACCEPT_STRIDE; vf->priv = p = calloc(1, sizeof(struct vf_priv_s)); -- cgit v1.2.3