xref: /aosp_15_r20/external/libvpx/test/avg_test.cc (revision fb1b10ab9aebc7c7068eedab379b749d7e3900be)
1 /*
2  *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include <limits.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include <tuple>
15 
16 #include "gtest/gtest.h"
17 
18 #include "./vp9_rtcd.h"
19 #include "./vpx_config.h"
20 #include "./vpx_dsp_rtcd.h"
21 
22 #include "test/acm_random.h"
23 #include "test/clear_system_state.h"
24 #include "test/register_state_check.h"
25 #include "test/util.h"
26 #include "vpx/vpx_codec.h"
27 #include "vpx_mem/vpx_mem.h"
28 #include "vpx_ports/vpx_timer.h"
29 
30 using libvpx_test::ACMRandom;
31 
32 namespace {
33 
34 template <typename Pixel>
35 class AverageTestBase : public ::testing::Test {
36  public:
AverageTestBase(int width,int height)37   AverageTestBase(int width, int height)
38       : width_(width), height_(height), source_data_(nullptr),
39         source_stride_(0), bit_depth_(8) {}
40 
TearDown()41   void TearDown() override {
42     vpx_free(source_data_);
43     source_data_ = nullptr;
44     libvpx_test::ClearSystemState();
45   }
46 
47  protected:
48   // Handle blocks up to 4 blocks 64x64 with stride up to 128
49   static const int kDataAlignment = 16;
50   static const int kDataBlockSize = 64 * 128;
51 
SetUp()52   void SetUp() override {
53     source_data_ = reinterpret_cast<Pixel *>(
54         vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
55     ASSERT_NE(source_data_, nullptr);
56     source_stride_ = (width_ + 31) & ~31;
57     bit_depth_ = 8;
58     rnd_.Reset(ACMRandom::DeterministicSeed());
59   }
60 
61   // Sum Pixels
ReferenceAverage8x8(const Pixel * source,int pitch)62   static unsigned int ReferenceAverage8x8(const Pixel *source, int pitch) {
63     unsigned int average = 0;
64     for (int h = 0; h < 8; ++h) {
65       for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
66     }
67     return ((average + 32) >> 6);
68   }
69 
ReferenceAverage4x4(const Pixel * source,int pitch)70   static unsigned int ReferenceAverage4x4(const Pixel *source, int pitch) {
71     unsigned int average = 0;
72     for (int h = 0; h < 4; ++h) {
73       for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
74     }
75     return ((average + 8) >> 4);
76   }
77 
FillConstant(Pixel fill_constant)78   void FillConstant(Pixel fill_constant) {
79     for (int i = 0; i < width_ * height_; ++i) {
80       source_data_[i] = fill_constant;
81     }
82   }
83 
FillRandom()84   void FillRandom() {
85     for (int i = 0; i < width_ * height_; ++i) {
86       source_data_[i] = rnd_.Rand16() & ((1 << bit_depth_) - 1);
87     }
88   }
89 
90   int width_, height_;
91   Pixel *source_data_;
92   int source_stride_;
93   int bit_depth_;
94 
95   ACMRandom rnd_;
96 };
97 typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
98 
99 typedef std::tuple<int, int, int, int, AverageFunction> AvgFunc;
100 
101 class AverageTest : public AverageTestBase<uint8_t>,
102                     public ::testing::WithParamInterface<AvgFunc> {
103  public:
AverageTest()104   AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
105 
106  protected:
CheckAverages()107   void CheckAverages() {
108     const int block_size = GET_PARAM(3);
109     unsigned int expected = 0;
110     if (block_size == 8) {
111       expected =
112           ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
113     } else if (block_size == 4) {
114       expected =
115           ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
116     }
117 
118     ASM_REGISTER_STATE_CHECK(
119         GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
120     unsigned int actual =
121         GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
122 
123     EXPECT_EQ(expected, actual);
124   }
125 };
126 
127 #if CONFIG_VP9_HIGHBITDEPTH
128 class AverageTestHBD : public AverageTestBase<uint16_t>,
129                        public ::testing::WithParamInterface<AvgFunc> {
130  public:
AverageTestHBD()131   AverageTestHBD() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
132 
133  protected:
CheckAverages()134   void CheckAverages() {
135     const int block_size = GET_PARAM(3);
136     unsigned int expected = 0;
137     if (block_size == 8) {
138       expected =
139           ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
140     } else if (block_size == 4) {
141       expected =
142           ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
143     }
144 
145     ASM_REGISTER_STATE_CHECK(GET_PARAM(4)(
146         CONVERT_TO_BYTEPTR(source_data_ + GET_PARAM(2)), source_stride_));
147     unsigned int actual = GET_PARAM(4)(
148         CONVERT_TO_BYTEPTR(source_data_ + GET_PARAM(2)), source_stride_);
149 
150     EXPECT_EQ(expected, actual);
151   }
152 };
153 #endif  // CONFIG_VP9_HIGHBITDEPTH
154 
155 #if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
156 typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref,
157                               const int ref_stride, const int height);
158 
159 typedef std::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
160 
161 class IntProRowTest : public AverageTestBase<uint8_t>,
162                       public ::testing::WithParamInterface<IntProRowParam> {
163  public:
IntProRowTest()164   IntProRowTest()
165       : AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(nullptr),
166         hbuf_c_(nullptr) {
167     asm_func_ = GET_PARAM(1);
168     c_func_ = GET_PARAM(2);
169   }
170 
171  protected:
SetUp()172   void SetUp() override {
173     source_data_ = reinterpret_cast<uint8_t *>(
174         vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(source_data_[0])));
175     ASSERT_NE(source_data_, nullptr);
176 
177     hbuf_asm_ = reinterpret_cast<int16_t *>(
178         vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
179     hbuf_c_ = reinterpret_cast<int16_t *>(
180         vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
181   }
182 
TearDown()183   void TearDown() override {
184     vpx_free(source_data_);
185     source_data_ = nullptr;
186     vpx_free(hbuf_c_);
187     hbuf_c_ = nullptr;
188     vpx_free(hbuf_asm_);
189     hbuf_asm_ = nullptr;
190   }
191 
RunComparison()192   void RunComparison() {
193     ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, width_, height_));
194     ASM_REGISTER_STATE_CHECK(
195         asm_func_(hbuf_asm_, source_data_, width_, height_));
196     EXPECT_EQ(0, memcmp(hbuf_c_, hbuf_asm_, sizeof(*hbuf_c_) * 16))
197         << "Output mismatch";
198   }
199 
200  private:
201   IntProRowFunc asm_func_;
202   IntProRowFunc c_func_;
203   int16_t *hbuf_asm_;
204   int16_t *hbuf_c_;
205 };
206 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProRowTest);
207 
208 typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
209 
210 typedef std::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
211 
212 class IntProColTest : public AverageTestBase<uint8_t>,
213                       public ::testing::WithParamInterface<IntProColParam> {
214  public:
IntProColTest()215   IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
216     asm_func_ = GET_PARAM(1);
217     c_func_ = GET_PARAM(2);
218   }
219 
220  protected:
RunComparison()221   void RunComparison() {
222     ASM_REGISTER_STATE_CHECK(sum_c_ = c_func_(source_data_, width_));
223     ASM_REGISTER_STATE_CHECK(sum_asm_ = asm_func_(source_data_, width_));
224     EXPECT_EQ(sum_c_, sum_asm_) << "Output mismatch";
225   }
226 
227  private:
228   IntProColFunc asm_func_;
229   IntProColFunc c_func_;
230   int16_t sum_asm_;
231   int16_t sum_c_;
232 };
233 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProColTest);
234 #endif  // HAVE_NEON || HAVE_SSE2 || HAVE_MSA
235 
236 typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
237 typedef std::tuple<int, SatdFunc> SatdTestParam;
238 
239 class SatdTest : public ::testing::Test,
240                  public ::testing::WithParamInterface<SatdTestParam> {
241  protected:
SetUp()242   void SetUp() override {
243     satd_size_ = GET_PARAM(0);
244     satd_func_ = GET_PARAM(1);
245     rnd_.Reset(ACMRandom::DeterministicSeed());
246     src_ = reinterpret_cast<tran_low_t *>(
247         vpx_memalign(16, sizeof(*src_) * satd_size_));
248     ASSERT_NE(src_, nullptr);
249   }
250 
TearDown()251   void TearDown() override {
252     libvpx_test::ClearSystemState();
253     vpx_free(src_);
254   }
255 
FillConstant(const tran_low_t val)256   void FillConstant(const tran_low_t val) {
257     for (int i = 0; i < satd_size_; ++i) src_[i] = val;
258   }
259 
260   virtual void FillRandom() = 0;
261 
Check(const int expected)262   void Check(const int expected) {
263     int total;
264     ASM_REGISTER_STATE_CHECK(total = satd_func_(src_, satd_size_));
265     EXPECT_EQ(expected, total);
266   }
267 
GetCoeff() const268   tran_low_t *GetCoeff() const { return src_; }
269 
270   int satd_size_;
271   ACMRandom rnd_;
272   tran_low_t *src_;
273 
274  private:
275   SatdFunc satd_func_;
276 };
277 
278 class SatdLowbdTest : public SatdTest {
279  protected:
FillRandom()280   void FillRandom() override {
281     for (int i = 0; i < satd_size_; ++i) {
282       const int16_t tmp = rnd_.Rand16Signed();
283       src_[i] = (tran_low_t)tmp;
284     }
285   }
286 };
287 
288 typedef int64_t (*BlockErrorFunc)(const tran_low_t *coeff,
289                                   const tran_low_t *dqcoeff, int block_size);
290 typedef std::tuple<int, BlockErrorFunc> BlockErrorTestFPParam;
291 
292 class BlockErrorTestFP
293     : public ::testing::Test,
294       public ::testing::WithParamInterface<BlockErrorTestFPParam> {
295  protected:
SetUp()296   void SetUp() override {
297     txfm_size_ = GET_PARAM(0);
298     block_error_func_ = GET_PARAM(1);
299     rnd_.Reset(ACMRandom::DeterministicSeed());
300     coeff_ = reinterpret_cast<tran_low_t *>(
301         vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
302     dqcoeff_ = reinterpret_cast<tran_low_t *>(
303         vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
304     ASSERT_NE(coeff_, nullptr);
305     ASSERT_NE(dqcoeff_, nullptr);
306   }
307 
TearDown()308   void TearDown() override {
309     libvpx_test::ClearSystemState();
310     vpx_free(coeff_);
311     vpx_free(dqcoeff_);
312   }
313 
FillConstant(const tran_low_t coeff_val,const tran_low_t dqcoeff_val)314   void FillConstant(const tran_low_t coeff_val, const tran_low_t dqcoeff_val) {
315     for (int i = 0; i < txfm_size_; ++i) coeff_[i] = coeff_val;
316     for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = dqcoeff_val;
317   }
318 
FillRandom()319   void FillRandom() {
320     // Just two fixed seeds
321     rnd_.Reset(0xb0b9);
322     for (int i = 0; i < txfm_size_; ++i) coeff_[i] = rnd_.Rand16() >> 1;
323     rnd_.Reset(0xb0c8);
324     for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = rnd_.Rand16() >> 1;
325   }
326 
Check(const int64_t expected)327   void Check(const int64_t expected) {
328     int64_t total;
329     ASM_REGISTER_STATE_CHECK(
330         total = block_error_func_(coeff_, dqcoeff_, txfm_size_));
331     EXPECT_EQ(expected, total);
332   }
333 
GetCoeff() const334   tran_low_t *GetCoeff() const { return coeff_; }
335 
GetDQCoeff() const336   tran_low_t *GetDQCoeff() const { return dqcoeff_; }
337 
338   int txfm_size_;
339 
340  private:
341   tran_low_t *coeff_;
342   tran_low_t *dqcoeff_;
343   BlockErrorFunc block_error_func_;
344   ACMRandom rnd_;
345 };
346 
TEST_P(AverageTest,MinValue)347 TEST_P(AverageTest, MinValue) {
348   FillConstant(0);
349   CheckAverages();
350 }
351 
TEST_P(AverageTest,MaxValue)352 TEST_P(AverageTest, MaxValue) {
353   FillConstant(255);
354   CheckAverages();
355 }
356 
TEST_P(AverageTest,Random)357 TEST_P(AverageTest, Random) {
358   // The reference frame, but not the source frame, may be unaligned for
359   // certain types of searches.
360   for (int i = 0; i < 1000; i++) {
361     FillRandom();
362     CheckAverages();
363   }
364 }
365 #if CONFIG_VP9_HIGHBITDEPTH
TEST_P(AverageTestHBD,MinValue)366 TEST_P(AverageTestHBD, MinValue) {
367   FillConstant(0);
368   CheckAverages();
369 }
370 
TEST_P(AverageTestHBD,MaxValue)371 TEST_P(AverageTestHBD, MaxValue) {
372   FillConstant((1 << VPX_BITS_12) - 1);
373   CheckAverages();
374 }
375 
TEST_P(AverageTestHBD,Random)376 TEST_P(AverageTestHBD, Random) {
377   bit_depth_ = VPX_BITS_12;
378   // The reference frame, but not the source frame, may be unaligned for
379   // certain types of searches.
380   for (int i = 0; i < 1000; i++) {
381     FillRandom();
382     CheckAverages();
383   }
384 }
385 #endif  // CONFIG_VP9_HIGHBITDEPTH
386 
387 #if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
TEST_P(IntProRowTest,MinValue)388 TEST_P(IntProRowTest, MinValue) {
389   FillConstant(0);
390   RunComparison();
391 }
392 
TEST_P(IntProRowTest,MaxValue)393 TEST_P(IntProRowTest, MaxValue) {
394   FillConstant(255);
395   RunComparison();
396 }
397 
TEST_P(IntProRowTest,Random)398 TEST_P(IntProRowTest, Random) {
399   FillRandom();
400   RunComparison();
401 }
402 
TEST_P(IntProColTest,MinValue)403 TEST_P(IntProColTest, MinValue) {
404   FillConstant(0);
405   RunComparison();
406 }
407 
TEST_P(IntProColTest,MaxValue)408 TEST_P(IntProColTest, MaxValue) {
409   FillConstant(255);
410   RunComparison();
411 }
412 
TEST_P(IntProColTest,Random)413 TEST_P(IntProColTest, Random) {
414   FillRandom();
415   RunComparison();
416 }
417 #endif
418 
TEST_P(SatdLowbdTest,MinValue)419 TEST_P(SatdLowbdTest, MinValue) {
420   const int kMin = -32640;
421   const int expected = -kMin * satd_size_;
422   FillConstant(kMin);
423   Check(expected);
424 }
425 
TEST_P(SatdLowbdTest,MaxValue)426 TEST_P(SatdLowbdTest, MaxValue) {
427   const int kMax = 32640;
428   const int expected = kMax * satd_size_;
429   FillConstant(kMax);
430   Check(expected);
431 }
432 
TEST_P(SatdLowbdTest,Random)433 TEST_P(SatdLowbdTest, Random) {
434   int expected;
435   switch (satd_size_) {
436     case 16: expected = 261036; break;
437     case 64: expected = 991732; break;
438     case 256: expected = 4136358; break;
439     case 1024: expected = 16677592; break;
440     default:
441       FAIL() << "Invalid satd size (" << satd_size_
442              << ") valid: 16/64/256/1024";
443   }
444   FillRandom();
445   Check(expected);
446 }
447 
TEST_P(SatdLowbdTest,DISABLED_Speed)448 TEST_P(SatdLowbdTest, DISABLED_Speed) {
449   const int kCountSpeedTestBlock = 20000;
450   vpx_usec_timer timer;
451   const int blocksize = GET_PARAM(0);
452   FillRandom();
453   tran_low_t *coeff = GetCoeff();
454 
455   vpx_usec_timer_start(&timer);
456   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
457     GET_PARAM(1)(coeff, blocksize);
458   }
459   vpx_usec_timer_mark(&timer);
460   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
461   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
462 }
463 
464 #if CONFIG_VP9_HIGHBITDEPTH
465 class SatdHighbdTest : public SatdTest {
466  protected:
FillRandom()467   void FillRandom() override {
468     for (int i = 0; i < satd_size_; ++i) {
469       src_[i] = rnd_.Rand20Signed();
470     }
471   }
472 };
473 
TEST_P(SatdHighbdTest,MinValue)474 TEST_P(SatdHighbdTest, MinValue) {
475   const int kMin = -524280;
476   const int expected = -kMin * satd_size_;
477   FillConstant(kMin);
478   Check(expected);
479 }
480 
TEST_P(SatdHighbdTest,MaxValue)481 TEST_P(SatdHighbdTest, MaxValue) {
482   const int kMax = 524280;
483   const int expected = kMax * satd_size_;
484   FillConstant(kMax);
485   Check(expected);
486 }
487 
TEST_P(SatdHighbdTest,Random)488 TEST_P(SatdHighbdTest, Random) {
489   int expected;
490   switch (satd_size_) {
491     case 16: expected = 5249712; break;
492     case 64: expected = 18362120; break;
493     case 256: expected = 66100520; break;
494     case 1024: expected = 266094734; break;
495     default:
496       FAIL() << "Invalid satd size (" << satd_size_
497              << ") valid: 16/64/256/1024";
498   }
499   FillRandom();
500   Check(expected);
501 }
502 
TEST_P(SatdHighbdTest,DISABLED_Speed)503 TEST_P(SatdHighbdTest, DISABLED_Speed) {
504   const int kCountSpeedTestBlock = 20000;
505   vpx_usec_timer timer;
506   const int blocksize = GET_PARAM(0);
507   FillRandom();
508   tran_low_t *coeff = GetCoeff();
509 
510   vpx_usec_timer_start(&timer);
511   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
512     GET_PARAM(1)(coeff, blocksize);
513   }
514   vpx_usec_timer_mark(&timer);
515   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
516   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
517 }
518 #endif  // CONFIG_VP9_HIGHBITDEPTH
519 
TEST_P(BlockErrorTestFP,MinValue)520 TEST_P(BlockErrorTestFP, MinValue) {
521   const int64_t kMin = -32640;
522   const int64_t expected = kMin * kMin * txfm_size_;
523   FillConstant(kMin, 0);
524   Check(expected);
525 }
526 
TEST_P(BlockErrorTestFP,MaxValue)527 TEST_P(BlockErrorTestFP, MaxValue) {
528   const int64_t kMax = 32640;
529   const int64_t expected = kMax * kMax * txfm_size_;
530   FillConstant(kMax, 0);
531   Check(expected);
532 }
533 
TEST_P(BlockErrorTestFP,Random)534 TEST_P(BlockErrorTestFP, Random) {
535   int64_t expected;
536   switch (txfm_size_) {
537     case 16: expected = 2051681432; break;
538     case 64: expected = 11075114379; break;
539     case 256: expected = 44386271116; break;
540     case 1024: expected = 184774996089; break;
541     default:
542       FAIL() << "Invalid satd size (" << txfm_size_
543              << ") valid: 16/64/256/1024";
544   }
545   FillRandom();
546   Check(expected);
547 }
548 
TEST_P(BlockErrorTestFP,DISABLED_Speed)549 TEST_P(BlockErrorTestFP, DISABLED_Speed) {
550   const int kCountSpeedTestBlock = 20000;
551   vpx_usec_timer timer;
552   const int blocksize = GET_PARAM(0);
553   FillRandom();
554   tran_low_t *coeff = GetCoeff();
555   tran_low_t *dqcoeff = GetDQCoeff();
556 
557   vpx_usec_timer_start(&timer);
558   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
559     GET_PARAM(1)(coeff, dqcoeff, blocksize);
560   }
561   vpx_usec_timer_mark(&timer);
562   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
563   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
564 }
565 
566 using std::make_tuple;
567 
568 INSTANTIATE_TEST_SUITE_P(
569     C, AverageTest,
570     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
571                       make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
572 
573 #if CONFIG_VP9_HIGHBITDEPTH
574 INSTANTIATE_TEST_SUITE_P(
575     C, AverageTestHBD,
576     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c),
577                       make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c)));
578 
579 #if HAVE_SSE2
580 INSTANTIATE_TEST_SUITE_P(
581     SSE2, AverageTestHBD,
582     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2),
583                       make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
584 #endif  // HAVE_SSE2
585 
586 #if HAVE_NEON
587 INSTANTIATE_TEST_SUITE_P(
588     NEON, AverageTestHBD,
589     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_neon),
590                       make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_neon)));
591 #endif  // HAVE_NEON
592 
593 INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
594                          ::testing::Values(make_tuple(16, &vpx_satd_c),
595                                            make_tuple(64, &vpx_satd_c),
596                                            make_tuple(256, &vpx_satd_c),
597                                            make_tuple(1024, &vpx_satd_c)));
598 #endif  // CONFIG_VP9_HIGHBITDEPTH
599 
600 INSTANTIATE_TEST_SUITE_P(C, SatdLowbdTest,
601                          ::testing::Values(make_tuple(16, &vpx_satd_c),
602                                            make_tuple(64, &vpx_satd_c),
603                                            make_tuple(256, &vpx_satd_c),
604                                            make_tuple(1024, &vpx_satd_c)));
605 
606 INSTANTIATE_TEST_SUITE_P(
607     C, BlockErrorTestFP,
608     ::testing::Values(make_tuple(16, &vp9_block_error_fp_c),
609                       make_tuple(64, &vp9_block_error_fp_c),
610                       make_tuple(256, &vp9_block_error_fp_c),
611                       make_tuple(1024, &vp9_block_error_fp_c)));
612 
613 #if HAVE_SSE2
614 INSTANTIATE_TEST_SUITE_P(
615     SSE2, AverageTest,
616     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
617                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
618                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),
619                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),
620                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
621                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
622 
623 INSTANTIATE_TEST_SUITE_P(
624     SSE2, IntProRowTest,
625     ::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
626                       make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
627                       make_tuple(64, &vpx_int_pro_row_sse2,
628                                  &vpx_int_pro_row_c)));
629 
630 INSTANTIATE_TEST_SUITE_P(
631     SSE2, IntProColTest,
632     ::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
633                       make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
634                       make_tuple(64, &vpx_int_pro_col_sse2,
635                                  &vpx_int_pro_col_c)));
636 
637 INSTANTIATE_TEST_SUITE_P(SSE2, SatdLowbdTest,
638                          ::testing::Values(make_tuple(16, &vpx_satd_sse2),
639                                            make_tuple(64, &vpx_satd_sse2),
640                                            make_tuple(256, &vpx_satd_sse2),
641                                            make_tuple(1024, &vpx_satd_sse2)));
642 
643 INSTANTIATE_TEST_SUITE_P(
644     SSE2, BlockErrorTestFP,
645     ::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
646                       make_tuple(64, &vp9_block_error_fp_sse2),
647                       make_tuple(256, &vp9_block_error_fp_sse2),
648                       make_tuple(1024, &vp9_block_error_fp_sse2)));
649 #endif  // HAVE_SSE2
650 
651 #if HAVE_AVX2
652 INSTANTIATE_TEST_SUITE_P(AVX2, SatdLowbdTest,
653                          ::testing::Values(make_tuple(16, &vpx_satd_avx2),
654                                            make_tuple(64, &vpx_satd_avx2),
655                                            make_tuple(256, &vpx_satd_avx2),
656                                            make_tuple(1024, &vpx_satd_avx2)));
657 
658 #if CONFIG_VP9_HIGHBITDEPTH
659 INSTANTIATE_TEST_SUITE_P(
660     AVX2, SatdHighbdTest,
661     ::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2),
662                       make_tuple(64, &vpx_highbd_satd_avx2),
663                       make_tuple(256, &vpx_highbd_satd_avx2),
664                       make_tuple(1024, &vpx_highbd_satd_avx2)));
665 #endif  // CONFIG_VP9_HIGHBITDEPTH
666 
667 INSTANTIATE_TEST_SUITE_P(
668     AVX2, BlockErrorTestFP,
669     ::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2),
670                       make_tuple(64, &vp9_block_error_fp_avx2),
671                       make_tuple(256, &vp9_block_error_fp_avx2),
672                       make_tuple(1024, &vp9_block_error_fp_avx2)));
673 #endif
674 
675 #if HAVE_NEON
676 INSTANTIATE_TEST_SUITE_P(
677     NEON, AverageTest,
678     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
679                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
680                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),
681                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),
682                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
683                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
684 
685 INSTANTIATE_TEST_SUITE_P(
686     NEON, IntProRowTest,
687     ::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
688                       make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
689                       make_tuple(64, &vpx_int_pro_row_neon,
690                                  &vpx_int_pro_row_c)));
691 
692 INSTANTIATE_TEST_SUITE_P(
693     NEON, IntProColTest,
694     ::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
695                       make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
696                       make_tuple(64, &vpx_int_pro_col_neon,
697                                  &vpx_int_pro_col_c)));
698 
699 INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
700                          ::testing::Values(make_tuple(16, &vpx_satd_neon),
701                                            make_tuple(64, &vpx_satd_neon),
702                                            make_tuple(256, &vpx_satd_neon),
703                                            make_tuple(1024, &vpx_satd_neon)));
704 
705 #if CONFIG_VP9_HIGHBITDEPTH
706 INSTANTIATE_TEST_SUITE_P(
707     NEON, SatdHighbdTest,
708     ::testing::Values(make_tuple(16, &vpx_highbd_satd_neon),
709                       make_tuple(64, &vpx_highbd_satd_neon),
710                       make_tuple(256, &vpx_highbd_satd_neon),
711                       make_tuple(1024, &vpx_highbd_satd_neon)));
712 #endif  // CONFIG_VP9_HIGHBITDEPTH
713 
714 INSTANTIATE_TEST_SUITE_P(
715     NEON, BlockErrorTestFP,
716     ::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
717                       make_tuple(64, &vp9_block_error_fp_neon),
718                       make_tuple(256, &vp9_block_error_fp_neon),
719                       make_tuple(1024, &vp9_block_error_fp_neon)));
720 #endif  // HAVE_NEON
721 
722 #if HAVE_SVE
723 INSTANTIATE_TEST_SUITE_P(
724     SVE, BlockErrorTestFP,
725     ::testing::Values(make_tuple(16, &vp9_block_error_fp_sve),
726                       make_tuple(64, &vp9_block_error_fp_sve),
727                       make_tuple(256, &vp9_block_error_fp_sve),
728                       make_tuple(1024, &vp9_block_error_fp_sve)));
729 #endif  // HAVE_SVE
730 
731 #if HAVE_MSA
732 INSTANTIATE_TEST_SUITE_P(
733     MSA, AverageTest,
734     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
735                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
736                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),
737                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),
738                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
739                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
740 
741 INSTANTIATE_TEST_SUITE_P(
742     MSA, IntProRowTest,
743     ::testing::Values(make_tuple(16, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
744                       make_tuple(32, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
745                       make_tuple(64, &vpx_int_pro_row_msa,
746                                  &vpx_int_pro_row_c)));
747 
748 INSTANTIATE_TEST_SUITE_P(
749     MSA, IntProColTest,
750     ::testing::Values(make_tuple(16, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
751                       make_tuple(32, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
752                       make_tuple(64, &vpx_int_pro_col_msa,
753                                  &vpx_int_pro_col_c)));
754 
755 // TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
756 // in place.
757 #if !CONFIG_VP9_HIGHBITDEPTH
758 INSTANTIATE_TEST_SUITE_P(MSA, SatdLowbdTest,
759                          ::testing::Values(make_tuple(16, &vpx_satd_msa),
760                                            make_tuple(64, &vpx_satd_msa),
761                                            make_tuple(256, &vpx_satd_msa),
762                                            make_tuple(1024, &vpx_satd_msa)));
763 #endif  // !CONFIG_VP9_HIGHBITDEPTH
764 #endif  // HAVE_MSA
765 
766 }  // namespace
767