Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_sad.c

Issue 592203002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_rdopt.c ('k') | source/libvpx/vp9/encoder/vp9_segmentation.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12
13 #include "./vp9_rtcd.h" 13 #include "./vp9_rtcd.h"
14 #include "./vpx_config.h" 14 #include "./vpx_config.h"
15 15
16 #include "vpx/vpx_integer.h" 16 #include "vpx/vpx_integer.h"
17 #if CONFIG_VP9_HIGHBITDEPTH
18 #include "vp9/common/vp9_common.h"
19 #endif
17 #include "vp9/encoder/vp9_variance.h" 20 #include "vp9/encoder/vp9_variance.h"
18 21
19 static INLINE unsigned int sad(const uint8_t *a, int a_stride, 22 static INLINE unsigned int sad(const uint8_t *a, int a_stride,
20 const uint8_t *b, int b_stride, 23 const uint8_t *b, int b_stride,
21 int width, int height) { 24 int width, int height) {
22 int y, x; 25 int y, x;
23 unsigned int sad = 0; 26 unsigned int sad = 0;
24 27
25 for (y = 0; y < height; y++) { 28 for (y = 0; y < height; y++) {
26 for (x = 0; x < width; x++) 29 for (x = 0; x < width; x++)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // 4x8 127 // 4x8
125 sadMxN(4, 8) 128 sadMxN(4, 8)
126 sadMxNxK(4, 8, 8) 129 sadMxNxK(4, 8, 8)
127 sadMxNx4D(4, 8) 130 sadMxNx4D(4, 8)
128 131
129 // 4x4 132 // 4x4
130 sadMxN(4, 4) 133 sadMxN(4, 4)
131 sadMxNxK(4, 4, 3) 134 sadMxNxK(4, 4, 3)
132 sadMxNxK(4, 4, 8) 135 sadMxNxK(4, 4, 8)
133 sadMxNx4D(4, 4) 136 sadMxNx4D(4, 4)
137
138 #if CONFIG_VP9_HIGHBITDEPTH
139 static INLINE unsigned int high_sad(const uint8_t *a8, int a_stride,
140 const uint8_t *b8, int b_stride,
141 int width, int height) {
142 int y, x;
143 unsigned int sad = 0;
144 const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
145 const uint16_t *b = CONVERT_TO_SHORTPTR(b8);
146 for (y = 0; y < height; y++) {
147 for (x = 0; x < width; x++)
148 sad += abs(a[x] - b[x]);
149
150 a += a_stride;
151 b += b_stride;
152 }
153 return sad;
154 }
155
156 static INLINE unsigned int high_sadb(const uint8_t *a8, int a_stride,
157 const uint16_t *b, int b_stride,
158 int width, int height) {
159 int y, x;
160 unsigned int sad = 0;
161 const uint16_t *a = CONVERT_TO_SHORTPTR(a8);
162 for (y = 0; y < height; y++) {
163 for (x = 0; x < width; x++)
164 sad += abs(a[x] - b[x]);
165
166 a += a_stride;
167 b += b_stride;
168 }
169 return sad;
170 }
171
172 #define high_sadMxN(m, n) \
173 unsigned int vp9_high_sad##m##x##n##_c(const uint8_t *src, int src_stride, \
174 const uint8_t *ref, int ref_stride) { \
175 return high_sad(src, src_stride, ref, ref_stride, m, n); \
176 } \
177 unsigned int vp9_high_sad##m##x##n##_avg_c(const uint8_t *src, int src_stride, \
178 const uint8_t *ref, int ref_stride, \
179 const uint8_t *second_pred) { \
180 uint16_t comp_pred[m * n]; \
181 vp9_high_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 }
184
185 #define high_sadMxNxK(m, n, k) \
186 void vp9_high_sad##m##x##n##x##k##_c(const uint8_t *src, int src_stride, \
187 const uint8_t *ref, int ref_stride, \
188 unsigned int *sads) { \
189 int i; \
190 for (i = 0; i < k; ++i) \
191 sads[i] = vp9_high_sad##m##x##n##_c(src, src_stride, &ref[i], ref_stride); \
192 }
193
194 #define high_sadMxNx4D(m, n) \
195 void vp9_high_sad##m##x##n##x4d_c(const uint8_t *src, int src_stride, \
196 const uint8_t *const refs[], \
197 int ref_stride, unsigned int *sads) { \
198 int i; \
199 for (i = 0; i < 4; ++i) \
200 sads[i] = vp9_high_sad##m##x##n##_c(src, src_stride, refs[i], ref_stride); \
201 }
202
203 // 64x64
204 high_sadMxN(64, 64)
205 high_sadMxNxK(64, 64, 3)
206 high_sadMxNxK(64, 64, 8)
207 high_sadMxNx4D(64, 64)
208
209 // 64x32
210 high_sadMxN(64, 32)
211 high_sadMxNx4D(64, 32)
212
213 // 32x64
214 high_sadMxN(32, 64)
215 high_sadMxNx4D(32, 64)
216
217 // 32x32
218 high_sadMxN(32, 32)
219 high_sadMxNxK(32, 32, 3)
220 high_sadMxNxK(32, 32, 8)
221 high_sadMxNx4D(32, 32)
222
223 // 32x16
224 high_sadMxN(32, 16)
225 high_sadMxNx4D(32, 16)
226
227 // 16x32
228 high_sadMxN(16, 32)
229 high_sadMxNx4D(16, 32)
230
231 // 16x16
232 high_sadMxN(16, 16)
233 high_sadMxNxK(16, 16, 3)
234 high_sadMxNxK(16, 16, 8)
235 high_sadMxNx4D(16, 16)
236
237 // 16x8
238 high_sadMxN(16, 8)
239 high_sadMxNxK(16, 8, 3)
240 high_sadMxNxK(16, 8, 8)
241 high_sadMxNx4D(16, 8)
242
243 // 8x16
244 high_sadMxN(8, 16)
245 high_sadMxNxK(8, 16, 3)
246 high_sadMxNxK(8, 16, 8)
247 high_sadMxNx4D(8, 16)
248
249 // 8x8
250 high_sadMxN(8, 8)
251 high_sadMxNxK(8, 8, 3)
252 high_sadMxNxK(8, 8, 8)
253 high_sadMxNx4D(8, 8)
254
255 // 8x4
256 high_sadMxN(8, 4)
257 high_sadMxNxK(8, 4, 8)
258 high_sadMxNx4D(8, 4)
259
260 // 4x8
261 high_sadMxN(4, 8)
262 high_sadMxNxK(4, 8, 8)
263 high_sadMxNx4D(4, 8)
264
265 // 4x4
266 high_sadMxN(4, 4)
267 high_sadMxNxK(4, 4, 3)
268 high_sadMxNxK(4, 4, 8)
269 high_sadMxNx4D(4, 4)
270
271 #endif // CONFIG_VP9_HIGHBITDEPTH
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_rdopt.c ('k') | source/libvpx/vp9/encoder/vp9_segmentation.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698