xref: /aosp_15_r20/external/libaom/test/masked_sad_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 #include <math.h>
12*77c1e3ccSAndroid Build Coastguard Worker #include <stdlib.h>
13*77c1e3ccSAndroid Build Coastguard Worker #include <string.h>
14*77c1e3ccSAndroid Build Coastguard Worker #include <tuple>
15*77c1e3ccSAndroid Build Coastguard Worker 
16*77c1e3ccSAndroid Build Coastguard Worker #include "gtest/gtest.h"
17*77c1e3ccSAndroid Build Coastguard Worker #include "test/acm_random.h"
18*77c1e3ccSAndroid Build Coastguard Worker #include "test/register_state_check.h"
19*77c1e3ccSAndroid Build Coastguard Worker #include "test/util.h"
20*77c1e3ccSAndroid Build Coastguard Worker 
21*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_config.h"
22*77c1e3ccSAndroid Build Coastguard Worker #include "config/aom_dsp_rtcd.h"
23*77c1e3ccSAndroid Build Coastguard Worker 
24*77c1e3ccSAndroid Build Coastguard Worker #include "aom/aom_integer.h"
25*77c1e3ccSAndroid Build Coastguard Worker 
26*77c1e3ccSAndroid Build Coastguard Worker using libaom_test::ACMRandom;
27*77c1e3ccSAndroid Build Coastguard Worker 
28*77c1e3ccSAndroid Build Coastguard Worker namespace {
29*77c1e3ccSAndroid Build Coastguard Worker const int number_of_iterations = 200;
30*77c1e3ccSAndroid Build Coastguard Worker 
31*77c1e3ccSAndroid Build Coastguard Worker typedef unsigned int (*MaskedSADFunc)(const uint8_t *src, int src_stride,
32*77c1e3ccSAndroid Build Coastguard Worker                                       const uint8_t *ref, int ref_stride,
33*77c1e3ccSAndroid Build Coastguard Worker                                       const uint8_t *second_pred,
34*77c1e3ccSAndroid Build Coastguard Worker                                       const uint8_t *msk, int msk_stride,
35*77c1e3ccSAndroid Build Coastguard Worker                                       int invert_mask);
36*77c1e3ccSAndroid Build Coastguard Worker typedef std::tuple<MaskedSADFunc, MaskedSADFunc> MaskedSADParam;
37*77c1e3ccSAndroid Build Coastguard Worker 
38*77c1e3ccSAndroid Build Coastguard Worker typedef void (*MaskedSADx4Func)(const uint8_t *src, int src_stride,
39*77c1e3ccSAndroid Build Coastguard Worker                                 const uint8_t *ref[], int ref_stride,
40*77c1e3ccSAndroid Build Coastguard Worker                                 const uint8_t *second_pred, const uint8_t *msk,
41*77c1e3ccSAndroid Build Coastguard Worker                                 int msk_stride, int invert_mask,
42*77c1e3ccSAndroid Build Coastguard Worker                                 unsigned sads[]);
43*77c1e3ccSAndroid Build Coastguard Worker 
44*77c1e3ccSAndroid Build Coastguard Worker typedef std::tuple<MaskedSADx4Func, MaskedSADx4Func> MaskedSADx4Param;
45*77c1e3ccSAndroid Build Coastguard Worker 
46*77c1e3ccSAndroid Build Coastguard Worker class MaskedSADTestBase : public ::testing::Test {
47*77c1e3ccSAndroid Build Coastguard Worker  public:
48*77c1e3ccSAndroid Build Coastguard Worker   ~MaskedSADTestBase() override = default;
49*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override = 0;
50*77c1e3ccSAndroid Build Coastguard Worker   virtual void runRef(const uint8_t *src_ptr, int src_stride,
51*77c1e3ccSAndroid Build Coastguard Worker                       const uint8_t *ref_ptr[], int ref_stride,
52*77c1e3ccSAndroid Build Coastguard Worker                       const uint8_t *second_pred, const uint8_t *msk,
53*77c1e3ccSAndroid Build Coastguard Worker                       int msk_stride, int inv_mask, unsigned sads[],
54*77c1e3ccSAndroid Build Coastguard Worker                       int times) = 0;
55*77c1e3ccSAndroid Build Coastguard Worker   virtual void runTest(const uint8_t *src_ptr, int src_stride,
56*77c1e3ccSAndroid Build Coastguard Worker                        const uint8_t *ref_ptr[], int ref_stride,
57*77c1e3ccSAndroid Build Coastguard Worker                        const uint8_t *second_pred, const uint8_t *msk,
58*77c1e3ccSAndroid Build Coastguard Worker                        int msk_stride, int inv_mask, unsigned sads[],
59*77c1e3ccSAndroid Build Coastguard Worker                        int times) = 0;
60*77c1e3ccSAndroid Build Coastguard Worker 
61*77c1e3ccSAndroid Build Coastguard Worker   void runMaskedSADTest(int run_times);
62*77c1e3ccSAndroid Build Coastguard Worker };
63*77c1e3ccSAndroid Build Coastguard Worker 
64*77c1e3ccSAndroid Build Coastguard Worker class MaskedSADTest : public MaskedSADTestBase,
65*77c1e3ccSAndroid Build Coastguard Worker                       public ::testing::WithParamInterface<MaskedSADParam> {
66*77c1e3ccSAndroid Build Coastguard Worker  public:
67*77c1e3ccSAndroid Build Coastguard Worker   ~MaskedSADTest() override = default;
SetUp()68*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override {
69*77c1e3ccSAndroid Build Coastguard Worker     maskedSAD_op_ = GET_PARAM(0);
70*77c1e3ccSAndroid Build Coastguard Worker     ref_maskedSAD_op_ = GET_PARAM(1);
71*77c1e3ccSAndroid Build Coastguard Worker   }
72*77c1e3ccSAndroid Build Coastguard Worker 
73*77c1e3ccSAndroid Build Coastguard Worker   void runRef(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr[],
74*77c1e3ccSAndroid Build Coastguard Worker               int ref_stride, const uint8_t *second_pred, const uint8_t *msk,
75*77c1e3ccSAndroid Build Coastguard Worker               int msk_stride, int inv_mask, unsigned sads[],
76*77c1e3ccSAndroid Build Coastguard Worker               int times) override;
77*77c1e3ccSAndroid Build Coastguard Worker   void runTest(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr[],
78*77c1e3ccSAndroid Build Coastguard Worker                int ref_stride, const uint8_t *second_pred, const uint8_t *msk,
79*77c1e3ccSAndroid Build Coastguard Worker                int msk_stride, int inv_mask, unsigned sads[],
80*77c1e3ccSAndroid Build Coastguard Worker                int times) override;
81*77c1e3ccSAndroid Build Coastguard Worker 
82*77c1e3ccSAndroid Build Coastguard Worker  protected:
83*77c1e3ccSAndroid Build Coastguard Worker   MaskedSADFunc maskedSAD_op_;
84*77c1e3ccSAndroid Build Coastguard Worker   MaskedSADFunc ref_maskedSAD_op_;
85*77c1e3ccSAndroid Build Coastguard Worker };
86*77c1e3ccSAndroid Build Coastguard Worker GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MaskedSADTest);
87*77c1e3ccSAndroid Build Coastguard Worker 
runRef(const uint8_t * src_ptr,int src_stride,const uint8_t * ref_ptr[],int ref_stride,const uint8_t * second_pred,const uint8_t * msk,int msk_stride,int invert_mask,unsigned sads[],int times)88*77c1e3ccSAndroid Build Coastguard Worker void MaskedSADTest::runRef(const uint8_t *src_ptr, int src_stride,
89*77c1e3ccSAndroid Build Coastguard Worker                            const uint8_t *ref_ptr[], int ref_stride,
90*77c1e3ccSAndroid Build Coastguard Worker                            const uint8_t *second_pred, const uint8_t *msk,
91*77c1e3ccSAndroid Build Coastguard Worker                            int msk_stride, int invert_mask, unsigned sads[],
92*77c1e3ccSAndroid Build Coastguard Worker                            int times) {
93*77c1e3ccSAndroid Build Coastguard Worker   for (int repeat = 0; repeat < times; ++repeat) {
94*77c1e3ccSAndroid Build Coastguard Worker     sads[0] = ref_maskedSAD_op_(src_ptr, src_stride, ref_ptr[0], ref_stride,
95*77c1e3ccSAndroid Build Coastguard Worker                                 second_pred, msk, msk_stride, invert_mask);
96*77c1e3ccSAndroid Build Coastguard Worker   }
97*77c1e3ccSAndroid Build Coastguard Worker }
98*77c1e3ccSAndroid Build Coastguard Worker 
runTest(const uint8_t * src_ptr,int src_stride,const uint8_t * ref_ptr[],int ref_stride,const uint8_t * second_pred,const uint8_t * msk,int msk_stride,int invert_mask,unsigned sads[],int times)99*77c1e3ccSAndroid Build Coastguard Worker void MaskedSADTest::runTest(const uint8_t *src_ptr, int src_stride,
100*77c1e3ccSAndroid Build Coastguard Worker                             const uint8_t *ref_ptr[], int ref_stride,
101*77c1e3ccSAndroid Build Coastguard Worker                             const uint8_t *second_pred, const uint8_t *msk,
102*77c1e3ccSAndroid Build Coastguard Worker                             int msk_stride, int invert_mask, unsigned sads[],
103*77c1e3ccSAndroid Build Coastguard Worker                             int times) {
104*77c1e3ccSAndroid Build Coastguard Worker   if (times == 1) {
105*77c1e3ccSAndroid Build Coastguard Worker     sads[0] = maskedSAD_op_(src_ptr, src_stride, ref_ptr[0], ref_stride,
106*77c1e3ccSAndroid Build Coastguard Worker                             second_pred, msk, msk_stride, invert_mask);
107*77c1e3ccSAndroid Build Coastguard Worker   } else {
108*77c1e3ccSAndroid Build Coastguard Worker     for (int repeat = 0; repeat < times; ++repeat) {
109*77c1e3ccSAndroid Build Coastguard Worker       API_REGISTER_STATE_CHECK(
110*77c1e3ccSAndroid Build Coastguard Worker           sads[0] = maskedSAD_op_(src_ptr, src_stride, ref_ptr[0], ref_stride,
111*77c1e3ccSAndroid Build Coastguard Worker                                   second_pred, msk, msk_stride, invert_mask));
112*77c1e3ccSAndroid Build Coastguard Worker     }
113*77c1e3ccSAndroid Build Coastguard Worker   }
114*77c1e3ccSAndroid Build Coastguard Worker }
115*77c1e3ccSAndroid Build Coastguard Worker 
runMaskedSADTest(int run_times)116*77c1e3ccSAndroid Build Coastguard Worker void MaskedSADTestBase::runMaskedSADTest(int run_times) {
117*77c1e3ccSAndroid Build Coastguard Worker   ACMRandom rnd(ACMRandom::DeterministicSeed());
118*77c1e3ccSAndroid Build Coastguard Worker   const unsigned kBlockSize = MAX_SB_SIZE * MAX_SB_SIZE;
119*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint8_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
120*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint8_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE * 4]);
121*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint8_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
122*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
123*77c1e3ccSAndroid Build Coastguard Worker 
124*77c1e3ccSAndroid Build Coastguard Worker   const uint8_t *refs[] = { ref_ptr, ref_ptr + kBlockSize,
125*77c1e3ccSAndroid Build Coastguard Worker                             ref_ptr + 2 * kBlockSize,
126*77c1e3ccSAndroid Build Coastguard Worker                             ref_ptr + 3 * kBlockSize };
127*77c1e3ccSAndroid Build Coastguard Worker   unsigned sads[] = { 0, 0, 0, 0 };
128*77c1e3ccSAndroid Build Coastguard Worker   unsigned sads_ref[] = { 0, 0, 0, 0 };
129*77c1e3ccSAndroid Build Coastguard Worker   int err_count = 0;
130*77c1e3ccSAndroid Build Coastguard Worker   int first_failure = -1;
131*77c1e3ccSAndroid Build Coastguard Worker   int src_stride = MAX_SB_SIZE;
132*77c1e3ccSAndroid Build Coastguard Worker   int ref_stride = MAX_SB_SIZE;
133*77c1e3ccSAndroid Build Coastguard Worker   int msk_stride = MAX_SB_SIZE;
134*77c1e3ccSAndroid Build Coastguard Worker   const int iters = run_times == 1 ? number_of_iterations : 1;
135*77c1e3ccSAndroid Build Coastguard Worker   for (int i = 0; i < iters; ++i) {
136*77c1e3ccSAndroid Build Coastguard Worker     if (run_times == 1 && i == 0) {
137*77c1e3ccSAndroid Build Coastguard Worker       // The maximum accumulator value occurs when src=0 and
138*77c1e3ccSAndroid Build Coastguard Worker       // ref/second_pref=255 (or vice-versa, since we take the absolute
139*77c1e3ccSAndroid Build Coastguard Worker       // difference). Check this case explicitly to ensure we do not overflow
140*77c1e3ccSAndroid Build Coastguard Worker       // during accumulation.
141*77c1e3ccSAndroid Build Coastguard Worker       for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
142*77c1e3ccSAndroid Build Coastguard Worker         src_ptr[j] = 0;
143*77c1e3ccSAndroid Build Coastguard Worker         ref_ptr[j] = 255;
144*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + kBlockSize)[j] = 255;
145*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + 2 * kBlockSize)[j] = 255;
146*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + 3 * kBlockSize)[j] = 255;
147*77c1e3ccSAndroid Build Coastguard Worker         second_pred_ptr[j] = 255;
148*77c1e3ccSAndroid Build Coastguard Worker       }
149*77c1e3ccSAndroid Build Coastguard Worker     } else {
150*77c1e3ccSAndroid Build Coastguard Worker       for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
151*77c1e3ccSAndroid Build Coastguard Worker         src_ptr[j] = rnd.Rand8();
152*77c1e3ccSAndroid Build Coastguard Worker         ref_ptr[j] = rnd.Rand8();
153*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + kBlockSize)[j] = rnd.Rand8();
154*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + 2 * kBlockSize)[j] = rnd.Rand8();
155*77c1e3ccSAndroid Build Coastguard Worker         (ref_ptr + 3 * kBlockSize)[j] = rnd.Rand8();
156*77c1e3ccSAndroid Build Coastguard Worker         second_pred_ptr[j] = rnd.Rand8();
157*77c1e3ccSAndroid Build Coastguard Worker       }
158*77c1e3ccSAndroid Build Coastguard Worker     }
159*77c1e3ccSAndroid Build Coastguard Worker     for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
160*77c1e3ccSAndroid Build Coastguard Worker       msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64;
161*77c1e3ccSAndroid Build Coastguard Worker       assert(msk_ptr[j] <= 64);
162*77c1e3ccSAndroid Build Coastguard Worker     }
163*77c1e3ccSAndroid Build Coastguard Worker 
164*77c1e3ccSAndroid Build Coastguard Worker     for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
165*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer timer;
166*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&timer);
167*77c1e3ccSAndroid Build Coastguard Worker       runRef(src_ptr, src_stride, refs, ref_stride, second_pred_ptr, msk_ptr,
168*77c1e3ccSAndroid Build Coastguard Worker              msk_stride, invert_mask, sads_ref, run_times);
169*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&timer);
170*77c1e3ccSAndroid Build Coastguard Worker       const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
171*77c1e3ccSAndroid Build Coastguard Worker 
172*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&timer);
173*77c1e3ccSAndroid Build Coastguard Worker       runTest(src_ptr, src_stride, refs, ref_stride, second_pred_ptr, msk_ptr,
174*77c1e3ccSAndroid Build Coastguard Worker               msk_stride, invert_mask, sads, run_times);
175*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&timer);
176*77c1e3ccSAndroid Build Coastguard Worker       const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
177*77c1e3ccSAndroid Build Coastguard Worker 
178*77c1e3ccSAndroid Build Coastguard Worker       if (run_times > 10) {
179*77c1e3ccSAndroid Build Coastguard Worker         printf("%7.2f/%7.2fns", time1, time2);
180*77c1e3ccSAndroid Build Coastguard Worker         printf("(%3.2f)\n", time1 / time2);
181*77c1e3ccSAndroid Build Coastguard Worker       }
182*77c1e3ccSAndroid Build Coastguard Worker       if (sads_ref[0] != sads[0] || sads_ref[1] != sads[1] ||
183*77c1e3ccSAndroid Build Coastguard Worker           sads_ref[2] != sads[2] || sads_ref[3] != sads[3]) {
184*77c1e3ccSAndroid Build Coastguard Worker         err_count++;
185*77c1e3ccSAndroid Build Coastguard Worker         if (first_failure == -1) first_failure = i;
186*77c1e3ccSAndroid Build Coastguard Worker       }
187*77c1e3ccSAndroid Build Coastguard Worker     }
188*77c1e3ccSAndroid Build Coastguard Worker   }
189*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(0, err_count) << "Error: Masked SAD Test,  output doesn't match. "
190*77c1e3ccSAndroid Build Coastguard Worker                           << "First failed at test case " << first_failure;
191*77c1e3ccSAndroid Build Coastguard Worker }
192*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(MaskedSADTest,OperationCheck)193*77c1e3ccSAndroid Build Coastguard Worker TEST_P(MaskedSADTest, OperationCheck) { runMaskedSADTest(1); }
194*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(MaskedSADTest,DISABLED_Speed)195*77c1e3ccSAndroid Build Coastguard Worker TEST_P(MaskedSADTest, DISABLED_Speed) { runMaskedSADTest(2000000); }
196*77c1e3ccSAndroid Build Coastguard Worker 
197*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
198*77c1e3ccSAndroid Build Coastguard Worker typedef unsigned int (*HighbdMaskedSADFunc)(const uint8_t *src, int src_stride,
199*77c1e3ccSAndroid Build Coastguard Worker                                             const uint8_t *ref, int ref_stride,
200*77c1e3ccSAndroid Build Coastguard Worker                                             const uint8_t *second_pred,
201*77c1e3ccSAndroid Build Coastguard Worker                                             const uint8_t *msk, int msk_stride,
202*77c1e3ccSAndroid Build Coastguard Worker                                             int invert_mask);
203*77c1e3ccSAndroid Build Coastguard Worker typedef std::tuple<HighbdMaskedSADFunc, HighbdMaskedSADFunc>
204*77c1e3ccSAndroid Build Coastguard Worker     HighbdMaskedSADParam;
205*77c1e3ccSAndroid Build Coastguard Worker 
206*77c1e3ccSAndroid Build Coastguard Worker class HighbdMaskedSADTest
207*77c1e3ccSAndroid Build Coastguard Worker     : public ::testing::TestWithParam<HighbdMaskedSADParam> {
208*77c1e3ccSAndroid Build Coastguard Worker  public:
209*77c1e3ccSAndroid Build Coastguard Worker   ~HighbdMaskedSADTest() override = default;
SetUp()210*77c1e3ccSAndroid Build Coastguard Worker   void SetUp() override {
211*77c1e3ccSAndroid Build Coastguard Worker     maskedSAD_op_ = GET_PARAM(0);
212*77c1e3ccSAndroid Build Coastguard Worker     ref_maskedSAD_op_ = GET_PARAM(1);
213*77c1e3ccSAndroid Build Coastguard Worker   }
214*77c1e3ccSAndroid Build Coastguard Worker 
215*77c1e3ccSAndroid Build Coastguard Worker   void runHighbdMaskedSADTest(int run_times);
216*77c1e3ccSAndroid Build Coastguard Worker 
217*77c1e3ccSAndroid Build Coastguard Worker  protected:
218*77c1e3ccSAndroid Build Coastguard Worker   HighbdMaskedSADFunc maskedSAD_op_;
219*77c1e3ccSAndroid Build Coastguard Worker   HighbdMaskedSADFunc ref_maskedSAD_op_;
220*77c1e3ccSAndroid Build Coastguard Worker };
221*77c1e3ccSAndroid Build Coastguard Worker GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HighbdMaskedSADTest);
222*77c1e3ccSAndroid Build Coastguard Worker 
runHighbdMaskedSADTest(int run_times)223*77c1e3ccSAndroid Build Coastguard Worker void HighbdMaskedSADTest::runHighbdMaskedSADTest(int run_times) {
224*77c1e3ccSAndroid Build Coastguard Worker   unsigned int ref_ret = 0, ret = 1;
225*77c1e3ccSAndroid Build Coastguard Worker   ACMRandom rnd(ACMRandom::DeterministicSeed());
226*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint16_t, src_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
227*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint16_t, ref_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
228*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint16_t, second_pred_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
229*77c1e3ccSAndroid Build Coastguard Worker   DECLARE_ALIGNED(16, uint8_t, msk_ptr[MAX_SB_SIZE * MAX_SB_SIZE]);
230*77c1e3ccSAndroid Build Coastguard Worker   uint8_t *src8_ptr = CONVERT_TO_BYTEPTR(src_ptr);
231*77c1e3ccSAndroid Build Coastguard Worker   uint8_t *ref8_ptr = CONVERT_TO_BYTEPTR(ref_ptr);
232*77c1e3ccSAndroid Build Coastguard Worker   uint8_t *second_pred8_ptr = CONVERT_TO_BYTEPTR(second_pred_ptr);
233*77c1e3ccSAndroid Build Coastguard Worker   int err_count = 0;
234*77c1e3ccSAndroid Build Coastguard Worker   int first_failure = -1;
235*77c1e3ccSAndroid Build Coastguard Worker   int src_stride = MAX_SB_SIZE;
236*77c1e3ccSAndroid Build Coastguard Worker   int ref_stride = MAX_SB_SIZE;
237*77c1e3ccSAndroid Build Coastguard Worker   int msk_stride = MAX_SB_SIZE;
238*77c1e3ccSAndroid Build Coastguard Worker   const int iters = run_times == 1 ? number_of_iterations : 1;
239*77c1e3ccSAndroid Build Coastguard Worker   for (int i = 0; i < iters; ++i) {
240*77c1e3ccSAndroid Build Coastguard Worker     for (int j = 0; j < MAX_SB_SIZE * MAX_SB_SIZE; j++) {
241*77c1e3ccSAndroid Build Coastguard Worker       src_ptr[j] = rnd.Rand16() & 0xfff;
242*77c1e3ccSAndroid Build Coastguard Worker       ref_ptr[j] = rnd.Rand16() & 0xfff;
243*77c1e3ccSAndroid Build Coastguard Worker       second_pred_ptr[j] = rnd.Rand16() & 0xfff;
244*77c1e3ccSAndroid Build Coastguard Worker       msk_ptr[j] = ((rnd.Rand8() & 0x7f) > 64) ? rnd.Rand8() & 0x3f : 64;
245*77c1e3ccSAndroid Build Coastguard Worker     }
246*77c1e3ccSAndroid Build Coastguard Worker 
247*77c1e3ccSAndroid Build Coastguard Worker     for (int invert_mask = 0; invert_mask < 2; ++invert_mask) {
248*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer timer;
249*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&timer);
250*77c1e3ccSAndroid Build Coastguard Worker       for (int repeat = 0; repeat < run_times; ++repeat) {
251*77c1e3ccSAndroid Build Coastguard Worker         ref_ret = ref_maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride,
252*77c1e3ccSAndroid Build Coastguard Worker                                     second_pred8_ptr, msk_ptr, msk_stride,
253*77c1e3ccSAndroid Build Coastguard Worker                                     invert_mask);
254*77c1e3ccSAndroid Build Coastguard Worker       }
255*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&timer);
256*77c1e3ccSAndroid Build Coastguard Worker       const double time1 = static_cast<double>(aom_usec_timer_elapsed(&timer));
257*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_start(&timer);
258*77c1e3ccSAndroid Build Coastguard Worker       if (run_times == 1) {
259*77c1e3ccSAndroid Build Coastguard Worker         API_REGISTER_STATE_CHECK(ret = maskedSAD_op_(src8_ptr, src_stride,
260*77c1e3ccSAndroid Build Coastguard Worker                                                      ref8_ptr, ref_stride,
261*77c1e3ccSAndroid Build Coastguard Worker                                                      second_pred8_ptr, msk_ptr,
262*77c1e3ccSAndroid Build Coastguard Worker                                                      msk_stride, invert_mask));
263*77c1e3ccSAndroid Build Coastguard Worker       } else {
264*77c1e3ccSAndroid Build Coastguard Worker         for (int repeat = 0; repeat < run_times; ++repeat) {
265*77c1e3ccSAndroid Build Coastguard Worker           ret =
266*77c1e3ccSAndroid Build Coastguard Worker               maskedSAD_op_(src8_ptr, src_stride, ref8_ptr, ref_stride,
267*77c1e3ccSAndroid Build Coastguard Worker                             second_pred8_ptr, msk_ptr, msk_stride, invert_mask);
268*77c1e3ccSAndroid Build Coastguard Worker         }
269*77c1e3ccSAndroid Build Coastguard Worker       }
270*77c1e3ccSAndroid Build Coastguard Worker       aom_usec_timer_mark(&timer);
271*77c1e3ccSAndroid Build Coastguard Worker       const double time2 = static_cast<double>(aom_usec_timer_elapsed(&timer));
272*77c1e3ccSAndroid Build Coastguard Worker       if (run_times > 10) {
273*77c1e3ccSAndroid Build Coastguard Worker         printf("%7.2f/%7.2fns", time1, time2);
274*77c1e3ccSAndroid Build Coastguard Worker         printf("(%3.2f)\n", time1 / time2);
275*77c1e3ccSAndroid Build Coastguard Worker       }
276*77c1e3ccSAndroid Build Coastguard Worker       if (ret != ref_ret) {
277*77c1e3ccSAndroid Build Coastguard Worker         err_count++;
278*77c1e3ccSAndroid Build Coastguard Worker         if (first_failure == -1) first_failure = i;
279*77c1e3ccSAndroid Build Coastguard Worker       }
280*77c1e3ccSAndroid Build Coastguard Worker     }
281*77c1e3ccSAndroid Build Coastguard Worker   }
282*77c1e3ccSAndroid Build Coastguard Worker   EXPECT_EQ(0, err_count)
283*77c1e3ccSAndroid Build Coastguard Worker       << "Error: High BD Masked SAD Test, output doesn't match. "
284*77c1e3ccSAndroid Build Coastguard Worker       << "First failed at test case " << first_failure;
285*77c1e3ccSAndroid Build Coastguard Worker }
286*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(HighbdMaskedSADTest,OperationCheck)287*77c1e3ccSAndroid Build Coastguard Worker TEST_P(HighbdMaskedSADTest, OperationCheck) { runHighbdMaskedSADTest(1); }
288*77c1e3ccSAndroid Build Coastguard Worker 
TEST_P(HighbdMaskedSADTest,DISABLED_Speed)289*77c1e3ccSAndroid Build Coastguard Worker TEST_P(HighbdMaskedSADTest, DISABLED_Speed) { runHighbdMaskedSADTest(1000000); }
290*77c1e3ccSAndroid Build Coastguard Worker #endif  // CONFIG_AV1_HIGHBITDEPTH
291*77c1e3ccSAndroid Build Coastguard Worker 
292*77c1e3ccSAndroid Build Coastguard Worker using std::make_tuple;
293*77c1e3ccSAndroid Build Coastguard Worker 
294*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_SSSE3
295*77c1e3ccSAndroid Build Coastguard Worker const MaskedSADParam msad_test[] = {
296*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x4_ssse3, &aom_masked_sad4x4_c),
297*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x8_ssse3, &aom_masked_sad4x8_c),
298*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x4_ssse3, &aom_masked_sad8x4_c),
299*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x8_ssse3, &aom_masked_sad8x8_c),
300*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x16_ssse3, &aom_masked_sad8x16_c),
301*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x8_ssse3, &aom_masked_sad16x8_c),
302*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x16_ssse3, &aom_masked_sad16x16_c),
303*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x32_ssse3, &aom_masked_sad16x32_c),
304*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x16_ssse3, &aom_masked_sad32x16_c),
305*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x32_ssse3, &aom_masked_sad32x32_c),
306*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x64_ssse3, &aom_masked_sad32x64_c),
307*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x32_ssse3, &aom_masked_sad64x32_c),
308*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x64_ssse3, &aom_masked_sad64x64_c),
309*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x128_ssse3, &aom_masked_sad64x128_c),
310*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x64_ssse3, &aom_masked_sad128x64_c),
311*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x128_ssse3, &aom_masked_sad128x128_c),
312*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
313*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x16_ssse3, &aom_masked_sad4x16_c),
314*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x4_ssse3, &aom_masked_sad16x4_c),
315*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x32_ssse3, &aom_masked_sad8x32_c),
316*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x8_ssse3, &aom_masked_sad32x8_c),
317*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x64_ssse3, &aom_masked_sad16x64_c),
318*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x16_ssse3, &aom_masked_sad64x16_c),
319*77c1e3ccSAndroid Build Coastguard Worker #endif
320*77c1e3ccSAndroid Build Coastguard Worker };
321*77c1e3ccSAndroid Build Coastguard Worker 
322*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(SSSE3, MaskedSADTest, ::testing::ValuesIn(msad_test));
323*77c1e3ccSAndroid Build Coastguard Worker 
324*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
325*77c1e3ccSAndroid Build Coastguard Worker const HighbdMaskedSADParam hbd_msad_test[] = {
326*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x4_ssse3, &aom_highbd_masked_sad4x4_c),
327*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x8_ssse3, &aom_highbd_masked_sad4x8_c),
328*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x4_ssse3, &aom_highbd_masked_sad8x4_c),
329*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x8_ssse3, &aom_highbd_masked_sad8x8_c),
330*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x16_ssse3, &aom_highbd_masked_sad8x16_c),
331*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x8_ssse3, &aom_highbd_masked_sad16x8_c),
332*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x16_ssse3, &aom_highbd_masked_sad16x16_c),
333*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x32_ssse3, &aom_highbd_masked_sad16x32_c),
334*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x16_ssse3, &aom_highbd_masked_sad32x16_c),
335*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x32_ssse3, &aom_highbd_masked_sad32x32_c),
336*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x64_ssse3, &aom_highbd_masked_sad32x64_c),
337*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x32_ssse3, &aom_highbd_masked_sad64x32_c),
338*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x64_ssse3, &aom_highbd_masked_sad64x64_c),
339*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x128_ssse3,
340*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad64x128_c),
341*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x64_ssse3,
342*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad128x64_c),
343*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x128_ssse3,
344*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad128x128_c),
345*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
346*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x16_ssse3, &aom_highbd_masked_sad4x16_c),
347*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x4_ssse3, &aom_highbd_masked_sad16x4_c),
348*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x32_ssse3, &aom_highbd_masked_sad8x32_c),
349*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x8_ssse3, &aom_highbd_masked_sad32x8_c),
350*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x64_ssse3, &aom_highbd_masked_sad16x64_c),
351*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x16_ssse3, &aom_highbd_masked_sad64x16_c),
352*77c1e3ccSAndroid Build Coastguard Worker #endif
353*77c1e3ccSAndroid Build Coastguard Worker };
354*77c1e3ccSAndroid Build Coastguard Worker 
355*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(SSSE3, HighbdMaskedSADTest,
356*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(hbd_msad_test));
357*77c1e3ccSAndroid Build Coastguard Worker #endif  // CONFIG_AV1_HIGHBITDEPTH
358*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_SSSE3
359*77c1e3ccSAndroid Build Coastguard Worker 
360*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_AVX2
361*77c1e3ccSAndroid Build Coastguard Worker const MaskedSADParam msad_avx2_test[] = {
362*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x4_avx2, &aom_masked_sad4x4_ssse3),
363*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x8_avx2, &aom_masked_sad4x8_ssse3),
364*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x4_avx2, &aom_masked_sad8x4_ssse3),
365*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x8_avx2, &aom_masked_sad8x8_ssse3),
366*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x16_avx2, &aom_masked_sad8x16_ssse3),
367*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x8_avx2, &aom_masked_sad16x8_ssse3),
368*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x16_avx2, &aom_masked_sad16x16_ssse3),
369*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x32_avx2, &aom_masked_sad16x32_ssse3),
370*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x16_avx2, &aom_masked_sad32x16_ssse3),
371*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x32_avx2, &aom_masked_sad32x32_ssse3),
372*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x64_avx2, &aom_masked_sad32x64_ssse3),
373*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x32_avx2, &aom_masked_sad64x32_ssse3),
374*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x64_avx2, &aom_masked_sad64x64_ssse3),
375*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x128_avx2, &aom_masked_sad64x128_ssse3),
376*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x64_avx2, &aom_masked_sad128x64_ssse3),
377*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x128_avx2, &aom_masked_sad128x128_ssse3),
378*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
379*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x16_avx2, &aom_masked_sad4x16_ssse3),
380*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x4_avx2, &aom_masked_sad16x4_ssse3),
381*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x32_avx2, &aom_masked_sad8x32_ssse3),
382*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x8_avx2, &aom_masked_sad32x8_ssse3),
383*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x64_avx2, &aom_masked_sad16x64_ssse3),
384*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x16_avx2, &aom_masked_sad64x16_ssse3)
385*77c1e3ccSAndroid Build Coastguard Worker #endif
386*77c1e3ccSAndroid Build Coastguard Worker };
387*77c1e3ccSAndroid Build Coastguard Worker 
388*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(AVX2, MaskedSADTest,
389*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(msad_avx2_test));
390*77c1e3ccSAndroid Build Coastguard Worker 
391*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
392*77c1e3ccSAndroid Build Coastguard Worker const HighbdMaskedSADParam hbd_msad_avx2_test[] = {
393*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x4_avx2, &aom_highbd_masked_sad4x4_ssse3),
394*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x8_avx2, &aom_highbd_masked_sad4x8_ssse3),
395*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x4_avx2, &aom_highbd_masked_sad8x4_ssse3),
396*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x8_avx2, &aom_highbd_masked_sad8x8_ssse3),
397*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x16_avx2, &aom_highbd_masked_sad8x16_ssse3),
398*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x8_avx2, &aom_highbd_masked_sad16x8_ssse3),
399*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x16_avx2,
400*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad16x16_ssse3),
401*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x32_avx2,
402*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad16x32_ssse3),
403*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x16_avx2,
404*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad32x16_ssse3),
405*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x32_avx2,
406*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad32x32_ssse3),
407*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x64_avx2,
408*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad32x64_ssse3),
409*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x32_avx2,
410*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad64x32_ssse3),
411*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x64_avx2,
412*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad64x64_ssse3),
413*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x128_avx2,
414*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad64x128_ssse3),
415*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x64_avx2,
416*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad128x64_ssse3),
417*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x128_avx2,
418*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad128x128_ssse3),
419*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
420*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x16_avx2, &aom_highbd_masked_sad4x16_ssse3),
421*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x4_avx2, &aom_highbd_masked_sad16x4_ssse3),
422*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x32_avx2, &aom_highbd_masked_sad8x32_ssse3),
423*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x8_avx2, &aom_highbd_masked_sad32x8_ssse3),
424*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x64_avx2,
425*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad16x64_ssse3),
426*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x16_avx2,
427*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad64x16_ssse3)
428*77c1e3ccSAndroid Build Coastguard Worker #endif
429*77c1e3ccSAndroid Build Coastguard Worker };
430*77c1e3ccSAndroid Build Coastguard Worker 
431*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(AVX2, HighbdMaskedSADTest,
432*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(hbd_msad_avx2_test));
433*77c1e3ccSAndroid Build Coastguard Worker #endif  // CONFIG_AV1_HIGHBITDEPTH
434*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_AVX2
435*77c1e3ccSAndroid Build Coastguard Worker 
436*77c1e3ccSAndroid Build Coastguard Worker #if HAVE_NEON
437*77c1e3ccSAndroid Build Coastguard Worker const MaskedSADParam msad_test[] = {
438*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x4_neon, &aom_masked_sad4x4_c),
439*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x8_neon, &aom_masked_sad4x8_c),
440*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x4_neon, &aom_masked_sad8x4_c),
441*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x8_neon, &aom_masked_sad8x8_c),
442*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x16_neon, &aom_masked_sad8x16_c),
443*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x8_neon, &aom_masked_sad16x8_c),
444*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x16_neon, &aom_masked_sad16x16_c),
445*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x32_neon, &aom_masked_sad16x32_c),
446*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x16_neon, &aom_masked_sad32x16_c),
447*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x32_neon, &aom_masked_sad32x32_c),
448*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x64_neon, &aom_masked_sad32x64_c),
449*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x32_neon, &aom_masked_sad64x32_c),
450*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x64_neon, &aom_masked_sad64x64_c),
451*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x128_neon, &aom_masked_sad64x128_c),
452*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x64_neon, &aom_masked_sad128x64_c),
453*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad128x128_neon, &aom_masked_sad128x128_c),
454*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
455*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad4x16_neon, &aom_masked_sad4x16_c),
456*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x4_neon, &aom_masked_sad16x4_c),
457*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad8x32_neon, &aom_masked_sad8x32_c),
458*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad32x8_neon, &aom_masked_sad32x8_c),
459*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad16x64_neon, &aom_masked_sad16x64_c),
460*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_masked_sad64x16_neon, &aom_masked_sad64x16_c),
461*77c1e3ccSAndroid Build Coastguard Worker #endif
462*77c1e3ccSAndroid Build Coastguard Worker };
463*77c1e3ccSAndroid Build Coastguard Worker 
464*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(NEON, MaskedSADTest, ::testing::ValuesIn(msad_test));
465*77c1e3ccSAndroid Build Coastguard Worker 
466*77c1e3ccSAndroid Build Coastguard Worker #if CONFIG_AV1_HIGHBITDEPTH
467*77c1e3ccSAndroid Build Coastguard Worker const MaskedSADParam hbd_msad_neon_test[] = {
468*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x4_neon, &aom_highbd_masked_sad4x4_c),
469*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x8_neon, &aom_highbd_masked_sad4x8_c),
470*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x4_neon, &aom_highbd_masked_sad8x4_c),
471*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x8_neon, &aom_highbd_masked_sad8x8_c),
472*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x16_neon, &aom_highbd_masked_sad8x16_c),
473*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x8_neon, &aom_highbd_masked_sad16x8_c),
474*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x16_neon, &aom_highbd_masked_sad16x16_c),
475*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x32_neon, &aom_highbd_masked_sad16x32_c),
476*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x16_neon, &aom_highbd_masked_sad32x16_c),
477*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x32_neon, &aom_highbd_masked_sad32x32_c),
478*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x64_neon, &aom_highbd_masked_sad32x64_c),
479*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x32_neon, &aom_highbd_masked_sad64x32_c),
480*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x64_neon, &aom_highbd_masked_sad64x64_c),
481*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x128_neon, &aom_highbd_masked_sad64x128_c),
482*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x64_neon, &aom_highbd_masked_sad128x64_c),
483*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad128x128_neon,
484*77c1e3ccSAndroid Build Coastguard Worker              &aom_highbd_masked_sad128x128_c),
485*77c1e3ccSAndroid Build Coastguard Worker #if !CONFIG_REALTIME_ONLY
486*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad4x16_neon, &aom_highbd_masked_sad4x16_c),
487*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x4_neon, &aom_highbd_masked_sad16x4_c),
488*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad8x32_neon, &aom_highbd_masked_sad8x32_c),
489*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad32x8_neon, &aom_highbd_masked_sad32x8_c),
490*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad16x64_neon, &aom_highbd_masked_sad16x64_c),
491*77c1e3ccSAndroid Build Coastguard Worker   make_tuple(&aom_highbd_masked_sad64x16_neon, &aom_highbd_masked_sad64x16_c),
492*77c1e3ccSAndroid Build Coastguard Worker #endif  // !CONFIG_REALTIME_ONLY
493*77c1e3ccSAndroid Build Coastguard Worker };
494*77c1e3ccSAndroid Build Coastguard Worker 
495*77c1e3ccSAndroid Build Coastguard Worker INSTANTIATE_TEST_SUITE_P(NEON, HighbdMaskedSADTest,
496*77c1e3ccSAndroid Build Coastguard Worker                          ::testing::ValuesIn(hbd_msad_neon_test));
497*77c1e3ccSAndroid Build Coastguard Worker 
498*77c1e3ccSAndroid Build Coastguard Worker #endif  // CONFIG_AV1_HIGHBITDEPTH
499*77c1e3ccSAndroid Build Coastguard Worker 
500*77c1e3ccSAndroid Build Coastguard Worker #endif  // HAVE_NEON
501*77c1e3ccSAndroid Build Coastguard Worker 
502*77c1e3ccSAndroid Build Coastguard Worker }  // namespace
503