OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 int y, x; | 25 int y, x; |
26 unsigned int sad = 0; | 26 unsigned int sad = 0; |
27 | 27 |
28 for (y = 0; y < height; y++) { | 28 for (y = 0; y < height; y++) { |
29 for (x = 0; x < width; x++) | 29 for (x = 0; x < width; x++) |
30 sad += abs(a[x] - b[x]); | 30 sad += abs(a[x] - b[x]); |
31 | 31 |
32 a += a_stride; | 32 a += a_stride; |
33 b += b_stride; | 33 b += b_stride; |
34 } | 34 } |
35 | |
36 return sad; | 35 return sad; |
37 } | 36 } |
38 | 37 |
39 #define sadMxN(m, n) \ | 38 #define sadMxN(m, n) \ |
40 unsigned int vp9_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ | 39 unsigned int vp9_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ |
41 const uint8_t *ref, int ref_stride) { \ | 40 const uint8_t *ref, int ref_stride) { \ |
42 return sad(src, src_stride, ref, ref_stride, m, n); \ | 41 return sad(src, src_stride, ref, ref_stride, m, n); \ |
43 } \ | 42 } \ |
44 unsigned int vp9_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \ | 43 unsigned int vp9_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \ |
45 const uint8_t *ref, int ref_stride, \ | 44 const uint8_t *ref, int ref_stride, \ |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 sadMxNxK(4, 8, 8) | 128 sadMxNxK(4, 8, 8) |
130 sadMxNx4D(4, 8) | 129 sadMxNx4D(4, 8) |
131 | 130 |
132 // 4x4 | 131 // 4x4 |
133 sadMxN(4, 4) | 132 sadMxN(4, 4) |
134 sadMxNxK(4, 4, 3) | 133 sadMxNxK(4, 4, 3) |
135 sadMxNxK(4, 4, 8) | 134 sadMxNxK(4, 4, 8) |
136 sadMxNx4D(4, 4) | 135 sadMxNx4D(4, 4) |
137 | 136 |
138 #if CONFIG_VP9_HIGHBITDEPTH | 137 #if CONFIG_VP9_HIGHBITDEPTH |
139 static INLINE unsigned int high_sad(const uint8_t *a8, int a_stride, | 138 static INLINE unsigned int highbd_sad(const uint8_t *a8, int a_stride, |
140 const uint8_t *b8, int b_stride, | 139 const uint8_t *b8, int b_stride, |
141 int width, int height) { | 140 int width, int height) { |
142 int y, x; | 141 int y, x; |
143 unsigned int sad = 0; | 142 unsigned int sad = 0; |
144 const uint16_t *a = CONVERT_TO_SHORTPTR(a8); | 143 const uint16_t *a = CONVERT_TO_SHORTPTR(a8); |
145 const uint16_t *b = CONVERT_TO_SHORTPTR(b8); | 144 const uint16_t *b = CONVERT_TO_SHORTPTR(b8); |
146 for (y = 0; y < height; y++) { | 145 for (y = 0; y < height; y++) { |
147 for (x = 0; x < width; x++) | 146 for (x = 0; x < width; x++) |
148 sad += abs(a[x] - b[x]); | 147 sad += abs(a[x] - b[x]); |
149 | 148 |
150 a += a_stride; | 149 a += a_stride; |
151 b += b_stride; | 150 b += b_stride; |
152 } | 151 } |
153 return sad; | 152 return sad; |
154 } | 153 } |
155 | 154 |
156 static INLINE unsigned int high_sadb(const uint8_t *a8, int a_stride, | 155 static INLINE unsigned int highbd_sadb(const uint8_t *a8, int a_stride, |
157 const uint16_t *b, int b_stride, | 156 const uint16_t *b, int b_stride, |
158 int width, int height) { | 157 int width, int height) { |
159 int y, x; | 158 int y, x; |
160 unsigned int sad = 0; | 159 unsigned int sad = 0; |
161 const uint16_t *a = CONVERT_TO_SHORTPTR(a8); | 160 const uint16_t *a = CONVERT_TO_SHORTPTR(a8); |
162 for (y = 0; y < height; y++) { | 161 for (y = 0; y < height; y++) { |
163 for (x = 0; x < width; x++) | 162 for (x = 0; x < width; x++) |
164 sad += abs(a[x] - b[x]); | 163 sad += abs(a[x] - b[x]); |
165 | 164 |
166 a += a_stride; | 165 a += a_stride; |
167 b += b_stride; | 166 b += b_stride; |
168 } | 167 } |
169 return sad; | 168 return sad; |
170 } | 169 } |
171 | 170 |
172 #define high_sadMxN(m, n) \ | 171 #define highbd_sadMxN(m, n) \ |
173 unsigned int vp9_high_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ | 172 unsigned int vp9_highbd_sad##m##x##n##_c(const uint8_t *src, int src_stride, \ |
174 const uint8_t *ref, int ref_stride) { \ | 173 const uint8_t *ref, int ref_stride) { \ |
175 return high_sad(src, src_stride, ref, ref_stride, m, n); \ | 174 return highbd_sad(src, src_stride, ref, ref_stride, m, n); \ |
176 } \ | 175 } \ |
177 unsigned int vp9_high_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \ | 176 unsigned int vp9_highbd_sad##m##x##n##_avg_c(const uint8_t *src, \ |
178 const uint8_t *ref, int ref_stride, \ | 177 int src_stride, \ |
179 const uint8_t *second_pred) { \ | 178 const uint8_t *ref, \ |
| 179 int ref_stride, \ |
| 180 const uint8_t *second_pred) { \ |
180 uint16_t comp_pred[m * n]; \ | 181 uint16_t comp_pred[m * n]; \ |
181 vp9_high_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \ | 182 vp9_highbd_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride); \ |
182 return high_sadb(src, src_stride, comp_pred, m, m, n); \ | 183 return highbd_sadb(src, src_stride, comp_pred, m, m, n); \ |
183 } | 184 } |
184 | 185 |
185 #define high_sadMxNxK(m, n, k) \ | 186 #define highbd_sadMxNxK(m, n, k) \ |
186 void vp9_high_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \ | 187 void vp9_highbd_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \ |
187 const uint8_t *ref, int ref_stride, \ | 188 const uint8_t *ref, int ref_stride, \ |
188 unsigned int *sads) { \ | 189 unsigned int *sads) { \ |
189 int i; \ | 190 int i; \ |
190 for (i = 0; i < k; ++i) \ | 191 for (i = 0; i < k; ++i) { \ |
191 sads[i] = vp9_high_sad##m##x##n##_c(src, src_stride, &ref[i], ref_stride); \ | 192 sads[i] = vp9_highbd_sad##m##x##n##_c(src, src_stride, &ref[i], \ |
| 193 ref_stride); \ |
| 194 } \ |
192 } | 195 } |
193 | 196 |
194 #define high_sadMxNx4D(m, n) \ | 197 #define highbd_sadMxNx4D(m, n) \ |
195 void vp9_high_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \ | 198 void vp9_highbd_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \ |
196 const uint8_t *const refs[], \ | 199 const uint8_t *const refs[], \ |
197 int ref_stride, unsigned int *sads) { \ | 200 int ref_stride, unsigned int *sads) { \ |
198 int i; \ | 201 int i; \ |
199 for (i = 0; i < 4; ++i) \ | 202 for (i = 0; i < 4; ++i) { \ |
200 sads[i] = vp9_high_sad##m##x##n##_c(src, src_stride, refs[i], ref_stride); \ | 203 sads[i] = vp9_highbd_sad##m##x##n##_c(src, src_stride, refs[i], \ |
| 204 ref_stride); \ |
| 205 } \ |
201 } | 206 } |
202 | 207 |
203 // 64x64 | 208 // 64x64 |
204 high_sadMxN(64, 64) | 209 highbd_sadMxN(64, 64) |
205 high_sadMxNxK(64, 64, 3) | 210 highbd_sadMxNxK(64, 64, 3) |
206 high_sadMxNxK(64, 64, 8) | 211 highbd_sadMxNxK(64, 64, 8) |
207 high_sadMxNx4D(64, 64) | 212 highbd_sadMxNx4D(64, 64) |
208 | 213 |
209 // 64x32 | 214 // 64x32 |
210 high_sadMxN(64, 32) | 215 highbd_sadMxN(64, 32) |
211 high_sadMxNx4D(64, 32) | 216 highbd_sadMxNx4D(64, 32) |
212 | 217 |
213 // 32x64 | 218 // 32x64 |
214 high_sadMxN(32, 64) | 219 highbd_sadMxN(32, 64) |
215 high_sadMxNx4D(32, 64) | 220 highbd_sadMxNx4D(32, 64) |
216 | 221 |
217 // 32x32 | 222 // 32x32 |
218 high_sadMxN(32, 32) | 223 highbd_sadMxN(32, 32) |
219 high_sadMxNxK(32, 32, 3) | 224 highbd_sadMxNxK(32, 32, 3) |
220 high_sadMxNxK(32, 32, 8) | 225 highbd_sadMxNxK(32, 32, 8) |
221 high_sadMxNx4D(32, 32) | 226 highbd_sadMxNx4D(32, 32) |
222 | 227 |
223 // 32x16 | 228 // 32x16 |
224 high_sadMxN(32, 16) | 229 highbd_sadMxN(32, 16) |
225 high_sadMxNx4D(32, 16) | 230 highbd_sadMxNx4D(32, 16) |
226 | 231 |
227 // 16x32 | 232 // 16x32 |
228 high_sadMxN(16, 32) | 233 highbd_sadMxN(16, 32) |
229 high_sadMxNx4D(16, 32) | 234 highbd_sadMxNx4D(16, 32) |
230 | 235 |
231 // 16x16 | 236 // 16x16 |
232 high_sadMxN(16, 16) | 237 highbd_sadMxN(16, 16) |
233 high_sadMxNxK(16, 16, 3) | 238 highbd_sadMxNxK(16, 16, 3) |
234 high_sadMxNxK(16, 16, 8) | 239 highbd_sadMxNxK(16, 16, 8) |
235 high_sadMxNx4D(16, 16) | 240 highbd_sadMxNx4D(16, 16) |
236 | 241 |
237 // 16x8 | 242 // 16x8 |
238 high_sadMxN(16, 8) | 243 highbd_sadMxN(16, 8) |
239 high_sadMxNxK(16, 8, 3) | 244 highbd_sadMxNxK(16, 8, 3) |
240 high_sadMxNxK(16, 8, 8) | 245 highbd_sadMxNxK(16, 8, 8) |
241 high_sadMxNx4D(16, 8) | 246 highbd_sadMxNx4D(16, 8) |
242 | 247 |
243 // 8x16 | 248 // 8x16 |
244 high_sadMxN(8, 16) | 249 highbd_sadMxN(8, 16) |
245 high_sadMxNxK(8, 16, 3) | 250 highbd_sadMxNxK(8, 16, 3) |
246 high_sadMxNxK(8, 16, 8) | 251 highbd_sadMxNxK(8, 16, 8) |
247 high_sadMxNx4D(8, 16) | 252 highbd_sadMxNx4D(8, 16) |
248 | 253 |
249 // 8x8 | 254 // 8x8 |
250 high_sadMxN(8, 8) | 255 highbd_sadMxN(8, 8) |
251 high_sadMxNxK(8, 8, 3) | 256 highbd_sadMxNxK(8, 8, 3) |
252 high_sadMxNxK(8, 8, 8) | 257 highbd_sadMxNxK(8, 8, 8) |
253 high_sadMxNx4D(8, 8) | 258 highbd_sadMxNx4D(8, 8) |
254 | 259 |
255 // 8x4 | 260 // 8x4 |
256 high_sadMxN(8, 4) | 261 highbd_sadMxN(8, 4) |
257 high_sadMxNxK(8, 4, 8) | 262 highbd_sadMxNxK(8, 4, 8) |
258 high_sadMxNx4D(8, 4) | 263 highbd_sadMxNx4D(8, 4) |
259 | 264 |
260 // 4x8 | 265 // 4x8 |
261 high_sadMxN(4, 8) | 266 highbd_sadMxN(4, 8) |
262 high_sadMxNxK(4, 8, 8) | 267 highbd_sadMxNxK(4, 8, 8) |
263 high_sadMxNx4D(4, 8) | 268 highbd_sadMxNx4D(4, 8) |
264 | 269 |
265 // 4x4 | 270 // 4x4 |
266 high_sadMxN(4, 4) | 271 highbd_sadMxN(4, 4) |
267 high_sadMxNxK(4, 4, 3) | 272 highbd_sadMxNxK(4, 4, 3) |
268 high_sadMxNxK(4, 4, 8) | 273 highbd_sadMxNxK(4, 4, 8) |
269 high_sadMxNx4D(4, 4) | 274 highbd_sadMxNx4D(4, 4) |
270 | 275 |
271 #endif // CONFIG_VP9_HIGHBITDEPTH | 276 #endif // CONFIG_VP9_HIGHBITDEPTH |
OLD | NEW |