xref: /aosp_15_r20/external/libaom/test/error_block_test.cc (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1*77c1e3ccSAndroid Build Coastguard Worker /*
2*77c1e3ccSAndroid Build Coastguard Worker  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
3*77c1e3ccSAndroid Build Coastguard Worker  *
4*77c1e3ccSAndroid Build Coastguard Worker  * This source code is subject to the terms of the BSD 2 Clause License and
5*77c1e3ccSAndroid Build Coastguard Worker  * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6*77c1e3ccSAndroid Build Coastguard Worker  * was not distributed with this source code in the LICENSE file, you can
7*77c1e3ccSAndroid Build Coastguard Worker  * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8*77c1e3ccSAndroid Build Coastguard Worker  * Media Patent License 1.0 was not distributed with this source code in the
9*77c1e3ccSAndroid Build Coastguard Worker  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10*77c1e3ccSAndroid Build Coastguard Worker  */
11*77c1e3ccSAndroid Build Coastguard Worker 
12*77c1e3ccSAndroid Build Coastguard Worker #include <cmath>
13*77c1e3ccSAndroid Build Coastguard Worker #include <cstdlib>
14*77c1e3ccSAndroid Build Coastguard Worker #include <string>
15*77c1e3ccSAndroid Build Coastguard Worker #include <tuple>
16*77c1e3ccSAndroid Build Coastguard Worker 
17*77c1e3ccSAndroid Build Coastguard Worker #include "gtest/gtest.h"
18*77c1e3ccSAndroid Build Coastguard Worker 
19*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_config.h"
20*77c1e3ccSAndroid Build Coastguard Worker #include "config/av1_rtcd.h"
21*77c1e3ccSAndroid Build Coastguard Worker 
22*77c1e3ccSAndroid Build Coastguard Worker #include "test/acm_random.h"
23*77c1e3ccSAndroid Build Coastguard Worker #include "test/register_state_check.h"
24*77c1e3ccSAndroid Build Coastguard Worker #include "test/util.h"
25*77c1e3ccSAndroid Build Coastguard Worker #include "av1/common/entropy.h"
26*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_codec.h"
27*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_integer.h"
28*77c1e3ccSAndroid Build Coastguard Worker 
29*77c1e3ccSAndroid Build Coastguard Worker using libaom_test::ACMRandom;
30*77c1e3ccSAndroid Build Coastguard Worker 
31*77c1e3ccSAndroid Build Coastguard Worker namespace {
32*77c1e3ccSAndroid Build Coastguard Worker const int kNumIterations = 1000;
33*77c1e3ccSAndroid Build Coastguard Worker 
34*77c1e3ccSAndroid Build Coastguard Worker using ErrorBlockFunc = int64_t (*)(const tran_low_t *coeff,
35*77c1e3ccSAndroid Build Coastguard Worker                                    const tran_low_t *dqcoeff,
36*77c1e3ccSAndroid Build Coastguard Worker                                    intptr_t block_size, int64_t *ssz, int bps);
37*77c1e3ccSAndroid Build Coastguard Worker 
38*77c1e3ccSAndroid Build Coastguard Worker using ErrorBlockFunc8Bits = int64_t (*)(const tran_low_t *coeff,
39*77c1e3ccSAndroid Build Coastguard Worker                                         const tran_low_t *dqcoeff,
40*77c1e3ccSAndroid Build Coastguard Worker                                         intptr_t block_size, int64_t *ssz);
41*77c1e3ccSAndroid Build Coastguard Worker 
42*77c1e3ccSAndroid Build Coastguard Worker using ErrorBlockLpFunc = int64_t (*)(const int16_t *coeff,
43*77c1e3ccSAndroid Build Coastguard Worker                                      const int16_t *dqcoeff,
44*77c1e3ccSAndroid Build Coastguard Worker                                      intptr_t block_size);
45*77c1e3ccSAndroid Build Coastguard Worker 
46*77c1e3ccSAndroid Build Coastguard Worker using ErrorBlockParam =
47*77c1e3ccSAndroid Build Coastguard Worker     std::tuple<ErrorBlockFunc, ErrorBlockFunc, aom_bit_depth_t>;
48*77c1e3ccSAndroid Build Coastguard Worker 
49*77c1e3ccSAndroid Build Coastguard Worker template <ErrorBlockFunc8Bits fn>
BlockError8BitWrapper(const tran_low_t * coeff,const tran_low_t * dqcoeff,intptr_t block_size,int64_t * ssz,int bps)50*77c1e3ccSAndroid Build Coastguard Worker int64_t BlockError8BitWrapper(const tran_low_t *coeff,
51*77c1e3ccSAndroid Build Coastguard Worker                               const tran_low_t *dqcoeff, intptr_t block_size,
52*77c1e3ccSAndroid Build Coastguard Worker                               int64_t *ssz, int bps) {
53*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(bps, 8);
54*77c1e3ccSAndroid Build Coastguard Worker   return fn(coeff, dqcoeff, block_size, ssz);
55*77c1e3ccSAndroid Build Coastguard Worker }
56*77c1e3ccSAndroid Build Coastguard Worker 
57*77c1e3ccSAndroid Build Coastguard Worker template <ErrorBlockLpFunc fn>
BlockErrorLpWrapper(const tran_low_t * coeff,const tran_low_t * dqcoeff,intptr_t block_size,int64_t * ssz,int bps)58*77c1e3ccSAndroid Build Coastguard Worker int64_t BlockErrorLpWrapper(const tran_low_t *coeff, const tran_low_t *dqcoeff,
59*77c1e3ccSAndroid Build Coastguard Worker                             intptr_t block_size, int64_t *ssz, int bps) {
60*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(bps, 8);
61*77c1e3ccSAndroid Build Coastguard Worker   *ssz = -1;
62*77c1e3ccSAndroid Build Coastguard Worker   return fn(reinterpret_cast<const int16_t *>(coeff),
63*77c1e3ccSAndroid Build Coastguard Worker             reinterpret_cast<const int16_t *>(dqcoeff), block_size);
64*77c1e3ccSAndroid Build Coastguard Worker }
65*77c1e3ccSAndroid Build Coastguard Worker 
66*77c1e3ccSAndroid Build Coastguard Worker class ErrorBlockTest : public ::testing::TestWithParam<ErrorBlockParam> {
67*77c1e3ccSAndroid Build Coastguard Worker  public:
68*77c1e3ccSAndroid Build Coastguard Worker   ~ErrorBlockTest() override = default;
SetUp()69*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override {
70*77c1e3ccSAndroid Build Coastguard Worker     error_block_op_ = GET_PARAM(0);
71*77c1e3ccSAndroid Build Coastguard Worker     ref_error_block_op_ = GET_PARAM(1);
72*77c1e3ccSAndroid Build Coastguard Worker     bit_depth_ = GET_PARAM(2);
73*77c1e3ccSAndroid Build Coastguard Worker   }
74*77c1e3ccSAndroid Build Coastguard Worker 
75*77c1e3ccSAndroid Build Coastguard Worker  protected:
76*77c1e3ccSAndroid Build Coastguard Worker   aom_bit_depth_t bit_depth_;
77*77c1e3ccSAndroid Build Coastguard Worker   ErrorBlockFunc error_block_op_;
78*77c1e3ccSAndroid Build Coastguard Worker   ErrorBlockFunc ref_error_block_op_;
79*77c1e3ccSAndroid Build Coastguard Worker };
80*77c1e3ccSAndroid Build Coastguard Worker GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ErrorBlockTest);
81*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(ErrorBlockTest,OperationCheck)82*77c1e3ccSAndroid Build Coastguard Worker TEST_P(ErrorBlockTest, OperationCheck) {
83*77c1e3ccSAndroid Build Coastguard Worker   ACMRandom rnd(ACMRandom::DeterministicSeed());
84*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, coeff[4096]);
85*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, dqcoeff[4096]);
86*77c1e3ccSAndroid Build Coastguard Worker   int err_count_total = 0;
87*77c1e3ccSAndroid Build Coastguard Worker   int first_failure = -1;
88*77c1e3ccSAndroid Build Coastguard Worker   intptr_t block_size;
89*77c1e3ccSAndroid Build Coastguard Worker   int64_t ssz;
90*77c1e3ccSAndroid Build Coastguard Worker   int64_t ret;
91*77c1e3ccSAndroid Build Coastguard Worker   int64_t ref_ssz;
92*77c1e3ccSAndroid Build Coastguard Worker   int64_t ref_ret;
93*77c1e3ccSAndroid Build Coastguard Worker   const int msb = bit_depth_ + 8 - 1;
94*77c1e3ccSAndroid Build Coastguard Worker   for (int i = 0; i < kNumIterations; ++i) {
95*77c1e3ccSAndroid Build Coastguard Worker     int err_count = 0;
96*77c1e3ccSAndroid Build Coastguard Worker     block_size = 16 << (i % 9);  // All block sizes from 4x4, 8x4 ..64x64
97*77c1e3ccSAndroid Build Coastguard Worker     for (int j = 0; j < block_size; j++) {
98*77c1e3ccSAndroid Build Coastguard Worker       // coeff and dqcoeff will always have at least the same sign, and this
99*77c1e3ccSAndroid Build Coastguard Worker       // can be used for optimization, so generate test input precisely.
100*77c1e3ccSAndroid Build Coastguard Worker       if (rnd(2)) {
101*77c1e3ccSAndroid Build Coastguard Worker         // Positive number
102*77c1e3ccSAndroid Build Coastguard Worker         coeff[j] = rnd(1 << msb);
103*77c1e3ccSAndroid Build Coastguard Worker         dqcoeff[j] = rnd(1 << msb);
104*77c1e3ccSAndroid Build Coastguard Worker       } else {
105*77c1e3ccSAndroid Build Coastguard Worker         // Negative number
106*77c1e3ccSAndroid Build Coastguard Worker         coeff[j] = -rnd(1 << msb);
107*77c1e3ccSAndroid Build Coastguard Worker         dqcoeff[j] = -rnd(1 << msb);
108*77c1e3ccSAndroid Build Coastguard Worker       }
109*77c1e3ccSAndroid Build Coastguard Worker     }
110*77c1e3ccSAndroid Build Coastguard Worker     ref_ret =
111*77c1e3ccSAndroid Build Coastguard Worker         ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
112*77c1e3ccSAndroid Build Coastguard Worker     API_REGISTER_STATE_CHECK(
113*77c1e3ccSAndroid Build Coastguard Worker         ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
114*77c1e3ccSAndroid Build Coastguard Worker     err_count += (ref_ret != ret) | (ref_ssz != ssz);
115*77c1e3ccSAndroid Build Coastguard Worker     if (err_count && !err_count_total) {
116*77c1e3ccSAndroid Build Coastguard Worker       first_failure = i;
117*77c1e3ccSAndroid Build Coastguard Worker     }
118*77c1e3ccSAndroid Build Coastguard Worker     err_count_total += err_count;
119*77c1e3ccSAndroid Build Coastguard Worker   }
120*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(0, err_count_total)
121*77c1e3ccSAndroid Build Coastguard Worker       << "Error: Error Block Test, C output doesn't match optimized output. "
122*77c1e3ccSAndroid Build Coastguard Worker       << "First failed at test case " << first_failure;
123*77c1e3ccSAndroid Build Coastguard Worker }
124*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(ErrorBlockTest,ExtremeValues)125*77c1e3ccSAndroid Build Coastguard Worker TEST_P(ErrorBlockTest, ExtremeValues) {
126*77c1e3ccSAndroid Build Coastguard Worker   ACMRandom rnd(ACMRandom::DeterministicSeed());
127*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, coeff[4096]);
128*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, dqcoeff[4096]);
129*77c1e3ccSAndroid Build Coastguard Worker   int err_count_total = 0;
130*77c1e3ccSAndroid Build Coastguard Worker   int first_failure = -1;
131*77c1e3ccSAndroid Build Coastguard Worker   intptr_t block_size;
132*77c1e3ccSAndroid Build Coastguard Worker   int64_t ssz;
133*77c1e3ccSAndroid Build Coastguard Worker   int64_t ret;
134*77c1e3ccSAndroid Build Coastguard Worker   int64_t ref_ssz;
135*77c1e3ccSAndroid Build Coastguard Worker   int64_t ref_ret;
136*77c1e3ccSAndroid Build Coastguard Worker   const int msb = bit_depth_ + 8 - 1;
137*77c1e3ccSAndroid Build Coastguard Worker   int max_val = ((1 << msb) - 1);
138*77c1e3ccSAndroid Build Coastguard Worker   for (int i = 0; i < kNumIterations; ++i) {
139*77c1e3ccSAndroid Build Coastguard Worker     int err_count = 0;
140*77c1e3ccSAndroid Build Coastguard Worker     int k = (i / 9) % 9;
141*77c1e3ccSAndroid Build Coastguard Worker 
142*77c1e3ccSAndroid Build Coastguard Worker     // Change the maximum coeff value, to test different bit boundaries
143*77c1e3ccSAndroid Build Coastguard Worker     if (k == 8 && (i % 9) == 0) {
144*77c1e3ccSAndroid Build Coastguard Worker       max_val >>= 1;
145*77c1e3ccSAndroid Build Coastguard Worker     }
146*77c1e3ccSAndroid Build Coastguard Worker     block_size = 16 << (i % 9);  // All block sizes from 4x4, 8x4 ..64x64
147*77c1e3ccSAndroid Build Coastguard Worker     for (int j = 0; j < block_size; j++) {
148*77c1e3ccSAndroid Build Coastguard Worker       if (k < 4) {
149*77c1e3ccSAndroid Build Coastguard Worker         // Test at positive maximum values
150*77c1e3ccSAndroid Build Coastguard Worker         coeff[j] = k % 2 ? max_val : 0;
151*77c1e3ccSAndroid Build Coastguard Worker         dqcoeff[j] = (k >> 1) % 2 ? max_val : 0;
152*77c1e3ccSAndroid Build Coastguard Worker       } else if (k < 8) {
153*77c1e3ccSAndroid Build Coastguard Worker         // Test at negative maximum values
154*77c1e3ccSAndroid Build Coastguard Worker         coeff[j] = k % 2 ? -max_val : 0;
155*77c1e3ccSAndroid Build Coastguard Worker         dqcoeff[j] = (k >> 1) % 2 ? -max_val : 0;
156*77c1e3ccSAndroid Build Coastguard Worker       } else {
157*77c1e3ccSAndroid Build Coastguard Worker         if (rnd(2)) {
158*77c1e3ccSAndroid Build Coastguard Worker           // Positive number
159*77c1e3ccSAndroid Build Coastguard Worker           coeff[j] = rnd(1 << 14);
160*77c1e3ccSAndroid Build Coastguard Worker           dqcoeff[j] = rnd(1 << 14);
161*77c1e3ccSAndroid Build Coastguard Worker         } else {
162*77c1e3ccSAndroid Build Coastguard Worker           // Negative number
163*77c1e3ccSAndroid Build Coastguard Worker           coeff[j] = -rnd(1 << 14);
164*77c1e3ccSAndroid Build Coastguard Worker           dqcoeff[j] = -rnd(1 << 14);
165*77c1e3ccSAndroid Build Coastguard Worker         }
166*77c1e3ccSAndroid Build Coastguard Worker       }
167*77c1e3ccSAndroid Build Coastguard Worker     }
168*77c1e3ccSAndroid Build Coastguard Worker     ref_ret =
169*77c1e3ccSAndroid Build Coastguard Worker         ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
170*77c1e3ccSAndroid Build Coastguard Worker     API_REGISTER_STATE_CHECK(
171*77c1e3ccSAndroid Build Coastguard Worker         ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
172*77c1e3ccSAndroid Build Coastguard Worker     err_count += (ref_ret != ret) | (ref_ssz != ssz);
173*77c1e3ccSAndroid Build Coastguard Worker     if (err_count && !err_count_total) {
174*77c1e3ccSAndroid Build Coastguard Worker       first_failure = i;
175*77c1e3ccSAndroid Build Coastguard Worker     }
176*77c1e3ccSAndroid Build Coastguard Worker     err_count_total += err_count;
177*77c1e3ccSAndroid Build Coastguard Worker   }
178*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(0, err_count_total)
179*77c1e3ccSAndroid Build Coastguard Worker       << "Error: Error Block Test, C output doesn't match optimized output. "
180*77c1e3ccSAndroid Build Coastguard Worker       << "First failed at test case " << first_failure;
181*77c1e3ccSAndroid Build Coastguard Worker }
182*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(ErrorBlockTest,DISABLED_Speed)183*77c1e3ccSAndroid Build Coastguard Worker TEST_P(ErrorBlockTest, DISABLED_Speed) {
184*77c1e3ccSAndroid Build Coastguard Worker   ACMRandom rnd(ACMRandom::DeterministicSeed());
185*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, coeff[4096]);
186*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, tran_low_t, dqcoeff[4096]);
187*77c1e3ccSAndroid Build Coastguard Worker   intptr_t block_size;
188*77c1e3ccSAndroid Build Coastguard Worker   int64_t ssz;
189*77c1e3ccSAndroid Build Coastguard Worker   int num_iters = 100000;
190*77c1e3ccSAndroid Build Coastguard Worker   int64_t ref_ssz;
191*77c1e3ccSAndroid Build Coastguard Worker   const int msb = bit_depth_ + 8 - 1;
192*77c1e3ccSAndroid Build Coastguard Worker   for (int i = 0; i < 9; ++i) {
193*77c1e3ccSAndroid Build Coastguard Worker     block_size = 16 << (i % 9);  // All block sizes from 4x4, 8x4 ..64x64
194*77c1e3ccSAndroid Build Coastguard Worker     for (int k = 0; k < 9; k++) {
195*77c1e3ccSAndroid Build Coastguard Worker       for (int j = 0; j < block_size; j++) {
196*77c1e3ccSAndroid Build Coastguard Worker         if (k < 5) {
197*77c1e3ccSAndroid Build Coastguard Worker           if (rnd(2)) {
198*77c1e3ccSAndroid Build Coastguard Worker             // Positive number
199*77c1e3ccSAndroid Build Coastguard Worker             coeff[j] = rnd(1 << msb);
200*77c1e3ccSAndroid Build Coastguard Worker             dqcoeff[j] = rnd(1 << msb);
201*77c1e3ccSAndroid Build Coastguard Worker           } else {
202*77c1e3ccSAndroid Build Coastguard Worker             // Negative number
203*77c1e3ccSAndroid Build Coastguard Worker             coeff[j] = -rnd(1 << msb);
204*77c1e3ccSAndroid Build Coastguard Worker             dqcoeff[j] = -rnd(1 << msb);
205*77c1e3ccSAndroid Build Coastguard Worker           }
206*77c1e3ccSAndroid Build Coastguard Worker         } else {
207*77c1e3ccSAndroid Build Coastguard Worker           if (rnd(2)) {
208*77c1e3ccSAndroid Build Coastguard Worker             // Positive number
209*77c1e3ccSAndroid Build Coastguard Worker             coeff[j] = rnd(1 << 14);
210*77c1e3ccSAndroid Build Coastguard Worker             dqcoeff[j] = rnd(1 << 14);
211*77c1e3ccSAndroid Build Coastguard Worker           } else {
212*77c1e3ccSAndroid Build Coastguard Worker             // Negative number
213*77c1e3ccSAndroid Build Coastguard Worker             coeff[j] = -rnd(1 << 14);
214*77c1e3ccSAndroid Build Coastguard Worker             dqcoeff[j] = -rnd(1 << 14);
215*77c1e3ccSAndroid Build Coastguard Worker           }
216*77c1e3ccSAndroid Build Coastguard Worker         }
217*77c1e3ccSAndroid Build Coastguard Worker       }
218*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer ref_timer, test_timer;
219*77c1e3ccSAndroid Build Coastguard Worker 
220*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&ref_timer);
221*77c1e3ccSAndroid Build Coastguard Worker       for (int iter = 0; iter < num_iters; ++iter) {
222*77c1e3ccSAndroid Build Coastguard Worker         ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
223*77c1e3ccSAndroid Build Coastguard Worker       }
224*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&ref_timer);
225*77c1e3ccSAndroid Build Coastguard Worker       const int elapsed_time_c =
226*77c1e3ccSAndroid Build Coastguard Worker           static_cast<int>(aom_usec_timer_elapsed(&ref_timer));
227*77c1e3ccSAndroid Build Coastguard Worker 
228*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&test_timer);
229*77c1e3ccSAndroid Build Coastguard Worker       for (int iter = 0; iter < num_iters; ++iter) {
230*77c1e3ccSAndroid Build Coastguard Worker         error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_);
231*77c1e3ccSAndroid Build Coastguard Worker       }
232*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&test_timer);
233*77c1e3ccSAndroid Build Coastguard Worker 
234*77c1e3ccSAndroid Build Coastguard Worker       const int elapsed_time_simd =
235*77c1e3ccSAndroid Build Coastguard Worker           static_cast<int>(aom_usec_timer_elapsed(&test_timer));
236*77c1e3ccSAndroid Build Coastguard Worker 
237*77c1e3ccSAndroid Build Coastguard Worker       printf(
238*77c1e3ccSAndroid Build Coastguard Worker           " c_time=%d \t simd_time=%d \t "
239*77c1e3ccSAndroid Build Coastguard Worker           "gain=%d \n",
240*77c1e3ccSAndroid Build Coastguard Worker           elapsed_time_c, elapsed_time_simd,
241*77c1e3ccSAndroid Build Coastguard Worker           (elapsed_time_c / elapsed_time_simd));
242*77c1e3ccSAndroid Build Coastguard Worker     }
243*77c1e3ccSAndroid Build Coastguard Worker   }
244*77c1e3ccSAndroid Build Coastguard Worker }
245*77c1e3ccSAndroid Build Coastguard Worker 
246*77c1e3ccSAndroid Build Coastguard Worker using std::make_tuple;
247*77c1e3ccSAndroid Build Coastguard Worker 
248*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_SSE2
249*77c1e3ccSAndroid Build Coastguard Worker const ErrorBlockParam kErrorBlockTestParamsSse2[] = {
250*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
251*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_sse2, &av1_highbd_block_error_c,
252*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_10),
253*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_sse2, &av1_highbd_block_error_c,
254*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_12),
255*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_sse2, &av1_highbd_block_error_c,
256*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_8),
257*77c1e3ccSAndroid Build Coastguard Worker #endif
258*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockError8BitWrapper<av1_block_error_sse2>,
259*77c1e3ccSAndroid Build Coastguard Worker              &BlockError8BitWrapper<av1_block_error_c>, AOM_BITS_8),
260*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockErrorLpWrapper<av1_block_error_lp_sse2>,
261*77c1e3ccSAndroid Build Coastguard Worker              &BlockErrorLpWrapper<av1_block_error_lp_c>, AOM_BITS_8)
262*77c1e3ccSAndroid Build Coastguard Worker };
263*77c1e3ccSAndroid Build Coastguard Worker 
264*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(SSE2, ErrorBlockTest,
265*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(kErrorBlockTestParamsSse2));
266*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_SSE2
267*77c1e3ccSAndroid Build Coastguard Worker 
268*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_AVX2
269*77c1e3ccSAndroid Build Coastguard Worker const ErrorBlockParam kErrorBlockTestParamsAvx2[] = {
270*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
271*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_avx2, &av1_highbd_block_error_c,
272*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_10),
273*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_avx2, &av1_highbd_block_error_c,
274*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_12),
275*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_avx2, &av1_highbd_block_error_c,
276*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_8),
277*77c1e3ccSAndroid Build Coastguard Worker #endif
278*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockError8BitWrapper<av1_block_error_avx2>,
279*77c1e3ccSAndroid Build Coastguard Worker              &BlockError8BitWrapper<av1_block_error_c>, AOM_BITS_8),
280*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockErrorLpWrapper<av1_block_error_lp_avx2>,
281*77c1e3ccSAndroid Build Coastguard Worker              &BlockErrorLpWrapper<av1_block_error_lp_c>, AOM_BITS_8)
282*77c1e3ccSAndroid Build Coastguard Worker };
283*77c1e3ccSAndroid Build Coastguard Worker 
284*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(AVX2, ErrorBlockTest,
285*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(kErrorBlockTestParamsAvx2));
286*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_AVX2
287*77c1e3ccSAndroid Build Coastguard Worker 
288*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_NEON
289*77c1e3ccSAndroid Build Coastguard Worker const ErrorBlockParam kErrorBlockTestParamsNeon[] = {
290*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
291*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_neon, &av1_highbd_block_error_c,
292*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_10),
293*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_neon, &av1_highbd_block_error_c,
294*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_12),
295*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&av1_highbd_block_error_neon, &av1_highbd_block_error_c,
296*77c1e3ccSAndroid Build Coastguard Worker              AOM_BITS_8),
297*77c1e3ccSAndroid Build Coastguard Worker #endif
298*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockError8BitWrapper<av1_block_error_neon>,
299*77c1e3ccSAndroid Build Coastguard Worker              &BlockError8BitWrapper<av1_block_error_c>, AOM_BITS_8),
300*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockErrorLpWrapper<av1_block_error_lp_neon>,
301*77c1e3ccSAndroid Build Coastguard Worker              &BlockErrorLpWrapper<av1_block_error_lp_c>, AOM_BITS_8)
302*77c1e3ccSAndroid Build Coastguard Worker };
303*77c1e3ccSAndroid Build Coastguard Worker 
304*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(NEON, ErrorBlockTest,
305*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(kErrorBlockTestParamsNeon));
306*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_NEON
307*77c1e3ccSAndroid Build Coastguard Worker 
308*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_SVE
309*77c1e3ccSAndroid Build Coastguard Worker const ErrorBlockParam kErrorBlockTestParamsSVE[] = {
310*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockError8BitWrapper<av1_block_error_sve>,
311*77c1e3ccSAndroid Build Coastguard Worker              &BlockError8BitWrapper<av1_block_error_c>, AOM_BITS_8),
312*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&BlockErrorLpWrapper<av1_block_error_lp_sve>,
313*77c1e3ccSAndroid Build Coastguard Worker              &BlockErrorLpWrapper<av1_block_error_lp_c>, AOM_BITS_8)
314*77c1e3ccSAndroid Build Coastguard Worker };
315*77c1e3ccSAndroid Build Coastguard Worker 
316*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(SVE, ErrorBlockTest,
317*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(kErrorBlockTestParamsSVE));
318*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_SVE
319*77c1e3ccSAndroid Build Coastguard Worker }  // namespace
320