vp9[loongarch]: Optimize fdct4x4/8x8_lsx
[platform/upstream/libvpx.git] / test / avg_test.cc
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 "third_party/googletest/src/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:
37   AverageTestBase(int width, int height)
38       : width_(width), height_(height), source_data_(nullptr),
39         source_stride_(0), bit_depth_(8) {}
40
41   virtual void TearDown() {
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
52   virtual void SetUp() {
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
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
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
78   void FillConstant(Pixel fill_constant) {
79     for (int i = 0; i < width_ * height_; ++i) {
80       source_data_[i] = fill_constant;
81     }
82   }
83
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:
104   AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
105
106  protected:
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:
131   AverageTestHBD() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
132
133  protected:
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:
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:
172   virtual void SetUp() {
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
183   virtual void TearDown() {
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
192   void RunComparison() {
193     ASM_REGISTER_STATE_CHECK(c_func_(hbuf_c_, source_data_, 0, height_));
194     ASM_REGISTER_STATE_CHECK(asm_func_(hbuf_asm_, source_data_, 0, height_));
195     EXPECT_EQ(0, memcmp(hbuf_c_, hbuf_asm_, sizeof(*hbuf_c_) * 16))
196         << "Output mismatch";
197   }
198
199  private:
200   IntProRowFunc asm_func_;
201   IntProRowFunc c_func_;
202   int16_t *hbuf_asm_;
203   int16_t *hbuf_c_;
204 };
205 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProRowTest);
206
207 typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width);
208
209 typedef std::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
210
211 class IntProColTest : public AverageTestBase<uint8_t>,
212                       public ::testing::WithParamInterface<IntProColParam> {
213  public:
214   IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
215     asm_func_ = GET_PARAM(1);
216     c_func_ = GET_PARAM(2);
217   }
218
219  protected:
220   void RunComparison() {
221     ASM_REGISTER_STATE_CHECK(sum_c_ = c_func_(source_data_, width_));
222     ASM_REGISTER_STATE_CHECK(sum_asm_ = asm_func_(source_data_, width_));
223     EXPECT_EQ(sum_c_, sum_asm_) << "Output mismatch";
224   }
225
226  private:
227   IntProColFunc asm_func_;
228   IntProColFunc c_func_;
229   int16_t sum_asm_;
230   int16_t sum_c_;
231 };
232 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(IntProColTest);
233 #endif  // HAVE_NEON || HAVE_SSE2 || HAVE_MSA
234
235 typedef int (*SatdFunc)(const tran_low_t *coeffs, int length);
236 typedef std::tuple<int, SatdFunc> SatdTestParam;
237
238 class SatdTest : public ::testing::Test,
239                  public ::testing::WithParamInterface<SatdTestParam> {
240  protected:
241   virtual void SetUp() {
242     satd_size_ = GET_PARAM(0);
243     satd_func_ = GET_PARAM(1);
244     rnd_.Reset(ACMRandom::DeterministicSeed());
245     src_ = reinterpret_cast<tran_low_t *>(
246         vpx_memalign(16, sizeof(*src_) * satd_size_));
247     ASSERT_NE(src_, nullptr);
248   }
249
250   virtual void TearDown() {
251     libvpx_test::ClearSystemState();
252     vpx_free(src_);
253   }
254
255   void FillConstant(const tran_low_t val) {
256     for (int i = 0; i < satd_size_; ++i) src_[i] = val;
257   }
258
259   virtual void FillRandom() = 0;
260
261   void Check(const int expected) {
262     int total;
263     ASM_REGISTER_STATE_CHECK(total = satd_func_(src_, satd_size_));
264     EXPECT_EQ(expected, total);
265   }
266
267   tran_low_t *GetCoeff() const { return src_; }
268
269   int satd_size_;
270   ACMRandom rnd_;
271   tran_low_t *src_;
272
273  private:
274   SatdFunc satd_func_;
275 };
276
277 class SatdLowbdTest : public SatdTest {
278  protected:
279   virtual void FillRandom() {
280     for (int i = 0; i < satd_size_; ++i) {
281       const int16_t tmp = rnd_.Rand16Signed();
282       src_[i] = (tran_low_t)tmp;
283     }
284   }
285 };
286
287 typedef int64_t (*BlockErrorFunc)(const tran_low_t *coeff,
288                                   const tran_low_t *dqcoeff, int block_size);
289 typedef std::tuple<int, BlockErrorFunc> BlockErrorTestFPParam;
290
291 class BlockErrorTestFP
292     : public ::testing::Test,
293       public ::testing::WithParamInterface<BlockErrorTestFPParam> {
294  protected:
295   virtual void SetUp() {
296     txfm_size_ = GET_PARAM(0);
297     block_error_func_ = GET_PARAM(1);
298     rnd_.Reset(ACMRandom::DeterministicSeed());
299     coeff_ = reinterpret_cast<tran_low_t *>(
300         vpx_memalign(16, sizeof(*coeff_) * txfm_size_));
301     dqcoeff_ = reinterpret_cast<tran_low_t *>(
302         vpx_memalign(16, sizeof(*dqcoeff_) * txfm_size_));
303     ASSERT_NE(coeff_, nullptr);
304     ASSERT_NE(dqcoeff_, nullptr);
305   }
306
307   virtual void TearDown() {
308     libvpx_test::ClearSystemState();
309     vpx_free(coeff_);
310     vpx_free(dqcoeff_);
311   }
312
313   void FillConstant(const tran_low_t coeff_val, const tran_low_t dqcoeff_val) {
314     for (int i = 0; i < txfm_size_; ++i) coeff_[i] = coeff_val;
315     for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = dqcoeff_val;
316   }
317
318   void FillRandom() {
319     // Just two fixed seeds
320     rnd_.Reset(0xb0b9);
321     for (int i = 0; i < txfm_size_; ++i) coeff_[i] = rnd_.Rand16() >> 1;
322     rnd_.Reset(0xb0c8);
323     for (int i = 0; i < txfm_size_; ++i) dqcoeff_[i] = rnd_.Rand16() >> 1;
324   }
325
326   void Check(const int64_t expected) {
327     int64_t total;
328     ASM_REGISTER_STATE_CHECK(
329         total = block_error_func_(coeff_, dqcoeff_, txfm_size_));
330     EXPECT_EQ(expected, total);
331   }
332
333   tran_low_t *GetCoeff() const { return coeff_; }
334
335   tran_low_t *GetDQCoeff() const { return dqcoeff_; }
336
337   int txfm_size_;
338
339  private:
340   tran_low_t *coeff_;
341   tran_low_t *dqcoeff_;
342   BlockErrorFunc block_error_func_;
343   ACMRandom rnd_;
344 };
345
346 TEST_P(AverageTest, MinValue) {
347   FillConstant(0);
348   CheckAverages();
349 }
350
351 TEST_P(AverageTest, MaxValue) {
352   FillConstant(255);
353   CheckAverages();
354 }
355
356 TEST_P(AverageTest, Random) {
357   // The reference frame, but not the source frame, may be unaligned for
358   // certain types of searches.
359   for (int i = 0; i < 1000; i++) {
360     FillRandom();
361     CheckAverages();
362   }
363 }
364 #if CONFIG_VP9_HIGHBITDEPTH
365 TEST_P(AverageTestHBD, MinValue) {
366   FillConstant(0);
367   CheckAverages();
368 }
369
370 TEST_P(AverageTestHBD, MaxValue) {
371   FillConstant((1 << VPX_BITS_12) - 1);
372   CheckAverages();
373 }
374
375 TEST_P(AverageTestHBD, Random) {
376   bit_depth_ = VPX_BITS_12;
377   // The reference frame, but not the source frame, may be unaligned for
378   // certain types of searches.
379   for (int i = 0; i < 1000; i++) {
380     FillRandom();
381     CheckAverages();
382   }
383 }
384 #endif  // CONFIG_VP9_HIGHBITDEPTH
385
386 #if HAVE_NEON || HAVE_SSE2 || HAVE_MSA
387 TEST_P(IntProRowTest, MinValue) {
388   FillConstant(0);
389   RunComparison();
390 }
391
392 TEST_P(IntProRowTest, MaxValue) {
393   FillConstant(255);
394   RunComparison();
395 }
396
397 TEST_P(IntProRowTest, Random) {
398   FillRandom();
399   RunComparison();
400 }
401
402 TEST_P(IntProColTest, MinValue) {
403   FillConstant(0);
404   RunComparison();
405 }
406
407 TEST_P(IntProColTest, MaxValue) {
408   FillConstant(255);
409   RunComparison();
410 }
411
412 TEST_P(IntProColTest, Random) {
413   FillRandom();
414   RunComparison();
415 }
416 #endif
417
418 TEST_P(SatdLowbdTest, MinValue) {
419   const int kMin = -32640;
420   const int expected = -kMin * satd_size_;
421   FillConstant(kMin);
422   Check(expected);
423 }
424
425 TEST_P(SatdLowbdTest, MaxValue) {
426   const int kMax = 32640;
427   const int expected = kMax * satd_size_;
428   FillConstant(kMax);
429   Check(expected);
430 }
431
432 TEST_P(SatdLowbdTest, Random) {
433   int expected;
434   switch (satd_size_) {
435     case 16: expected = 261036; break;
436     case 64: expected = 991732; break;
437     case 256: expected = 4136358; break;
438     case 1024: expected = 16677592; break;
439     default:
440       FAIL() << "Invalid satd size (" << satd_size_
441              << ") valid: 16/64/256/1024";
442   }
443   FillRandom();
444   Check(expected);
445 }
446
447 TEST_P(SatdLowbdTest, DISABLED_Speed) {
448   const int kCountSpeedTestBlock = 20000;
449   vpx_usec_timer timer;
450   const int blocksize = GET_PARAM(0);
451   FillRandom();
452   tran_low_t *coeff = GetCoeff();
453
454   vpx_usec_timer_start(&timer);
455   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
456     GET_PARAM(1)(coeff, blocksize);
457   }
458   vpx_usec_timer_mark(&timer);
459   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
460   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
461 }
462
463 #if CONFIG_VP9_HIGHBITDEPTH
464 class SatdHighbdTest : public SatdTest {
465  protected:
466   virtual void FillRandom() {
467     for (int i = 0; i < satd_size_; ++i) {
468       src_[i] = rnd_.Rand20Signed();
469     }
470   }
471 };
472
473 TEST_P(SatdHighbdTest, MinValue) {
474   const int kMin = -524280;
475   const int expected = -kMin * satd_size_;
476   FillConstant(kMin);
477   Check(expected);
478 }
479
480 TEST_P(SatdHighbdTest, MaxValue) {
481   const int kMax = 524280;
482   const int expected = kMax * satd_size_;
483   FillConstant(kMax);
484   Check(expected);
485 }
486
487 TEST_P(SatdHighbdTest, Random) {
488   int expected;
489   switch (satd_size_) {
490     case 16: expected = 5249712; break;
491     case 64: expected = 18362120; break;
492     case 256: expected = 66100520; break;
493     case 1024: expected = 266094734; break;
494     default:
495       FAIL() << "Invalid satd size (" << satd_size_
496              << ") valid: 16/64/256/1024";
497   }
498   FillRandom();
499   Check(expected);
500 }
501
502 TEST_P(SatdHighbdTest, DISABLED_Speed) {
503   const int kCountSpeedTestBlock = 20000;
504   vpx_usec_timer timer;
505   const int blocksize = GET_PARAM(0);
506   FillRandom();
507   tran_low_t *coeff = GetCoeff();
508
509   vpx_usec_timer_start(&timer);
510   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
511     GET_PARAM(1)(coeff, blocksize);
512   }
513   vpx_usec_timer_mark(&timer);
514   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
515   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
516 }
517 #endif  // CONFIG_VP9_HIGHBITDEPTH
518
519 TEST_P(BlockErrorTestFP, MinValue) {
520   const int64_t kMin = -32640;
521   const int64_t expected = kMin * kMin * txfm_size_;
522   FillConstant(kMin, 0);
523   Check(expected);
524 }
525
526 TEST_P(BlockErrorTestFP, MaxValue) {
527   const int64_t kMax = 32640;
528   const int64_t expected = kMax * kMax * txfm_size_;
529   FillConstant(kMax, 0);
530   Check(expected);
531 }
532
533 TEST_P(BlockErrorTestFP, Random) {
534   int64_t expected;
535   switch (txfm_size_) {
536     case 16: expected = 2051681432; break;
537     case 64: expected = 11075114379; break;
538     case 256: expected = 44386271116; break;
539     case 1024: expected = 184774996089; break;
540     default:
541       FAIL() << "Invalid satd size (" << txfm_size_
542              << ") valid: 16/64/256/1024";
543   }
544   FillRandom();
545   Check(expected);
546 }
547
548 TEST_P(BlockErrorTestFP, DISABLED_Speed) {
549   const int kCountSpeedTestBlock = 20000;
550   vpx_usec_timer timer;
551   const int blocksize = GET_PARAM(0);
552   FillRandom();
553   tran_low_t *coeff = GetCoeff();
554   tran_low_t *dqcoeff = GetDQCoeff();
555
556   vpx_usec_timer_start(&timer);
557   for (int i = 0; i < kCountSpeedTestBlock; ++i) {
558     GET_PARAM(1)(coeff, dqcoeff, blocksize);
559   }
560   vpx_usec_timer_mark(&timer);
561   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
562   printf("blocksize: %4d time: %4d us\n", blocksize, elapsed_time);
563 }
564
565 using std::make_tuple;
566
567 INSTANTIATE_TEST_SUITE_P(
568     C, AverageTest,
569     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
570                       make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
571
572 #if CONFIG_VP9_HIGHBITDEPTH
573 INSTANTIATE_TEST_SUITE_P(
574     C, AverageTestHBD,
575     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_c),
576                       make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_c)));
577
578 #if HAVE_SSE2
579 INSTANTIATE_TEST_SUITE_P(
580     SSE2, AverageTestHBD,
581     ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_highbd_avg_8x8_sse2),
582                       make_tuple(16, 16, 1, 4, &vpx_highbd_avg_4x4_sse2)));
583 #endif  // HAVE_SSE2
584
585 INSTANTIATE_TEST_SUITE_P(C, SatdHighbdTest,
586                          ::testing::Values(make_tuple(16, &vpx_satd_c),
587                                            make_tuple(64, &vpx_satd_c),
588                                            make_tuple(256, &vpx_satd_c),
589                                            make_tuple(1024, &vpx_satd_c)));
590 #endif  // CONFIG_VP9_HIGHBITDEPTH
591
592 INSTANTIATE_TEST_SUITE_P(C, SatdLowbdTest,
593                          ::testing::Values(make_tuple(16, &vpx_satd_c),
594                                            make_tuple(64, &vpx_satd_c),
595                                            make_tuple(256, &vpx_satd_c),
596                                            make_tuple(1024, &vpx_satd_c)));
597
598 INSTANTIATE_TEST_SUITE_P(
599     C, BlockErrorTestFP,
600     ::testing::Values(make_tuple(16, &vp9_block_error_fp_c),
601                       make_tuple(64, &vp9_block_error_fp_c),
602                       make_tuple(256, &vp9_block_error_fp_c),
603                       make_tuple(1024, &vp9_block_error_fp_c)));
604
605 #if HAVE_SSE2
606 INSTANTIATE_TEST_SUITE_P(
607     SSE2, AverageTest,
608     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
609                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
610                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),
611                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),
612                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
613                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
614
615 INSTANTIATE_TEST_SUITE_P(
616     SSE2, IntProRowTest,
617     ::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
618                       make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
619                       make_tuple(64, &vpx_int_pro_row_sse2,
620                                  &vpx_int_pro_row_c)));
621
622 INSTANTIATE_TEST_SUITE_P(
623     SSE2, IntProColTest,
624     ::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
625                       make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
626                       make_tuple(64, &vpx_int_pro_col_sse2,
627                                  &vpx_int_pro_col_c)));
628
629 INSTANTIATE_TEST_SUITE_P(SSE2, SatdLowbdTest,
630                          ::testing::Values(make_tuple(16, &vpx_satd_sse2),
631                                            make_tuple(64, &vpx_satd_sse2),
632                                            make_tuple(256, &vpx_satd_sse2),
633                                            make_tuple(1024, &vpx_satd_sse2)));
634
635 INSTANTIATE_TEST_SUITE_P(
636     SSE2, BlockErrorTestFP,
637     ::testing::Values(make_tuple(16, &vp9_block_error_fp_sse2),
638                       make_tuple(64, &vp9_block_error_fp_sse2),
639                       make_tuple(256, &vp9_block_error_fp_sse2),
640                       make_tuple(1024, &vp9_block_error_fp_sse2)));
641 #endif  // HAVE_SSE2
642
643 #if HAVE_AVX2
644 INSTANTIATE_TEST_SUITE_P(AVX2, SatdLowbdTest,
645                          ::testing::Values(make_tuple(16, &vpx_satd_avx2),
646                                            make_tuple(64, &vpx_satd_avx2),
647                                            make_tuple(256, &vpx_satd_avx2),
648                                            make_tuple(1024, &vpx_satd_avx2)));
649
650 #if CONFIG_VP9_HIGHBITDEPTH
651 INSTANTIATE_TEST_SUITE_P(
652     AVX2, SatdHighbdTest,
653     ::testing::Values(make_tuple(16, &vpx_highbd_satd_avx2),
654                       make_tuple(64, &vpx_highbd_satd_avx2),
655                       make_tuple(256, &vpx_highbd_satd_avx2),
656                       make_tuple(1024, &vpx_highbd_satd_avx2)));
657 #endif  // CONFIG_VP9_HIGHBITDEPTH
658
659 INSTANTIATE_TEST_SUITE_P(
660     AVX2, BlockErrorTestFP,
661     ::testing::Values(make_tuple(16, &vp9_block_error_fp_avx2),
662                       make_tuple(64, &vp9_block_error_fp_avx2),
663                       make_tuple(256, &vp9_block_error_fp_avx2),
664                       make_tuple(1024, &vp9_block_error_fp_avx2)));
665 #endif
666
667 #if HAVE_NEON
668 INSTANTIATE_TEST_SUITE_P(
669     NEON, AverageTest,
670     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
671                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
672                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),
673                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),
674                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
675                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
676
677 INSTANTIATE_TEST_SUITE_P(
678     NEON, IntProRowTest,
679     ::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
680                       make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
681                       make_tuple(64, &vpx_int_pro_row_neon,
682                                  &vpx_int_pro_row_c)));
683
684 INSTANTIATE_TEST_SUITE_P(
685     NEON, IntProColTest,
686     ::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
687                       make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
688                       make_tuple(64, &vpx_int_pro_col_neon,
689                                  &vpx_int_pro_col_c)));
690
691 INSTANTIATE_TEST_SUITE_P(NEON, SatdLowbdTest,
692                          ::testing::Values(make_tuple(16, &vpx_satd_neon),
693                                            make_tuple(64, &vpx_satd_neon),
694                                            make_tuple(256, &vpx_satd_neon),
695                                            make_tuple(1024, &vpx_satd_neon)));
696
697 // TODO(jianj): Remove the highbitdepth flag once the SIMD functions are
698 // in place.
699 #if !CONFIG_VP9_HIGHBITDEPTH
700 INSTANTIATE_TEST_SUITE_P(
701     NEON, BlockErrorTestFP,
702     ::testing::Values(make_tuple(16, &vp9_block_error_fp_neon),
703                       make_tuple(64, &vp9_block_error_fp_neon),
704                       make_tuple(256, &vp9_block_error_fp_neon),
705                       make_tuple(1024, &vp9_block_error_fp_neon)));
706 #endif  // !CONFIG_VP9_HIGHBITDEPTH
707 #endif  // HAVE_NEON
708
709 #if HAVE_MSA
710 INSTANTIATE_TEST_SUITE_P(
711     MSA, AverageTest,
712     ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
713                       make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
714                       make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),
715                       make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),
716                       make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
717                       make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
718
719 INSTANTIATE_TEST_SUITE_P(
720     MSA, IntProRowTest,
721     ::testing::Values(make_tuple(16, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
722                       make_tuple(32, &vpx_int_pro_row_msa, &vpx_int_pro_row_c),
723                       make_tuple(64, &vpx_int_pro_row_msa,
724                                  &vpx_int_pro_row_c)));
725
726 INSTANTIATE_TEST_SUITE_P(
727     MSA, IntProColTest,
728     ::testing::Values(make_tuple(16, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
729                       make_tuple(32, &vpx_int_pro_col_msa, &vpx_int_pro_col_c),
730                       make_tuple(64, &vpx_int_pro_col_msa,
731                                  &vpx_int_pro_col_c)));
732
733 // TODO(jingning): Remove the highbitdepth flag once the SIMD functions are
734 // in place.
735 #if !CONFIG_VP9_HIGHBITDEPTH
736 INSTANTIATE_TEST_SUITE_P(MSA, SatdLowbdTest,
737                          ::testing::Values(make_tuple(16, &vpx_satd_msa),
738                                            make_tuple(64, &vpx_satd_msa),
739                                            make_tuple(256, &vpx_satd_msa),
740                                            make_tuple(1024, &vpx_satd_msa)));
741 #endif  // !CONFIG_VP9_HIGHBITDEPTH
742 #endif  // HAVE_MSA
743
744 }  // namespace