[MPlayer-cvslog] r18658 - in trunk/libmpcodecs: vf_mcdeint.c vf_yadif.c

michael subversion at mplayerhq.hu
Fri Jun 9 12:29:35 CEST 2006


Author: michael
Date: Fri Jun  9 12:29:35 2006
New Revision: 18658

Modified:
   trunk/libmpcodecs/vf_mcdeint.c
   trunk/libmpcodecs/vf_yadif.c

Log:
better spatial interpolation


Modified: trunk/libmpcodecs/vf_mcdeint.c
==============================================================================
--- trunk/libmpcodecs/vf_mcdeint.c	(original)
+++ trunk/libmpcodecs/vf_mcdeint.c	Fri Jun  9 12:29:35 2006
@@ -89,7 +89,7 @@
 };
 
 static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, int height){
-    int x, y, i, j;
+    int x, y, i;
     int out_size;
 
     for(i=0; i<3; i++){
@@ -118,21 +118,22 @@
                         uint8_t *srcp= &src[i][x + y*srcs];
                         int diff0= filp[-fils] - srcp[-srcs];
                         int diff1= filp[+fils] - srcp[+srcs];
-                        int diffscore= ABS(srcp[-srcs-1] - srcp[+srcs-1])
-                                      +ABS(srcp[-srcs  ] - srcp[+srcs  ])
-                                      +ABS(srcp[-srcs+1] - srcp[+srcs+1]);
+                        int spatial_score= ABS(srcp[-srcs-1] - srcp[+srcs-1])
+                                          +ABS(srcp[-srcs  ] - srcp[+srcs  ])
+                                          +ABS(srcp[-srcs+1] - srcp[+srcs+1]) - 1;
                         int temp= filp[0];
 
-                        for(j=-1; j<=1; j+=2){
-                            int score= ABS(srcp[-srcs+j-1] - srcp[+srcs-j-1])
-                                      +ABS(srcp[-srcs+j  ] - srcp[+srcs-j  ])
-                                      +ABS(srcp[-srcs+j+1] - srcp[+srcs-j+1]) + 1;
-                            if(score < diffscore){
-                                diffscore= score;
-                                diff0= filp[-fils+j] - srcp[-srcs+j];
-                                diff1= filp[+fils-j] - srcp[+srcs-j];
-                            }
-                        }
+#define CHECK(j)\
+    {   int score= ABS(srcp[-srcs-1+j] - srcp[+srcs-1-j])\
+                 + ABS(srcp[-srcs  +j] - srcp[+srcs  -j])\
+                 + ABS(srcp[-srcs+1+j] - srcp[+srcs+1-j]);\
+        if(score < spatial_score){\
+            spatial_score= score;\
+            diff0= filp[-fils+j] - srcp[-srcs+j];\
+            diff1= filp[+fils-j] - srcp[+srcs-j];
+
+                        CHECK(-1) CHECK(-2) }} }}
+                        CHECK( 1) CHECK( 2) }} }}
 #if 0
                         if((diff0 ^ diff1) > 0){
                             int mindiff= ABS(diff0) > ABS(diff1) ? diff1 : diff0;

Modified: trunk/libmpcodecs/vf_yadif.c
==============================================================================
--- trunk/libmpcodecs/vf_yadif.c	(original)
+++ trunk/libmpcodecs/vf_yadif.c	Fri Jun  9 12:29:35 2006
@@ -65,7 +65,7 @@
 }
 
 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 @@
                         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;
+
+#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) }} }}
 
-                        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;
-
-                            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;



More information about the MPlayer-cvslog mailing list