summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_yadif.c
diff options
context:
space:
mode:
authorlorenm <lorenm@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-14 03:59:28 +0000
committerlorenm <lorenm@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-09-14 03:59:28 +0000
commitb30e300dcade32d4cb8abc5de0facdee1d4cc3c6 (patch)
tree6dd8fc5580cc5e06afbe08057075f3817593ea41 /libmpcodecs/vf_yadif.c
parent0cae194c8145506015f2634d9683b1352dbe44b5 (diff)
downloadmpv-b30e300dcade32d4cb8abc5de0facdee1d4cc3c6.tar.bz2
mpv-b30e300dcade32d4cb8abc5de0facdee1d4cc3c6.tar.xz
cosmetics
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19834 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_yadif.c')
-rw-r--r--libmpcodecs/vf_yadif.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index 2c2e387e45..f2d2df2619 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -68,24 +68,11 @@ 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;
-
- 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; y<h; y++){
- if((y ^ parity) & 1){
+static void filter_line(struct vf_priv_s *p, uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int refs, int parity){
+ int x;
+ uint8_t *prev2= parity ? prev : cur ;
+ uint8_t *next2= parity ? cur : next;
for(x=0; x<w; x++){
- uint8_t *prev= &p->ref[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 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int
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[i][x + y*dst_stride[i]]= d;
+ dst++;
+ cur++;
+ prev++;
+ next++;
+ prev2++;
+ next2++;
}
+}
+
+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; y<h; y++){
+ if((y ^ parity) & 1){
+ uint8_t *prev= &p->ref[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);
}