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 |
|
|
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 |
|
|