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