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 "vpx_config.h" | 11 #include "./vpx_config.h" |
12 #include "vp9/encoder/vp9_variance.h" | 12 #include "vp9/encoder/vp9_variance.h" |
13 #include "vp9/common/vp9_pragmas.h" | 13 #include "vp9/common/vp9_pragmas.h" |
14 #include "vpx_ports/mem.h" | 14 #include "vpx_ports/mem.h" |
15 | 15 |
16 extern unsigned int vp9_get_mb_ss_mmx(const short *src_ptr); | 16 extern unsigned int vp9_get_mb_ss_mmx(const int16_t *src_ptr); |
17 extern unsigned int vp9_get8x8var_mmx | 17 extern unsigned int vp9_get8x8var_mmx |
18 ( | 18 ( |
19 const unsigned char *src_ptr, | 19 const unsigned char *src_ptr, |
20 int source_stride, | 20 int source_stride, |
21 const unsigned char *ref_ptr, | 21 const unsigned char *ref_ptr, |
22 int recon_stride, | 22 int recon_stride, |
23 unsigned int *SSE, | 23 unsigned int *SSE, |
24 int *Sum | 24 int *Sum |
25 ); | 25 ); |
26 extern unsigned int vp9_get4x4var_mmx | 26 extern unsigned int vp9_get4x4var_mmx |
(...skipping 11 matching lines...) Expand all Loading... |
38 int source_stride, | 38 int source_stride, |
39 const unsigned char *ref_ptr, | 39 const unsigned char *ref_ptr, |
40 int recon_stride, | 40 int recon_stride, |
41 unsigned int *sse) { | 41 unsigned int *sse) { |
42 unsigned int var; | 42 unsigned int var; |
43 int avg; | 43 int avg; |
44 | 44 |
45 vp9_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg); | 45 vp9_get4x4var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg); |
46 *sse = var; | 46 *sse = var; |
47 return (var - (((unsigned int)avg * avg) >> 4)); | 47 return (var - (((unsigned int)avg * avg) >> 4)); |
48 | |
49 } | 48 } |
50 | 49 |
51 unsigned int vp9_variance8x8_mmx( | 50 unsigned int vp9_variance8x8_mmx( |
52 const unsigned char *src_ptr, | 51 const unsigned char *src_ptr, |
53 int source_stride, | 52 int source_stride, |
54 const unsigned char *ref_ptr, | 53 const unsigned char *ref_ptr, |
55 int recon_stride, | 54 int recon_stride, |
56 unsigned int *sse) { | 55 unsigned int *sse) { |
57 unsigned int var; | 56 unsigned int var; |
58 int avg; | 57 int avg; |
59 | 58 |
60 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg); | 59 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &var, &avg); |
61 *sse = var; | 60 *sse = var; |
62 | 61 |
63 return (var - (((unsigned int)avg * avg) >> 6)); | 62 return (var - (((unsigned int)avg * avg) >> 6)); |
64 | |
65 } | 63 } |
66 | 64 |
67 unsigned int vp9_mse16x16_mmx( | 65 unsigned int vp9_mse16x16_mmx( |
68 const unsigned char *src_ptr, | 66 const unsigned char *src_ptr, |
69 int source_stride, | 67 int source_stride, |
70 const unsigned char *ref_ptr, | 68 const unsigned char *ref_ptr, |
71 int recon_stride, | 69 int recon_stride, |
72 unsigned int *sse) { | 70 unsigned int *sse) { |
73 unsigned int sse0, sse1, sse2, sse3, var; | 71 unsigned int sse0, sse1, sse2, sse3, var; |
74 int sum0, sum1, sum2, sum3; | 72 int sum0, sum1, sum2, sum3; |
75 | 73 |
76 | 74 |
77 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0)
; | 75 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, |
78 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1
, &sum1); | 76 &sum0); |
79 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * re
con_stride, recon_stride, &sse2, &sum2); | 77 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, |
80 vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, ref_ptr + 8
* recon_stride + 8, recon_stride, &sse3, &sum3); | 78 &sse1, &sum1); |
| 79 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, |
| 80 ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2); |
| 81 vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, |
| 82 ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3); |
81 | 83 |
82 var = sse0 + sse1 + sse2 + sse3; | 84 var = sse0 + sse1 + sse2 + sse3; |
83 *sse = var; | 85 *sse = var; |
84 return var; | 86 return var; |
85 } | 87 } |
86 | 88 |
87 | 89 |
88 unsigned int vp9_variance16x16_mmx( | 90 unsigned int vp9_variance16x16_mmx( |
89 const unsigned char *src_ptr, | 91 const unsigned char *src_ptr, |
90 int source_stride, | 92 int source_stride, |
91 const unsigned char *ref_ptr, | 93 const unsigned char *ref_ptr, |
92 int recon_stride, | 94 int recon_stride, |
93 unsigned int *sse) { | 95 unsigned int *sse) { |
94 unsigned int sse0, sse1, sse2, sse3, var; | 96 unsigned int sse0, sse1, sse2, sse3, var; |
95 int sum0, sum1, sum2, sum3, avg; | 97 int sum0, sum1, sum2, sum3, avg; |
96 | 98 |
97 | 99 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, |
98 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0)
; | 100 &sum0); |
99 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1
, &sum1); | 101 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, |
100 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * re
con_stride, recon_stride, &sse2, &sum2); | 102 &sse1, &sum1); |
101 vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, ref_ptr + 8
* recon_stride + 8, recon_stride, &sse3, &sum3); | 103 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, |
| 104 ref_ptr + 8 * recon_stride, recon_stride, &sse2, &sum2); |
| 105 vp9_get8x8var_mmx(src_ptr + 8 * source_stride + 8, source_stride, |
| 106 ref_ptr + 8 * recon_stride + 8, recon_stride, &sse3, &sum3); |
102 | 107 |
103 var = sse0 + sse1 + sse2 + sse3; | 108 var = sse0 + sse1 + sse2 + sse3; |
104 avg = sum0 + sum1 + sum2 + sum3; | 109 avg = sum0 + sum1 + sum2 + sum3; |
105 *sse = var; | 110 *sse = var; |
106 return (var - (((unsigned int)avg * avg) >> 8)); | 111 return (var - (((unsigned int)avg * avg) >> 8)); |
107 } | 112 } |
108 | 113 |
109 unsigned int vp9_variance16x8_mmx( | 114 unsigned int vp9_variance16x8_mmx( |
110 const unsigned char *src_ptr, | 115 const unsigned char *src_ptr, |
111 int source_stride, | 116 int source_stride, |
112 const unsigned char *ref_ptr, | 117 const unsigned char *ref_ptr, |
113 int recon_stride, | 118 int recon_stride, |
114 unsigned int *sse) { | 119 unsigned int *sse) { |
115 unsigned int sse0, sse1, var; | 120 unsigned int sse0, sse1, var; |
116 int sum0, sum1, avg; | 121 int sum0, sum1, avg; |
117 | 122 |
118 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0)
; | 123 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, |
119 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, &sse1
, &sum1); | 124 &sum0); |
| 125 vp9_get8x8var_mmx(src_ptr + 8, source_stride, ref_ptr + 8, recon_stride, |
| 126 &sse1, &sum1); |
120 | 127 |
121 var = sse0 + sse1; | 128 var = sse0 + sse1; |
122 avg = sum0 + sum1; | 129 avg = sum0 + sum1; |
123 *sse = var; | 130 *sse = var; |
124 return (var - (((unsigned int)avg * avg) >> 7)); | 131 return (var - (((unsigned int)avg * avg) >> 7)); |
125 | |
126 } | 132 } |
127 | 133 |
128 | 134 |
129 unsigned int vp9_variance8x16_mmx( | 135 unsigned int vp9_variance8x16_mmx( |
130 const unsigned char *src_ptr, | 136 const unsigned char *src_ptr, |
131 int source_stride, | 137 int source_stride, |
132 const unsigned char *ref_ptr, | 138 const unsigned char *ref_ptr, |
133 int recon_stride, | 139 int recon_stride, |
134 unsigned int *sse) { | 140 unsigned int *sse) { |
135 unsigned int sse0, sse1, var; | 141 unsigned int sse0, sse1, var; |
136 int sum0, sum1, avg; | 142 int sum0, sum1, avg; |
137 | 143 |
138 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, &sum0)
; | 144 vp9_get8x8var_mmx(src_ptr, source_stride, ref_ptr, recon_stride, &sse0, |
139 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, ref_ptr + 8 * re
con_stride, recon_stride, &sse1, &sum1); | 145 &sum0); |
| 146 vp9_get8x8var_mmx(src_ptr + 8 * source_stride, source_stride, |
| 147 ref_ptr + 8 * recon_stride, recon_stride, &sse1, &sum1); |
140 | 148 |
141 var = sse0 + sse1; | 149 var = sse0 + sse1; |
142 avg = sum0 + sum1; | 150 avg = sum0 + sum1; |
143 *sse = var; | 151 *sse = var; |
144 | 152 |
145 return (var - (((unsigned int)avg * avg) >> 7)); | 153 return (var - (((unsigned int)avg * avg) >> 7)); |
146 | |
147 } | 154 } |
OLD | NEW |