# HG changeset patch # User lorenm # Date 1158206368 0 # Node ID 1d5832b4b2046567e963abc78b2a317f764bbb64 # Parent 5d3bd75d4deb63302b9a5b758e2f1f9c23e36f9f cosmetics diff -r 5d3bd75d4deb -r 1d5832b4b204 libmpcodecs/vf_yadif.c --- a/libmpcodecs/vf_yadif.c Wed Sep 13 16:14:08 2006 +0000 +++ b/libmpcodecs/vf_yadif.c Thu Sep 14 03:59:28 2006 +0000 @@ -68,24 +68,11 @@ } } -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; - - for(i=0; i<3; i++){ - int is_chroma= !!i; - int w= width >>is_chroma; - int h= height>>is_chroma; - int refs= p->stride[i]; - - for(y=0; yref[0][i][x + y*refs]; - uint8_t *cur = &p->ref[1][i][x + y*refs]; - uint8_t *next= &p->ref[2][i][x + y*refs]; - uint8_t *prev2= (tff ^ parity) ? prev : cur ; - uint8_t *next2= (tff ^ parity) ? cur : next; - int c= cur[-refs]; int d= (prev2[0] + next2[0])>>1; int e= cur[+refs]; @@ -124,11 +111,38 @@ diff= MAX3(diff, min, -max); } - if(d < spatial_pred) d= MIN(d + diff, spatial_pred); - else d= MAX(d - diff, spatial_pred); + if(spatial_pred > d + diff) + spatial_pred = d + diff; + else if(spatial_pred < d - diff) + spatial_pred = d - diff; + + dst[0] = spatial_pred; + + dst++; + cur++; + prev++; + next++; + prev2++; + next2++; + } +} - dst[i][x + y*dst_stride[i]]= d; - } +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; + + for(i=0; i<3; i++){ + int is_chroma= !!i; + int w= width >>is_chroma; + int h= height>>is_chroma; + int refs= p->stride[i]; + + for(y=0; yref[0][i][y*refs]; + uint8_t *cur = &p->ref[1][i][y*refs]; + uint8_t *next= &p->ref[2][i][y*refs]; + uint8_t *dst2= &dst[i][y*dst_stride[i]]; + filter_line(p, dst2, prev, cur, next, w, refs, parity ^ tff); }else{ memcpy(&dst[i][y*dst_stride[i]], &p->ref[1][i][y*refs], w); }