[svn] / trunk / xvidcore / src / motion / sad.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/motion/sad.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 195, Wed Jun 12 20:38:41 2002 UTC revision 329, Tue Jul 23 12:59:57 2002 UTC
# Line 42  Line 42 
42    
43  #define ABS(X) (((X)>0)?(X):-(X))  #define ABS(X) (((X)>0)?(X):-(X))
44    
45    #define MRSAD16_CORRFACTOR 8
46  uint32_t  uint32_t
47  sad8FuncPtr sad8;  mrsad16_c(const uint8_t * const cur,
48                    const uint8_t * const ref,                    const uint8_t * const ref,
49                      const uint32_t stride,
50                    const uint32_t best_sad)                    const uint32_t best_sad)
51  {  {
52    
# Line 165  Line 166 
166  {  {
167    
168          uint32_t sad = 0;          uint32_t sad = 0;
169            uint32_t i, j;
170            uint8_t const *ptr_cur = cur;
171            uint8_t const *ptr_ref1 = ref1;
172            uint8_t const *ptr_ref2 = ref2;
173    
174            for (j = 0; j < 8; j++) {
175    
176                    for (i = 0; i < 8; i++) {
177                            int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;
178    
179                            if (pixel < 0) {
180                                    pixel = 0;
181                            } else if (pixel > 255) {
182                                    pixel = 255;
183                            }
184    
185                            sad += ABS(ptr_cur[i] - pixel);
186                    }
187    
188                    ptr_cur += stride;
189                    ptr_ref1 += stride;
190                    ptr_ref2 += stride;
191    
192            }
193    
194            return sad;
195    
196    }
197    
198    
199    
200    uint32_t
201    sad8_c(const uint8_t * const cur,
202               const uint8_t * const ref,
203               const uint32_t stride)
204    {
205            uint32_t sad = 0;
206            uint32_t i, j;
207          uint8_t const *ptr_cur = cur;          uint8_t const *ptr_cur = cur;
208          uint8_t const *ptr_ref = ref;          uint8_t const *ptr_ref = ref;
209    

Legend:
Removed from v.195  
changed lines
  Added in v.329

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4