From 790e5ae5b4c349511c6bf7b503d4c6dd50e8e8d9 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 9 Jun 2006 10:29:35 +0000 Subject: better spatial interpolation git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18658 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_yadif.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'libmpcodecs/vf_yadif.c') diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c index 1e20a8fcc2..01060f2892 100644 --- a/libmpcodecs/vf_yadif.c +++ b/libmpcodecs/vf_yadif.c @@ -65,7 +65,7 @@ static void store_ref(struct vf_priv_s *p, uint8_t *src[3], int src_stride[3], i } static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int width, int height, int parity, int tff){ - int x, y, i, j; + int x, y, i; for(i=0; i<3; i++){ int is_chroma= !!i; @@ -91,18 +91,19 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int int diff= MAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); int spatial_pred= (c+e)>>1; int spatial_score= ABS(cur[-refs-1] - cur[+refs-1]) + ABS(c-e) - + ABS(cur[-refs+1] - cur[+refs+1]); + + ABS(cur[-refs+1] - cur[+refs+1]) - 1; - for(j=-1; j<=1; j+=2){ - int score= ABS(cur[-refs-1+j] - cur[+refs-1-j]) - + ABS(cur[-refs +j] - cur[+refs -j]) - + ABS(cur[-refs+1+j] - cur[+refs+1-j]) + 1; +#define CHECK(j)\ + { int score= ABS(cur[-refs-1+j] - cur[+refs-1-j])\ + + ABS(cur[-refs +j] - cur[+refs -j])\ + + ABS(cur[-refs+1+j] - cur[+refs+1-j]);\ + if(score < spatial_score){\ + spatial_score= score;\ + spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1;\ + + CHECK(-1) CHECK(-2) }} }} + CHECK( 1) CHECK( 2) }} }} - if(score < spatial_score){ - spatial_score= score; - spatial_pred= (cur[-refs +j] + cur[+refs -j])>>1; - } - } if(p->mode<2){ int b= (prev2[-2*refs] + next2[-2*refs])>>1; int f= (prev2[+2*refs] + next2[+2*refs])>>1; -- cgit v1.2.3