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