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

Side by Side Diff: source/libvpx/vp9/encoder/x86/vp9_highbd_variance_sse2.c

Issue 756673003: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years 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
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 *
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 */
10 #include "./vpx_config.h"
11 #include "vp9/common/vp9_common.h"
12
13 #include "vp9/encoder/vp9_variance.h"
14 #include "vpx_ports/mem.h"
15
16 typedef uint32_t (*high_variance_fn_t) (const uint16_t *src, int src_stride,
17 const uint16_t *ref, int ref_stride,
18 uint32_t *sse, int *sum);
19
20 uint32_t vp9_highbd_calc8x8var_sse2(const uint16_t *src, int src_stride,
21 const uint16_t *ref, int ref_stride,
22 uint32_t *sse, int *sum);
23
24 uint32_t vp9_highbd_calc16x16var_sse2(const uint16_t *src, int src_stride,
25 const uint16_t *ref, int ref_stride,
26 uint32_t *sse, int *sum);
27
28 static void highbd_variance_sse2(const uint16_t *src, int src_stride,
29 const uint16_t *ref, int ref_stride,
30 int w, int h, uint32_t *sse, int *sum,
31 high_variance_fn_t var_fn, int block_size) {
32 int i, j;
33
34 *sse = 0;
35 *sum = 0;
36
37 for (i = 0; i < h; i += block_size) {
38 for (j = 0; j < w; j += block_size) {
39 unsigned int sse0;
40 int sum0;
41 var_fn(src + src_stride * i + j, src_stride,
42 ref + ref_stride * i + j, ref_stride, &sse0, &sum0);
43 *sse += sse0;
44 *sum += sum0;
45 }
46 }
47 }
48
49 static void highbd_10_variance_sse2(const uint16_t *src, int src_stride,
50 const uint16_t *ref, int ref_stride,
51 int w, int h, uint32_t *sse, int *sum,
52 high_variance_fn_t var_fn, int block_size) {
53 int i, j;
54 uint64_t sse_long = 0;
55 int64_t sum_long = 0;
56
57 for (i = 0; i < h; i += block_size) {
58 for (j = 0; j < w; j += block_size) {
59 unsigned int sse0;
60 int sum0;
61 var_fn(src + src_stride * i + j, src_stride,
62 ref + ref_stride * i + j, ref_stride, &sse0, &sum0);
63 sse_long += sse0;
64 sum_long += sum0;
65 }
66 }
67 *sum = ROUND_POWER_OF_TWO(sum_long, 2);
68 *sse = ROUND_POWER_OF_TWO(sse_long, 4);
69 }
70
71 static void highbd_12_variance_sse2(const uint16_t *src, int src_stride,
72 const uint16_t *ref, int ref_stride,
73 int w, int h, uint32_t *sse, int *sum,
74 high_variance_fn_t var_fn, int block_size) {
75 int i, j;
76 uint64_t sse_long = 0;
77 int64_t sum_long = 0;
78
79 for (i = 0; i < h; i += block_size) {
80 for (j = 0; j < w; j += block_size) {
81 unsigned int sse0;
82 int sum0;
83 var_fn(src + src_stride * i + j, src_stride,
84 ref + ref_stride * i + j, ref_stride, &sse0, &sum0);
85 sse_long += sse0;
86 sum_long += sum0;
87 }
88 }
89 *sum = ROUND_POWER_OF_TWO(sum_long, 4);
90 *sse = ROUND_POWER_OF_TWO(sse_long, 8);
91 }
92
93
94 #define HIGH_GET_VAR(S) \
95 void vp9_highbd_get##S##x##S##var_sse2(const uint8_t *src8, int src_stride, \
96 const uint8_t *ref8, int ref_stride, \
97 uint32_t *sse, int *sum) { \
98 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
99 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
100 vp9_highbd_calc##S##x##S##var_sse2(src, src_stride, ref, ref_stride, \
101 sse, sum); \
102 } \
103 \
104 void vp9_highbd_10_get##S##x##S##var_sse2(const uint8_t *src8, int src_stride, \
105 const uint8_t *ref8, int ref_stride, \
106 uint32_t *sse, int *sum) { \
107 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
108 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
109 vp9_highbd_calc##S##x##S##var_sse2(src, src_stride, ref, ref_stride, \
110 sse, sum); \
111 *sum = ROUND_POWER_OF_TWO(*sum, 2); \
112 *sse = ROUND_POWER_OF_TWO(*sse, 4); \
113 } \
114 \
115 void vp9_highbd_12_get##S##x##S##var_sse2(const uint8_t *src8, int src_stride, \
116 const uint8_t *ref8, int ref_stride, \
117 uint32_t *sse, int *sum) { \
118 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
119 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
120 vp9_highbd_calc##S##x##S##var_sse2(src, src_stride, ref, ref_stride, \
121 sse, sum); \
122 *sum = ROUND_POWER_OF_TWO(*sum, 4); \
123 *sse = ROUND_POWER_OF_TWO(*sse, 8); \
124 }
125
126 HIGH_GET_VAR(16);
127 HIGH_GET_VAR(8);
128
129 #undef HIGH_GET_VAR
130
131 #define VAR_FN(w, h, block_size, shift) \
132 uint32_t vp9_highbd_variance##w##x##h##_sse2( \
133 const uint8_t *src8, int src_stride, \
134 const uint8_t *ref8, int ref_stride, uint32_t *sse) { \
135 int sum; \
136 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
137 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
138 highbd_variance_sse2(src, src_stride, ref, ref_stride, w, h, sse, &sum, \
139 vp9_highbd_calc##block_size##x##block_size##var_sse2, \
140 block_size); \
141 return *sse - (((int64_t)sum * sum) >> shift); \
142 } \
143 \
144 uint32_t vp9_highbd_10_variance##w##x##h##_sse2( \
145 const uint8_t *src8, int src_stride, \
146 const uint8_t *ref8, int ref_stride, uint32_t *sse) { \
147 int sum; \
148 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
149 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
150 highbd_10_variance_sse2( \
151 src, src_stride, ref, ref_stride, w, h, sse, &sum, \
152 vp9_highbd_calc##block_size##x##block_size##var_sse2, block_size); \
153 return *sse - (((int64_t)sum * sum) >> shift); \
154 } \
155 \
156 uint32_t vp9_highbd_12_variance##w##x##h##_sse2( \
157 const uint8_t *src8, int src_stride, \
158 const uint8_t *ref8, int ref_stride, uint32_t *sse) { \
159 int sum; \
160 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
161 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8); \
162 highbd_12_variance_sse2( \
163 src, src_stride, ref, ref_stride, w, h, sse, &sum, \
164 vp9_highbd_calc##block_size##x##block_size##var_sse2, block_size); \
165 return *sse - (((int64_t)sum * sum) >> shift); \
166 }
167
168 VAR_FN(64, 64, 16, 12);
169 VAR_FN(64, 32, 16, 11);
170 VAR_FN(32, 64, 16, 11);
171 VAR_FN(32, 32, 16, 10);
172 VAR_FN(32, 16, 16, 9);
173 VAR_FN(16, 32, 16, 9);
174 VAR_FN(16, 16, 16, 8);
175 VAR_FN(16, 8, 8, 7);
176 VAR_FN(8, 16, 8, 7);
177 VAR_FN(8, 8, 8, 6);
178
179 #undef VAR_FN
180
181 unsigned int vp9_highbd_mse16x16_sse2(const uint8_t *src8, int src_stride,
182 const uint8_t *ref8, int ref_stride,
183 unsigned int *sse) {
184 int sum;
185 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
186 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
187 highbd_variance_sse2(src, src_stride, ref, ref_stride, 16, 16,
188 sse, &sum, vp9_highbd_calc16x16var_sse2, 16);
189 return *sse;
190 }
191
192 unsigned int vp9_highbd_10_mse16x16_sse2(const uint8_t *src8, int src_stride,
193 const uint8_t *ref8, int ref_stride,
194 unsigned int *sse) {
195 int sum;
196 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
197 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
198 highbd_10_variance_sse2(src, src_stride, ref, ref_stride, 16, 16,
199 sse, &sum, vp9_highbd_calc16x16var_sse2, 16);
200 return *sse;
201 }
202
203 unsigned int vp9_highbd_12_mse16x16_sse2(const uint8_t *src8, int src_stride,
204 const uint8_t *ref8, int ref_stride,
205 unsigned int *sse) {
206 int sum;
207 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
208 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
209 highbd_12_variance_sse2(src, src_stride, ref, ref_stride, 16, 16,
210 sse, &sum, vp9_highbd_calc16x16var_sse2, 16);
211 return *sse;
212 }
213
214 unsigned int vp9_highbd_mse8x8_sse2(const uint8_t *src8, int src_stride,
215 const uint8_t *ref8, int ref_stride,
216 unsigned int *sse) {
217 int sum;
218 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
219 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
220 highbd_variance_sse2(src, src_stride, ref, ref_stride, 8, 8,
221 sse, &sum, vp9_highbd_calc8x8var_sse2, 8);
222 return *sse;
223 }
224
225 unsigned int vp9_highbd_10_mse8x8_sse2(const uint8_t *src8, int src_stride,
226 const uint8_t *ref8, int ref_stride,
227 unsigned int *sse) {
228 int sum;
229 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
230 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
231 highbd_10_variance_sse2(src, src_stride, ref, ref_stride, 8, 8,
232 sse, &sum, vp9_highbd_calc8x8var_sse2, 8);
233 return *sse;
234 }
235
236 unsigned int vp9_highbd_12_mse8x8_sse2(const uint8_t *src8, int src_stride,
237 const uint8_t *ref8, int ref_stride,
238 unsigned int *sse) {
239 int sum;
240 uint16_t *src = CONVERT_TO_SHORTPTR(src8);
241 uint16_t *ref = CONVERT_TO_SHORTPTR(ref8);
242 highbd_12_variance_sse2(src, src_stride, ref, ref_stride, 8, 8,
243 sse, &sum, vp9_highbd_calc8x8var_sse2, 8);
244 return *sse;
245 }
246
247 #define DECL(w, opt) \
248 int vp9_highbd_sub_pixel_variance##w##xh_##opt(const uint16_t *src, \
249 ptrdiff_t src_stride, \
250 int x_offset, int y_offset, \
251 const uint16_t *dst, \
252 ptrdiff_t dst_stride, \
253 int height, unsigned int *sse);
254 #define DECLS(opt1, opt2) \
255 DECL(8, opt1); \
256 DECL(16, opt1)
257
258 DECLS(sse2, sse);
259 // DECLS(ssse3, ssse3);
260 #undef DECLS
261 #undef DECL
262
263 #define FN(w, h, wf, wlog2, hlog2, opt, cast) \
264 uint32_t vp9_highbd_sub_pixel_variance##w##x##h##_##opt(const uint8_t *src8, \
265 int src_stride, \
266 int x_offset, \
267 int y_offset, \
268 const uint8_t *dst8, \
269 int dst_stride, \
270 uint32_t *sse_ptr) { \
271 uint32_t sse; \
272 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
273 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
274 int se = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src, src_stride, \
275 x_offset, y_offset, \
276 dst, dst_stride, h, \
277 &sse); \
278 if (w > wf) { \
279 unsigned int sse2; \
280 int se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src + 16, \
281 src_stride, \
282 x_offset, y_offset, \
283 dst + 16, \
284 dst_stride, \
285 h, &sse2); \
286 se += se2; \
287 sse += sse2; \
288 if (w > wf * 2) { \
289 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src + 32, src_stride, \
290 x_offset, y_offset, \
291 dst + 32, dst_stride, \
292 h, &sse2); \
293 se += se2; \
294 sse += sse2; \
295 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt( \
296 src + 48, src_stride, x_offset, y_offset, \
297 dst + 48, dst_stride, h, &sse2); \
298 se += se2; \
299 sse += sse2; \
300 } \
301 } \
302 *sse_ptr = sse; \
303 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
304 } \
305 \
306 uint32_t vp9_highbd_10_sub_pixel_variance##w##x##h##_##opt( \
307 const uint8_t *src8, int src_stride, int x_offset, int y_offset, \
308 const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr) { \
309 uint32_t sse; \
310 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
311 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
312 int se = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src, src_stride, \
313 x_offset, y_offset, \
314 dst, dst_stride, \
315 h, &sse); \
316 if (w > wf) { \
317 uint32_t sse2; \
318 int se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src + 16, \
319 src_stride, \
320 x_offset, y_offset, \
321 dst + 16, \
322 dst_stride, \
323 h, &sse2); \
324 se += se2; \
325 sse += sse2; \
326 if (w > wf * 2) { \
327 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src + 32, src_stride, \
328 x_offset, y_offset, \
329 dst + 32, dst_stride, \
330 h, &sse2); \
331 se += se2; \
332 sse += sse2; \
333 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt(src + 48, src_stride, \
334 x_offset, y_offset, \
335 dst + 48, dst_stride, \
336 h, &sse2); \
337 se += se2; \
338 sse += sse2; \
339 } \
340 } \
341 se = ROUND_POWER_OF_TWO(se, 2); \
342 sse = ROUND_POWER_OF_TWO(sse, 4); \
343 *sse_ptr = sse; \
344 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
345 } \
346 \
347 uint32_t vp9_highbd_12_sub_pixel_variance##w##x##h##_##opt( \
348 const uint8_t *src8, int src_stride, int x_offset, int y_offset, \
349 const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr) { \
350 int start_row; \
351 uint32_t sse; \
352 int se = 0; \
353 uint64_t long_sse = 0; \
354 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
355 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
356 for (start_row = 0; start_row < h; start_row +=16) { \
357 uint32_t sse2; \
358 int height = h - start_row < 16 ? h - start_row : 16; \
359 int se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt( \
360 src + (start_row * src_stride), src_stride, \
361 x_offset, y_offset, dst + (start_row * dst_stride), \
362 dst_stride, height, &sse2); \
363 se += se2; \
364 long_sse += sse2; \
365 if (w > wf) { \
366 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt( \
367 src + 16 + (start_row * src_stride), src_stride, \
368 x_offset, y_offset, dst + 16 + (start_row * dst_stride), \
369 dst_stride, height, &sse2); \
370 se += se2; \
371 long_sse += sse2; \
372 if (w > wf * 2) { \
373 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt( \
374 src + 32 + (start_row * src_stride), src_stride, \
375 x_offset, y_offset, dst + 32 + (start_row * dst_stride), \
376 dst_stride, height, &sse2); \
377 se += se2; \
378 long_sse += sse2; \
379 se2 = vp9_highbd_sub_pixel_variance##wf##xh_##opt( \
380 src + 48 + (start_row * src_stride), src_stride, \
381 x_offset, y_offset, dst + 48 + (start_row * dst_stride), \
382 dst_stride, height, &sse2); \
383 se += se2; \
384 long_sse += sse2; \
385 }\
386 } \
387 } \
388 se = ROUND_POWER_OF_TWO(se, 4); \
389 sse = ROUND_POWER_OF_TWO(long_sse, 8); \
390 *sse_ptr = sse; \
391 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
392 }
393
394 #define FNS(opt1, opt2) \
395 FN(64, 64, 16, 6, 6, opt1, (int64_t)); \
396 FN(64, 32, 16, 6, 5, opt1, (int64_t)); \
397 FN(32, 64, 16, 5, 6, opt1, (int64_t)); \
398 FN(32, 32, 16, 5, 5, opt1, (int64_t)); \
399 FN(32, 16, 16, 5, 4, opt1, (int64_t)); \
400 FN(16, 32, 16, 4, 5, opt1, (int64_t)); \
401 FN(16, 16, 16, 4, 4, opt1, (int64_t)); \
402 FN(16, 8, 16, 4, 3, opt1, (int64_t)); \
403 FN(8, 16, 8, 3, 4, opt1, (int64_t)); \
404 FN(8, 8, 8, 3, 3, opt1, (int64_t)); \
405 FN(8, 4, 8, 3, 2, opt1, (int64_t));
406
407
408 FNS(sse2, sse);
409
410 #undef FNS
411 #undef FN
412
413 #define DECL(w, opt) \
414 int vp9_highbd_sub_pixel_avg_variance##w##xh_##opt(const uint16_t *src, \
415 ptrdiff_t src_stride, \
416 int x_offset, int y_offset, \
417 const uint16_t *dst, \
418 ptrdiff_t dst_stride, \
419 const uint16_t *sec, \
420 ptrdiff_t sec_stride, \
421 int height, \
422 unsigned int *sse);
423 #define DECLS(opt1) \
424 DECL(16, opt1) \
425 DECL(8, opt1)
426
427 DECLS(sse2);
428 #undef DECL
429 #undef DECLS
430
431 #define FN(w, h, wf, wlog2, hlog2, opt, cast) \
432 uint32_t vp9_highbd_sub_pixel_avg_variance##w##x##h##_##opt( \
433 const uint8_t *src8, int src_stride, int x_offset, int y_offset, \
434 const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr, \
435 const uint8_t *sec8) { \
436 uint32_t sse; \
437 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
438 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
439 uint16_t *sec = CONVERT_TO_SHORTPTR(sec8); \
440 int se = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
441 src, src_stride, x_offset, \
442 y_offset, dst, dst_stride, sec, w, h, &sse); \
443 if (w > wf) { \
444 uint32_t sse2; \
445 int se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
446 src + 16, src_stride, x_offset, y_offset, \
447 dst + 16, dst_stride, sec + 16, w, h, &sse2); \
448 se += se2; \
449 sse += sse2; \
450 if (w > wf * 2) { \
451 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
452 src + 32, src_stride, x_offset, y_offset, \
453 dst + 32, dst_stride, sec + 32, w, h, &sse2); \
454 se += se2; \
455 sse += sse2; \
456 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
457 src + 48, src_stride, x_offset, y_offset, \
458 dst + 48, dst_stride, sec + 48, w, h, &sse2); \
459 se += se2; \
460 sse += sse2; \
461 } \
462 } \
463 *sse_ptr = sse; \
464 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
465 } \
466 \
467 uint32_t vp9_highbd_10_sub_pixel_avg_variance##w##x##h##_##opt( \
468 const uint8_t *src8, int src_stride, int x_offset, int y_offset, \
469 const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr, \
470 const uint8_t *sec8) { \
471 uint32_t sse; \
472 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
473 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
474 uint16_t *sec = CONVERT_TO_SHORTPTR(sec8); \
475 int se = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
476 src, src_stride, x_offset, \
477 y_offset, dst, dst_stride, \
478 sec, w, h, &sse); \
479 if (w > wf) { \
480 uint32_t sse2; \
481 int se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
482 src + 16, src_stride, \
483 x_offset, y_offset, \
484 dst + 16, dst_stride, \
485 sec + 16, w, h, &sse2); \
486 se += se2; \
487 sse += sse2; \
488 if (w > wf * 2) { \
489 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
490 src + 32, src_stride, \
491 x_offset, y_offset, \
492 dst + 32, dst_stride, \
493 sec + 32, w, h, &sse2); \
494 se += se2; \
495 sse += sse2; \
496 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
497 src + 48, src_stride, \
498 x_offset, y_offset, \
499 dst + 48, dst_stride, \
500 sec + 48, w, h, &sse2); \
501 se += se2; \
502 sse += sse2; \
503 } \
504 } \
505 se = ROUND_POWER_OF_TWO(se, 2); \
506 sse = ROUND_POWER_OF_TWO(sse, 4); \
507 *sse_ptr = sse; \
508 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
509 } \
510 \
511 uint32_t vp9_highbd_12_sub_pixel_avg_variance##w##x##h##_##opt( \
512 const uint8_t *src8, int src_stride, int x_offset, int y_offset, \
513 const uint8_t *dst8, int dst_stride, uint32_t *sse_ptr, \
514 const uint8_t *sec8) { \
515 int start_row; \
516 uint32_t sse; \
517 int se = 0; \
518 uint64_t long_sse = 0; \
519 uint16_t *src = CONVERT_TO_SHORTPTR(src8); \
520 uint16_t *dst = CONVERT_TO_SHORTPTR(dst8); \
521 uint16_t *sec = CONVERT_TO_SHORTPTR(sec8); \
522 for (start_row = 0; start_row < h; start_row +=16) { \
523 uint32_t sse2; \
524 int height = h - start_row < 16 ? h - start_row : 16; \
525 int se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
526 src + (start_row * src_stride), src_stride, x_offset, \
527 y_offset, dst + (start_row * dst_stride), dst_stride, \
528 sec + (start_row * w), w, height, &sse2); \
529 se += se2; \
530 long_sse += sse2; \
531 if (w > wf) { \
532 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
533 src + 16 + (start_row * src_stride), src_stride, \
534 x_offset, y_offset, \
535 dst + 16 + (start_row * dst_stride), dst_stride, \
536 sec + 16 + (start_row * w), w, height, &sse2); \
537 se += se2; \
538 long_sse += sse2; \
539 if (w > wf * 2) { \
540 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
541 src + 32 + (start_row * src_stride), src_stride, \
542 x_offset, y_offset, \
543 dst + 32 + (start_row * dst_stride), dst_stride, \
544 sec + 32 + (start_row * w), w, height, &sse2); \
545 se += se2; \
546 long_sse += sse2; \
547 se2 = vp9_highbd_sub_pixel_avg_variance##wf##xh_##opt( \
548 src + 48 + (start_row * src_stride), src_stride, \
549 x_offset, y_offset, \
550 dst + 48 + (start_row * dst_stride), dst_stride, \
551 sec + 48 + (start_row * w), w, height, &sse2); \
552 se += se2; \
553 long_sse += sse2; \
554 } \
555 } \
556 } \
557 se = ROUND_POWER_OF_TWO(se, 4); \
558 sse = ROUND_POWER_OF_TWO(long_sse, 8); \
559 *sse_ptr = sse; \
560 return sse - ((cast se * se) >> (wlog2 + hlog2)); \
561 }
562
563
564 #define FNS(opt1) \
565 FN(64, 64, 16, 6, 6, opt1, (int64_t)); \
566 FN(64, 32, 16, 6, 5, opt1, (int64_t)); \
567 FN(32, 64, 16, 5, 6, opt1, (int64_t)); \
568 FN(32, 32, 16, 5, 5, opt1, (int64_t)); \
569 FN(32, 16, 16, 5, 4, opt1, (int64_t)); \
570 FN(16, 32, 16, 4, 5, opt1, (int64_t)); \
571 FN(16, 16, 16, 4, 4, opt1, (int64_t)); \
572 FN(16, 8, 16, 4, 3, opt1, (int64_t)); \
573 FN(8, 16, 8, 4, 3, opt1, (int64_t)); \
574 FN(8, 8, 8, 3, 3, opt1, (int64_t)); \
575 FN(8, 4, 8, 3, 2, opt1, (int64_t));
576
577 FNS(sse2);
578
579 #undef FNS
580 #undef FN
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/x86/vp9_highbd_variance_impl_sse2.asm ('k') | source/libvpx/vp9/encoder/x86/vp9_quantize_sse2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698