[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 957, Fri Mar 28 08:43:28 2003 UTC revision 982, Thu Apr 10 13:05:54 2003 UTC
# Line 42  Line 42 
42  #include "../global.h"  #include "../global.h"
43  #include "sad.h"  #include "sad.h"
44    
45    #include <stdlib.h>
46    
47  sad16FuncPtr sad16;  sad16FuncPtr sad16;
48  sad8FuncPtr sad8;  sad8FuncPtr sad8;
49  sad16biFuncPtr sad16bi;  sad16biFuncPtr sad16bi;
# Line 65  Line 67 
67          uint8_t const *ptr_ref = ref;          uint8_t const *ptr_ref = ref;
68    
69          for (j = 0; j < 16; j++) {          for (j = 0; j < 16; j++) {
70                          sad += ABS(ptr_cur[0] - ptr_ref[0]);                          sad += abs(ptr_cur[0] - ptr_ref[0]);
71                          sad += ABS(ptr_cur[1] - ptr_ref[1]);                          sad += abs(ptr_cur[1] - ptr_ref[1]);
72                          sad += ABS(ptr_cur[2] - ptr_ref[2]);                          sad += abs(ptr_cur[2] - ptr_ref[2]);
73                          sad += ABS(ptr_cur[3] - ptr_ref[3]);                          sad += abs(ptr_cur[3] - ptr_ref[3]);
74                          sad += ABS(ptr_cur[4] - ptr_ref[4]);                          sad += abs(ptr_cur[4] - ptr_ref[4]);
75                          sad += ABS(ptr_cur[5] - ptr_ref[5]);                          sad += abs(ptr_cur[5] - ptr_ref[5]);
76                          sad += ABS(ptr_cur[6] - ptr_ref[6]);                          sad += abs(ptr_cur[6] - ptr_ref[6]);
77                          sad += ABS(ptr_cur[7] - ptr_ref[7]);                          sad += abs(ptr_cur[7] - ptr_ref[7]);
78                          sad += ABS(ptr_cur[8] - ptr_ref[8]);                          sad += abs(ptr_cur[8] - ptr_ref[8]);
79                          sad += ABS(ptr_cur[9] - ptr_ref[9]);                          sad += abs(ptr_cur[9] - ptr_ref[9]);
80                          sad += ABS(ptr_cur[10] - ptr_ref[10]);                          sad += abs(ptr_cur[10] - ptr_ref[10]);
81                          sad += ABS(ptr_cur[11] - ptr_ref[11]);                          sad += abs(ptr_cur[11] - ptr_ref[11]);
82                          sad += ABS(ptr_cur[12] - ptr_ref[12]);                          sad += abs(ptr_cur[12] - ptr_ref[12]);
83                          sad += ABS(ptr_cur[13] - ptr_ref[13]);                          sad += abs(ptr_cur[13] - ptr_ref[13]);
84                          sad += ABS(ptr_cur[14] - ptr_ref[14]);                          sad += abs(ptr_cur[14] - ptr_ref[14]);
85                          sad += ABS(ptr_cur[15] - ptr_ref[15]);                          sad += abs(ptr_cur[15] - ptr_ref[15]);
86    
87                          if (sad >= best_sad)                          if (sad >= best_sad)
88                                  return sad;                                  return sad;
# Line 111  Line 113 
113    
114                  for (i = 0; i < 16; i++) {                  for (i = 0; i < 16; i++) {
115                          int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;                          int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;
116                          sad += ABS(ptr_cur[i] - pixel);                          sad += abs(ptr_cur[i] - pixel);
117                  }                  }
118    
119                  ptr_cur += stride;                  ptr_cur += stride;
# Line 141  Line 143 
143    
144                  for (i = 0; i < 8; i++) {                  for (i = 0; i < 8; i++) {
145                          int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;                          int pixel = (ptr_ref1[i] + ptr_ref2[i] + 1) / 2;
146                          sad += ABS(ptr_cur[i] - pixel);                          sad += abs(ptr_cur[i] - pixel);
147                  }                  }
148    
149                  ptr_cur += stride;                  ptr_cur += stride;
# Line 168  Line 170 
170    
171          for (j = 0; j < 8; j++) {          for (j = 0; j < 8; j++) {
172    
173                  sad += ABS(ptr_cur[0] - ptr_ref[0]);                  sad += abs(ptr_cur[0] - ptr_ref[0]);
174                  sad += ABS(ptr_cur[1] - ptr_ref[1]);                  sad += abs(ptr_cur[1] - ptr_ref[1]);
175                  sad += ABS(ptr_cur[2] - ptr_ref[2]);                  sad += abs(ptr_cur[2] - ptr_ref[2]);
176                  sad += ABS(ptr_cur[3] - ptr_ref[3]);                  sad += abs(ptr_cur[3] - ptr_ref[3]);
177                  sad += ABS(ptr_cur[4] - ptr_ref[4]);                  sad += abs(ptr_cur[4] - ptr_ref[4]);
178                  sad += ABS(ptr_cur[5] - ptr_ref[5]);                  sad += abs(ptr_cur[5] - ptr_ref[5]);
179                  sad += ABS(ptr_cur[6] - ptr_ref[6]);                  sad += abs(ptr_cur[6] - ptr_ref[6]);
180                  sad += ABS(ptr_cur[7] - ptr_ref[7]);                  sad += abs(ptr_cur[7] - ptr_ref[7]);
181    
182                  ptr_cur += stride;                  ptr_cur += stride;
183                  ptr_ref += stride;                  ptr_ref += stride;
# Line 213  Line 215 
215          for (j = 0; j < 16; j++) {          for (j = 0; j < 16; j++) {
216    
217                  for (i = 0; i < 16; i++)                  for (i = 0; i < 16; i++)
218                          dev += ABS(*(ptr_cur + i) - (int32_t) mean);                          dev += abs(*(ptr_cur + i) - (int32_t) mean);
219    
220                  ptr_cur += stride;                  ptr_cur += stride;
221    
# Line 281  Line 283 
283    
284                  for (i = 0; i < 16; i++) {                  for (i = 0; i < 16; i++) {
285    
286                          sad += ABS(*(ptr_cur + i) - *(ptr_ref + i) - mean);                          sad += abs(*(ptr_cur + i) - *(ptr_ref + i) - mean);
287                          if (sad >= best_sad) {                          if (sad >= best_sad) {
288                                  return MRSAD16_CORRFACTOR * sad;                                  return MRSAD16_CORRFACTOR * sad;
289                          }                          }

Legend:
Removed from v.957  
changed lines
  Added in v.982

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