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