2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
14 unsigned int vp8_sad16x16_c(
15 const unsigned char *src_ptr
,
17 const unsigned char *ref_ptr
,
25 for (r
= 0; r
< 16; r
++)
27 for (c
= 0; c
< 16; c
++)
29 sad
+= abs(src_ptr
[c
] - ref_ptr
[c
]);
32 src_ptr
+= src_stride
;
33 ref_ptr
+= ref_stride
;
41 unsigned int sad_mx_n_c(
42 const unsigned char *src_ptr
,
44 const unsigned char *ref_ptr
,
53 for (r
= 0; r
< n
; r
++)
55 for (c
= 0; c
< m
; c
++)
57 sad
+= abs(src_ptr
[c
] - ref_ptr
[c
]);
60 src_ptr
+= src_stride
;
61 ref_ptr
+= ref_stride
;
68 unsigned int vp8_sad8x8_c(
69 const unsigned char *src_ptr
,
71 const unsigned char *ref_ptr
,
76 return sad_mx_n_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 8, 8);
80 unsigned int vp8_sad16x8_c(
81 const unsigned char *src_ptr
,
83 const unsigned char *ref_ptr
,
88 return sad_mx_n_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 16, 8);
93 unsigned int vp8_sad8x16_c(
94 const unsigned char *src_ptr
,
96 const unsigned char *ref_ptr
,
101 return sad_mx_n_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 8, 16);
105 unsigned int vp8_sad4x4_c(
106 const unsigned char *src_ptr
,
108 const unsigned char *ref_ptr
,
113 return sad_mx_n_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 4, 4);
116 void vp8_sad16x16x3_c(
117 const unsigned char *src_ptr
,
119 const unsigned char *ref_ptr
,
121 unsigned int *sad_array
124 sad_array
[0] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
125 sad_array
[1] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
126 sad_array
[2] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
129 void vp8_sad16x16x8_c(
130 const unsigned char *src_ptr
,
132 const unsigned char *ref_ptr
,
134 unsigned short *sad_array
137 sad_array
[0] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
138 sad_array
[1] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
139 sad_array
[2] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
140 sad_array
[3] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 3 , ref_stride
, 0x7fffffff);
141 sad_array
[4] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 4, ref_stride
, 0x7fffffff);
142 sad_array
[5] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 5, ref_stride
, 0x7fffffff);
143 sad_array
[6] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 6 , ref_stride
, 0x7fffffff);
144 sad_array
[7] = (unsigned short)vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
+ 7, ref_stride
, 0x7fffffff);
147 void vp8_sad16x8x3_c(
148 const unsigned char *src_ptr
,
150 const unsigned char *ref_ptr
,
152 unsigned int *sad_array
155 sad_array
[0] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
156 sad_array
[1] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
157 sad_array
[2] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
160 void vp8_sad16x8x8_c(
161 const unsigned char *src_ptr
,
163 const unsigned char *ref_ptr
,
165 unsigned short *sad_array
168 sad_array
[0] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
169 sad_array
[1] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
170 sad_array
[2] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
171 sad_array
[3] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 3 , ref_stride
, 0x7fffffff);
172 sad_array
[4] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 4, ref_stride
, 0x7fffffff);
173 sad_array
[5] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 5, ref_stride
, 0x7fffffff);
174 sad_array
[6] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 6 , ref_stride
, 0x7fffffff);
175 sad_array
[7] = (unsigned short)vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
+ 7, ref_stride
, 0x7fffffff);
179 const unsigned char *src_ptr
,
181 const unsigned char *ref_ptr
,
183 unsigned int *sad_array
186 sad_array
[0] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
187 sad_array
[1] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
188 sad_array
[2] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
192 const unsigned char *src_ptr
,
194 const unsigned char *ref_ptr
,
196 unsigned short *sad_array
199 sad_array
[0] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
200 sad_array
[1] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
201 sad_array
[2] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
202 sad_array
[3] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 3 , ref_stride
, 0x7fffffff);
203 sad_array
[4] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 4, ref_stride
, 0x7fffffff);
204 sad_array
[5] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 5, ref_stride
, 0x7fffffff);
205 sad_array
[6] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 6 , ref_stride
, 0x7fffffff);
206 sad_array
[7] = (unsigned short)vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
+ 7, ref_stride
, 0x7fffffff);
209 void vp8_sad8x16x3_c(
210 const unsigned char *src_ptr
,
212 const unsigned char *ref_ptr
,
214 unsigned int *sad_array
217 sad_array
[0] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
218 sad_array
[1] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
219 sad_array
[2] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
222 void vp8_sad8x16x8_c(
223 const unsigned char *src_ptr
,
225 const unsigned char *ref_ptr
,
227 unsigned short *sad_array
230 sad_array
[0] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
231 sad_array
[1] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
232 sad_array
[2] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
233 sad_array
[3] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 3 , ref_stride
, 0x7fffffff);
234 sad_array
[4] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 4, ref_stride
, 0x7fffffff);
235 sad_array
[5] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 5, ref_stride
, 0x7fffffff);
236 sad_array
[6] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 6 , ref_stride
, 0x7fffffff);
237 sad_array
[7] = (unsigned short)vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
+ 7, ref_stride
, 0x7fffffff);
241 const unsigned char *src_ptr
,
243 const unsigned char *ref_ptr
,
245 unsigned int *sad_array
248 sad_array
[0] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
249 sad_array
[1] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
250 sad_array
[2] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
254 const unsigned char *src_ptr
,
256 const unsigned char *ref_ptr
,
258 unsigned short *sad_array
261 sad_array
[0] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
, ref_stride
, 0x7fffffff);
262 sad_array
[1] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 1, ref_stride
, 0x7fffffff);
263 sad_array
[2] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 2, ref_stride
, 0x7fffffff);
264 sad_array
[3] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 3 , ref_stride
, 0x7fffffff);
265 sad_array
[4] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 4, ref_stride
, 0x7fffffff);
266 sad_array
[5] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 5, ref_stride
, 0x7fffffff);
267 sad_array
[6] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 6 , ref_stride
, 0x7fffffff);
268 sad_array
[7] = (unsigned short)vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
+ 7, ref_stride
, 0x7fffffff);
271 void vp8_sad16x16x4d_c(
272 const unsigned char *src_ptr
,
274 unsigned char *ref_ptr
[],
276 unsigned int *sad_array
279 sad_array
[0] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
[0], ref_stride
, 0x7fffffff);
280 sad_array
[1] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
[1], ref_stride
, 0x7fffffff);
281 sad_array
[2] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
[2], ref_stride
, 0x7fffffff);
282 sad_array
[3] = vp8_sad16x16_c(src_ptr
, src_stride
, ref_ptr
[3], ref_stride
, 0x7fffffff);
285 void vp8_sad16x8x4d_c(
286 const unsigned char *src_ptr
,
288 unsigned char *ref_ptr
[],
290 unsigned int *sad_array
293 sad_array
[0] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
[0], ref_stride
, 0x7fffffff);
294 sad_array
[1] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
[1], ref_stride
, 0x7fffffff);
295 sad_array
[2] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
[2], ref_stride
, 0x7fffffff);
296 sad_array
[3] = vp8_sad16x8_c(src_ptr
, src_stride
, ref_ptr
[3], ref_stride
, 0x7fffffff);
299 void vp8_sad8x8x4d_c(
300 const unsigned char *src_ptr
,
302 unsigned char *ref_ptr
[],
304 unsigned int *sad_array
307 sad_array
[0] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
[0], ref_stride
, 0x7fffffff);
308 sad_array
[1] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
[1], ref_stride
, 0x7fffffff);
309 sad_array
[2] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
[2], ref_stride
, 0x7fffffff);
310 sad_array
[3] = vp8_sad8x8_c(src_ptr
, src_stride
, ref_ptr
[3], ref_stride
, 0x7fffffff);
313 void vp8_sad8x16x4d_c(
314 const unsigned char *src_ptr
,
316 unsigned char *ref_ptr
[],
318 unsigned int *sad_array
321 sad_array
[0] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
[0], ref_stride
, 0x7fffffff);
322 sad_array
[1] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
[1], ref_stride
, 0x7fffffff);
323 sad_array
[2] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
[2], ref_stride
, 0x7fffffff);
324 sad_array
[3] = vp8_sad8x16_c(src_ptr
, src_stride
, ref_ptr
[3], ref_stride
, 0x7fffffff);
327 void vp8_sad4x4x4d_c(
328 const unsigned char *src_ptr
,
330 unsigned char *ref_ptr
[],
332 unsigned int *sad_array
335 sad_array
[0] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
[0], ref_stride
, 0x7fffffff);
336 sad_array
[1] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
[1], ref_stride
, 0x7fffffff);
337 sad_array
[2] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
[2], ref_stride
, 0x7fffffff);
338 sad_array
[3] = vp8_sad4x4_c(src_ptr
, src_stride
, ref_ptr
[3], ref_stride
, 0x7fffffff);