[svn] / branches / dev-api-4 / xvidcore / src / motion / sad.c Repository:
ViewVC logotype

Diff of /branches/dev-api-4/xvidcore/src/motion/sad.c

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

revision 325, Sun Jul 21 14:05:38 2002 UTC revision 326, Sun Jul 21 23:34:08 2002 UTC
# Line 46  Line 46 
46  sad8FuncPtr sad8;  sad8FuncPtr sad8;
47                    const uint8_t * const ref,                    const uint8_t * const ref,
48    
49    sad16biFuncPtr sad8bi;          // not really sad16, but no difference in prototype
50                      const uint32_t stride,
51                    const uint32_t best_sad)                    const uint32_t best_sad)
52  {  {
53    
# Line 165  Line 167 
167  {  {
168    
169          uint32_t sad = 0;          uint32_t sad = 0;
170            uint32_t i, j;
171            uint8_t const *ptr_cur = cur;
172            uint8_t const *ptr_ref1 = ref1;
173            uint8_t const *ptr_ref2 = ref2;
174    
175            for (j = 0; j < 8; j++) {
176    
177                    for (i = 0; i < 8; i++) {
178                            int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;
179    
180                            if (pixel < 0) {
181                                    pixel = 0;
182                            } else if (pixel > 255) {
183                                    pixel = 255;
184                            }
185    
186                            sad += ABS(ptr_cur[i] - pixel);
187                    }
188    
189                    ptr_cur += stride;
190                    ptr_ref1 += stride;
191                    ptr_ref2 += stride;
192    
193            }
194    
195            return sad;
196    
197    }
198    
199    
200    
201    uint32_t
202    sad8_c(const uint8_t * const cur,
203               const uint8_t * const ref,
204               const uint32_t stride)
205    {
206            uint32_t sad = 0;
207            uint32_t i, j;
208          uint8_t const *ptr_cur = cur;          uint8_t const *ptr_cur = cur;
209          uint8_t const *ptr_ref = ref;          uint8_t const *ptr_ref = ref;
210    

Legend:
Removed from v.325  
changed lines
  Added in v.326

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