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

Side by Side Diff: source/libvpx/vpx_dsp/x86/variance_avx2.c

Issue 1162573005: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « source/libvpx/vpx_dsp/x86/sad_avx2.c ('k') | source/libvpx/vpx_dsp/x86/variance_impl_avx2.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 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_dsp_rtcd.h"
11
12 typedef void (*get_var_avx2)(const uint8_t *src, int src_stride,
13 const uint8_t *ref, int ref_stride,
14 unsigned int *sse, int *sum);
15
16 void vpx_get32x32var_avx2(const uint8_t *src, int src_stride,
17 const uint8_t *ref, int ref_stride,
18 unsigned int *sse, int *sum);
19
20 static void variance_avx2(const uint8_t *src, int src_stride,
21 const uint8_t *ref, int ref_stride,
22 int w, int h, unsigned int *sse, int *sum,
23 get_var_avx2 var_fn, int block_size) {
24 int i, j;
25
26 *sse = 0;
27 *sum = 0;
28
29 for (i = 0; i < h; i += 16) {
30 for (j = 0; j < w; j += block_size) {
31 unsigned int sse0;
32 int sum0;
33 var_fn(&src[src_stride * i + j], src_stride,
34 &ref[ref_stride * i + j], ref_stride, &sse0, &sum0);
35 *sse += sse0;
36 *sum += sum0;
37 }
38 }
39 }
40
41
42 unsigned int vpx_variance16x16_avx2(const uint8_t *src, int src_stride,
43 const uint8_t *ref, int ref_stride,
44 unsigned int *sse) {
45 int sum;
46 variance_avx2(src, src_stride, ref, ref_stride, 16, 16,
47 sse, &sum, vpx_get16x16var_avx2, 16);
48 return *sse - (((unsigned int)sum * sum) >> 8);
49 }
50
51 unsigned int vpx_mse16x16_avx2(const uint8_t *src, int src_stride,
52 const uint8_t *ref, int ref_stride,
53 unsigned int *sse) {
54 int sum;
55 vpx_get16x16var_avx2(src, src_stride, ref, ref_stride, sse, &sum);
56 return *sse;
57 }
58
59 unsigned int vpx_variance32x16_avx2(const uint8_t *src, int src_stride,
60 const uint8_t *ref, int ref_stride,
61 unsigned int *sse) {
62 int sum;
63 variance_avx2(src, src_stride, ref, ref_stride, 32, 16,
64 sse, &sum, vpx_get32x32var_avx2, 32);
65 return *sse - (((int64_t)sum * sum) >> 9);
66 }
67
68 unsigned int vpx_variance32x32_avx2(const uint8_t *src, int src_stride,
69 const uint8_t *ref, int ref_stride,
70 unsigned int *sse) {
71 int sum;
72 variance_avx2(src, src_stride, ref, ref_stride, 32, 32,
73 sse, &sum, vpx_get32x32var_avx2, 32);
74 return *sse - (((int64_t)sum * sum) >> 10);
75 }
76
77 unsigned int vpx_variance64x64_avx2(const uint8_t *src, int src_stride,
78 const uint8_t *ref, int ref_stride,
79 unsigned int *sse) {
80 int sum;
81 variance_avx2(src, src_stride, ref, ref_stride, 64, 64,
82 sse, &sum, vpx_get32x32var_avx2, 32);
83 return *sse - (((int64_t)sum * sum) >> 12);
84 }
85
86 unsigned int vpx_variance64x32_avx2(const uint8_t *src, int src_stride,
87 const uint8_t *ref, int ref_stride,
88 unsigned int *sse) {
89 int sum;
90 variance_avx2(src, src_stride, ref, ref_stride, 64, 32,
91 sse, &sum, vpx_get32x32var_avx2, 32);
92 return *sse - (((int64_t)sum * sum) >> 11);
93 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx_dsp/x86/sad_avx2.c ('k') | source/libvpx/vpx_dsp/x86/variance_impl_avx2.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698