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 |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include "vpx_ports/mem.h" | 12 #include "vpx_ports/mem.h" |
13 #include "./vp9_rtcd.h" | 13 #include "./vp9_rtcd.h" |
14 unsigned int vp9_satd16x16_c(const unsigned char *src_ptr, | 14 |
| 15 unsigned int vp9_satd16x16_c(const uint8_t *src_ptr, |
15 int src_stride, | 16 int src_stride, |
16 const unsigned char *ref_ptr, | 17 const uint8_t *ref_ptr, |
17 int ref_stride, | 18 int ref_stride, |
18 unsigned int *psatd) { | 19 unsigned int *psatd) { |
19 int r, c, i; | 20 int r, c, i; |
20 unsigned int satd = 0; | 21 unsigned int satd = 0; |
21 DECLARE_ALIGNED(16, short, diff_in[256]); | 22 DECLARE_ALIGNED(16, int16_t, diff_in[256]); |
22 DECLARE_ALIGNED(16, short, diff_out[16]); | 23 DECLARE_ALIGNED(16, int16_t, diff_out[16]); |
23 short *in; | 24 int16_t *in; |
24 | 25 |
25 for (r = 0; r < 16; r++) { | 26 for (r = 0; r < 16; r++) { |
26 for (c = 0; c < 16; c++) { | 27 for (c = 0; c < 16; c++) { |
27 diff_in[r * 16 + c] = src_ptr[c] - ref_ptr[c]; | 28 diff_in[r * 16 + c] = src_ptr[c] - ref_ptr[c]; |
28 } | 29 } |
29 src_ptr += src_stride; | 30 src_ptr += src_stride; |
30 ref_ptr += ref_stride; | 31 ref_ptr += ref_stride; |
31 } | 32 } |
32 | 33 |
33 in = diff_in; | 34 in = diff_in; |
34 for (r = 0; r < 16; r += 4) { | 35 for (r = 0; r < 16; r += 4) { |
35 for (c = 0; c < 16; c += 4) { | 36 for (c = 0; c < 16; c += 4) { |
36 vp9_short_walsh4x4_c(in + c, diff_out, 32); | 37 vp9_short_walsh4x4_c(in + c, diff_out, 32); |
37 for (i = 0; i < 16; i++) | 38 for (i = 0; i < 16; i++) |
38 satd += abs(diff_out[i]); | 39 satd += abs(diff_out[i]); |
39 } | 40 } |
40 in += 64; | 41 in += 64; |
41 } | 42 } |
42 | 43 |
43 if (psatd) | 44 if (psatd) |
44 *psatd = satd; | 45 *psatd = satd; |
45 | 46 |
46 return satd; | 47 return satd; |
47 } | 48 } |
OLD | NEW |