Removed unused vp8_recon_intra4x4mb function
[libvpx.git] / vp8 / encoder / sad_c.c
blob5eaca5935f12c8cf98999854aae50e6f59403fe9
1 /*
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.
9 */
12 #include <stdlib.h>
14 unsigned int vp8_sad16x16_c(
15 const unsigned char *src_ptr,
16 int src_stride,
17 const unsigned char *ref_ptr,
18 int ref_stride,
19 int max_sad)
22 int r, c;
23 unsigned int sad = 0;
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;
36 return sad;
40 static __inline
41 unsigned int sad_mx_n_c(
42 const unsigned char *src_ptr,
43 int src_stride,
44 const unsigned char *ref_ptr,
45 int ref_stride,
46 int m,
47 int n)
50 int r, c;
51 unsigned int sad = 0;
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;
64 return sad;
68 unsigned int vp8_sad8x8_c(
69 const unsigned char *src_ptr,
70 int src_stride,
71 const unsigned char *ref_ptr,
72 int ref_stride,
73 int max_sad)
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,
82 int src_stride,
83 const unsigned char *ref_ptr,
84 int ref_stride,
85 int max_sad)
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,
95 int src_stride,
96 const unsigned char *ref_ptr,
97 int ref_stride,
98 int max_sad)
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,
107 int src_stride,
108 const unsigned char *ref_ptr,
109 int ref_stride,
110 int max_sad)
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,
118 int src_stride,
119 const unsigned char *ref_ptr,
120 int ref_stride,
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,
131 int src_stride,
132 const unsigned char *ref_ptr,
133 int ref_stride,
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,
149 int src_stride,
150 const unsigned char *ref_ptr,
151 int ref_stride,
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,
162 int src_stride,
163 const unsigned char *ref_ptr,
164 int ref_stride,
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);
178 void vp8_sad8x8x3_c(
179 const unsigned char *src_ptr,
180 int src_stride,
181 const unsigned char *ref_ptr,
182 int ref_stride,
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);
191 void vp8_sad8x8x8_c(
192 const unsigned char *src_ptr,
193 int src_stride,
194 const unsigned char *ref_ptr,
195 int ref_stride,
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,
211 int src_stride,
212 const unsigned char *ref_ptr,
213 int ref_stride,
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,
224 int src_stride,
225 const unsigned char *ref_ptr,
226 int ref_stride,
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);
240 void vp8_sad4x4x3_c(
241 const unsigned char *src_ptr,
242 int src_stride,
243 const unsigned char *ref_ptr,
244 int ref_stride,
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);
253 void vp8_sad4x4x8_c(
254 const unsigned char *src_ptr,
255 int src_stride,
256 const unsigned char *ref_ptr,
257 int ref_stride,
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,
273 int src_stride,
274 unsigned char *ref_ptr[],
275 int ref_stride,
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,
287 int src_stride,
288 unsigned char *ref_ptr[],
289 int ref_stride,
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,
301 int src_stride,
302 unsigned char *ref_ptr[],
303 int ref_stride,
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,
315 int src_stride,
316 unsigned char *ref_ptr[],
317 int ref_stride,
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,
329 int src_stride,
330 unsigned char *ref_ptr[],
331 int ref_stride,
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);