]> granicus.if.org Git - libvpx/blob - test/variance_test.cc
ppc: Add vpx_sadnxmx4d_vsx for n,m = {8, 16, 32 ,64}
[libvpx] / test / variance_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 <cstdlib>
12 #include <new>
13
14 #include "third_party/googletest/src/include/gtest/gtest.h"
15
16 #include "./vpx_config.h"
17 #include "./vpx_dsp_rtcd.h"
18 #include "test/acm_random.h"
19 #include "test/clear_system_state.h"
20 #include "test/register_state_check.h"
21 #include "vpx/vpx_codec.h"
22 #include "vpx/vpx_integer.h"
23 #include "vpx_mem/vpx_mem.h"
24 #include "vpx_ports/mem.h"
25 #include "vpx_ports/vpx_timer.h"
26
27 namespace {
28
29 typedef unsigned int (*VarianceMxNFunc)(const uint8_t *a, int a_stride,
30                                         const uint8_t *b, int b_stride,
31                                         unsigned int *sse);
32 typedef unsigned int (*SubpixVarMxNFunc)(const uint8_t *a, int a_stride,
33                                          int xoffset, int yoffset,
34                                          const uint8_t *b, int b_stride,
35                                          unsigned int *sse);
36 typedef unsigned int (*SubpixAvgVarMxNFunc)(const uint8_t *a, int a_stride,
37                                             int xoffset, int yoffset,
38                                             const uint8_t *b, int b_stride,
39                                             uint32_t *sse,
40                                             const uint8_t *second_pred);
41 typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
42                                       const uint8_t *b, int b_stride);
43 typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
44
45 using libvpx_test::ACMRandom;
46
47 // Truncate high bit depth results by downshifting (with rounding) by:
48 // 2 * (bit_depth - 8) for sse
49 // (bit_depth - 8) for se
50 static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
51   switch (bit_depth) {
52     case VPX_BITS_12:
53       *sse = (*sse + 128) >> 8;
54       *se = (*se + 8) >> 4;
55       break;
56     case VPX_BITS_10:
57       *sse = (*sse + 8) >> 4;
58       *se = (*se + 2) >> 2;
59       break;
60     case VPX_BITS_8:
61     default: break;
62   }
63 }
64
65 static unsigned int mb_ss_ref(const int16_t *src) {
66   unsigned int res = 0;
67   for (int i = 0; i < 256; ++i) {
68     res += src[i] * src[i];
69   }
70   return res;
71 }
72
73 /* Note:
74  *  Our codebase calculates the "diff" value in the variance algorithm by
75  *  (src - ref).
76  */
77 static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
78                              int l2h, int src_stride, int ref_stride,
79                              uint32_t *sse_ptr, bool use_high_bit_depth_,
80                              vpx_bit_depth_t bit_depth) {
81   int64_t se = 0;
82   uint64_t sse = 0;
83   const int w = 1 << l2w;
84   const int h = 1 << l2h;
85   for (int y = 0; y < h; y++) {
86     for (int x = 0; x < w; x++) {
87       int diff;
88       if (!use_high_bit_depth_) {
89         diff = src[y * src_stride + x] - ref[y * ref_stride + x];
90         se += diff;
91         sse += diff * diff;
92 #if CONFIG_VP9_HIGHBITDEPTH
93       } else {
94         diff = CONVERT_TO_SHORTPTR(src)[y * src_stride + x] -
95                CONVERT_TO_SHORTPTR(ref)[y * ref_stride + x];
96         se += diff;
97         sse += diff * diff;
98 #endif  // CONFIG_VP9_HIGHBITDEPTH
99       }
100     }
101   }
102   RoundHighBitDepth(bit_depth, &se, &sse);
103   *sse_ptr = static_cast<uint32_t>(sse);
104   return static_cast<uint32_t>(
105       sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
106 }
107
108 /* The subpel reference functions differ from the codec version in one aspect:
109  * they calculate the bilinear factors directly instead of using a lookup table
110  * and therefore upshift xoff and yoff by 1. Only every other calculated value
111  * is used so the codec version shrinks the table to save space and maintain
112  * compatibility with vp8.
113  */
114 static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
115                                     int l2w, int l2h, int xoff, int yoff,
116                                     uint32_t *sse_ptr, bool use_high_bit_depth_,
117                                     vpx_bit_depth_t bit_depth) {
118   int64_t se = 0;
119   uint64_t sse = 0;
120   const int w = 1 << l2w;
121   const int h = 1 << l2h;
122
123   xoff <<= 1;
124   yoff <<= 1;
125
126   for (int y = 0; y < h; y++) {
127     for (int x = 0; x < w; x++) {
128       // Bilinear interpolation at a 16th pel step.
129       if (!use_high_bit_depth_) {
130         const int a1 = ref[(w + 1) * (y + 0) + x + 0];
131         const int a2 = ref[(w + 1) * (y + 0) + x + 1];
132         const int b1 = ref[(w + 1) * (y + 1) + x + 0];
133         const int b2 = ref[(w + 1) * (y + 1) + x + 1];
134         const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
135         const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
136         const int r = a + (((b - a) * yoff + 8) >> 4);
137         const int diff = r - src[w * y + x];
138         se += diff;
139         sse += diff * diff;
140 #if CONFIG_VP9_HIGHBITDEPTH
141       } else {
142         uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
143         uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
144         const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
145         const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
146         const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
147         const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
148         const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
149         const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
150         const int r = a + (((b - a) * yoff + 8) >> 4);
151         const int diff = r - src16[w * y + x];
152         se += diff;
153         sse += diff * diff;
154 #endif  // CONFIG_VP9_HIGHBITDEPTH
155       }
156     }
157   }
158   RoundHighBitDepth(bit_depth, &se, &sse);
159   *sse_ptr = static_cast<uint32_t>(sse);
160   return static_cast<uint32_t>(
161       sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
162 }
163
164 static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
165                                         const uint8_t *second_pred, int l2w,
166                                         int l2h, int xoff, int yoff,
167                                         uint32_t *sse_ptr,
168                                         bool use_high_bit_depth,
169                                         vpx_bit_depth_t bit_depth) {
170   int64_t se = 0;
171   uint64_t sse = 0;
172   const int w = 1 << l2w;
173   const int h = 1 << l2h;
174
175   xoff <<= 1;
176   yoff <<= 1;
177
178   for (int y = 0; y < h; y++) {
179     for (int x = 0; x < w; x++) {
180       // bilinear interpolation at a 16th pel step
181       if (!use_high_bit_depth) {
182         const int a1 = ref[(w + 1) * (y + 0) + x + 0];
183         const int a2 = ref[(w + 1) * (y + 0) + x + 1];
184         const int b1 = ref[(w + 1) * (y + 1) + x + 0];
185         const int b2 = ref[(w + 1) * (y + 1) + x + 1];
186         const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
187         const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
188         const int r = a + (((b - a) * yoff + 8) >> 4);
189         const int diff =
190             ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
191         se += diff;
192         sse += diff * diff;
193 #if CONFIG_VP9_HIGHBITDEPTH
194       } else {
195         const uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
196         const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
197         const uint16_t *sec16 = CONVERT_TO_SHORTPTR(second_pred);
198         const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
199         const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
200         const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
201         const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
202         const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
203         const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
204         const int r = a + (((b - a) * yoff + 8) >> 4);
205         const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
206         se += diff;
207         sse += diff * diff;
208 #endif  // CONFIG_VP9_HIGHBITDEPTH
209       }
210     }
211   }
212   RoundHighBitDepth(bit_depth, &se, &sse);
213   *sse_ptr = static_cast<uint32_t>(sse);
214   return static_cast<uint32_t>(
215       sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
216 }
217
218 ////////////////////////////////////////////////////////////////////////////////
219
220 class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
221  public:
222   SumOfSquaresTest() : func_(GetParam()) {}
223
224   virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
225
226  protected:
227   void ConstTest();
228   void RefTest();
229
230   SumOfSquaresFunction func_;
231   ACMRandom rnd_;
232 };
233
234 void SumOfSquaresTest::ConstTest() {
235   int16_t mem[256];
236   unsigned int res;
237   for (int v = 0; v < 256; ++v) {
238     for (int i = 0; i < 256; ++i) {
239       mem[i] = v;
240     }
241     ASM_REGISTER_STATE_CHECK(res = func_(mem));
242     EXPECT_EQ(256u * (v * v), res);
243   }
244 }
245
246 void SumOfSquaresTest::RefTest() {
247   int16_t mem[256];
248   for (int i = 0; i < 100; ++i) {
249     for (int j = 0; j < 256; ++j) {
250       mem[j] = rnd_.Rand8() - rnd_.Rand8();
251     }
252
253     const unsigned int expected = mb_ss_ref(mem);
254     unsigned int res;
255     ASM_REGISTER_STATE_CHECK(res = func_(mem));
256     EXPECT_EQ(expected, res);
257   }
258 }
259
260 ////////////////////////////////////////////////////////////////////////////////
261 // Encapsulating struct to store the function to test along with
262 // some testing context.
263 // Can be used for MSE, SSE, Variance, etc.
264
265 template <typename Func>
266 struct TestParams {
267   TestParams(int log2w = 0, int log2h = 0, Func function = NULL,
268              int bit_depth_value = 0)
269       : log2width(log2w), log2height(log2h), func(function) {
270     use_high_bit_depth = (bit_depth_value > 0);
271     if (use_high_bit_depth) {
272       bit_depth = static_cast<vpx_bit_depth_t>(bit_depth_value);
273     } else {
274       bit_depth = VPX_BITS_8;
275     }
276     width = 1 << log2width;
277     height = 1 << log2height;
278     block_size = width * height;
279     mask = (1u << bit_depth) - 1;
280   }
281
282   int log2width, log2height;
283   int width, height;
284   int block_size;
285   Func func;
286   vpx_bit_depth_t bit_depth;
287   bool use_high_bit_depth;
288   uint32_t mask;
289 };
290
291 template <typename Func>
292 std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {
293   return os << "log2width/height:" << p.log2width << "/" << p.log2height
294             << " function:" << reinterpret_cast<const void *>(p.func)
295             << " bit-depth:" << p.bit_depth;
296 }
297
298 // Main class for testing a function type
299 template <typename FunctionType>
300 class MainTestClass
301     : public ::testing::TestWithParam<TestParams<FunctionType> > {
302  public:
303   virtual void SetUp() {
304     params_ = this->GetParam();
305
306     rnd_.Reset(ACMRandom::DeterministicSeed());
307     const size_t unit =
308         use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
309     src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size() * unit));
310     ref_ = new uint8_t[block_size() * unit];
311     ASSERT_TRUE(src_ != NULL);
312     ASSERT_TRUE(ref_ != NULL);
313 #if CONFIG_VP9_HIGHBITDEPTH
314     if (use_high_bit_depth()) {
315       // TODO(skal): remove!
316       src_ = CONVERT_TO_BYTEPTR(src_);
317       ref_ = CONVERT_TO_BYTEPTR(ref_);
318     }
319 #endif
320   }
321
322   virtual void TearDown() {
323 #if CONFIG_VP9_HIGHBITDEPTH
324     if (use_high_bit_depth()) {
325       // TODO(skal): remove!
326       src_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(src_));
327       ref_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(ref_));
328     }
329 #endif
330
331     vpx_free(src_);
332     delete[] ref_;
333     src_ = NULL;
334     ref_ = NULL;
335     libvpx_test::ClearSystemState();
336   }
337
338  protected:
339   // We could sub-class MainTestClass into dedicated class for Variance
340   // and MSE/SSE, but it involves a lot of 'this->xxx' dereferencing
341   // to access top class fields xxx. That's cumbersome, so for now we'll just
342   // implement the testing methods here:
343
344   // Variance tests
345   void ZeroTest();
346   void RefTest();
347   void RefStrideTest();
348   void OneQuarterTest();
349   void SpeedTest();
350
351   // MSE/SSE tests
352   void RefTestMse();
353   void RefTestSse();
354   void MaxTestMse();
355   void MaxTestSse();
356
357  protected:
358   ACMRandom rnd_;
359   uint8_t *src_;
360   uint8_t *ref_;
361   TestParams<FunctionType> params_;
362
363   // some relay helpers
364   bool use_high_bit_depth() const { return params_.use_high_bit_depth; }
365   int byte_shift() const { return params_.bit_depth - 8; }
366   int block_size() const { return params_.block_size; }
367   int width() const { return params_.width; }
368   int height() const { return params_.height; }
369   uint32_t mask() const { return params_.mask; }
370 };
371
372 ////////////////////////////////////////////////////////////////////////////////
373 // Tests related to variance.
374
375 template <typename VarianceFunctionType>
376 void MainTestClass<VarianceFunctionType>::ZeroTest() {
377   for (int i = 0; i <= 255; ++i) {
378     if (!use_high_bit_depth()) {
379       memset(src_, i, block_size());
380     } else {
381       uint16_t *const src16 = CONVERT_TO_SHORTPTR(src_);
382       for (int k = 0; k < block_size(); ++k) src16[k] = i << byte_shift();
383     }
384     for (int j = 0; j <= 255; ++j) {
385       if (!use_high_bit_depth()) {
386         memset(ref_, j, block_size());
387       } else {
388         uint16_t *const ref16 = CONVERT_TO_SHORTPTR(ref_);
389         for (int k = 0; k < block_size(); ++k) ref16[k] = j << byte_shift();
390       }
391       unsigned int sse, var;
392       ASM_REGISTER_STATE_CHECK(
393           var = params_.func(src_, width(), ref_, width(), &sse));
394       EXPECT_EQ(0u, var) << "src values: " << i << " ref values: " << j;
395     }
396   }
397 }
398
399 template <typename VarianceFunctionType>
400 void MainTestClass<VarianceFunctionType>::RefTest() {
401   for (int i = 0; i < 10; ++i) {
402     for (int j = 0; j < block_size(); j++) {
403       if (!use_high_bit_depth()) {
404         src_[j] = rnd_.Rand8();
405         ref_[j] = rnd_.Rand8();
406 #if CONFIG_VP9_HIGHBITDEPTH
407       } else {
408         CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask();
409         CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask();
410 #endif  // CONFIG_VP9_HIGHBITDEPTH
411       }
412     }
413     unsigned int sse1, sse2, var1, var2;
414     const int stride = width();
415     ASM_REGISTER_STATE_CHECK(
416         var1 = params_.func(src_, stride, ref_, stride, &sse1));
417     var2 =
418         variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
419                      stride, &sse2, use_high_bit_depth(), params_.bit_depth);
420     EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
421     EXPECT_EQ(var1, var2) << "Error at test index: " << i;
422   }
423 }
424
425 template <typename VarianceFunctionType>
426 void MainTestClass<VarianceFunctionType>::RefStrideTest() {
427   for (int i = 0; i < 10; ++i) {
428     const int ref_stride = (i & 1) * width();
429     const int src_stride = ((i >> 1) & 1) * width();
430     for (int j = 0; j < block_size(); j++) {
431       const int ref_ind = (j / width()) * ref_stride + j % width();
432       const int src_ind = (j / width()) * src_stride + j % width();
433       if (!use_high_bit_depth()) {
434         src_[src_ind] = rnd_.Rand8();
435         ref_[ref_ind] = rnd_.Rand8();
436 #if CONFIG_VP9_HIGHBITDEPTH
437       } else {
438         CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() & mask();
439         CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() & mask();
440 #endif  // CONFIG_VP9_HIGHBITDEPTH
441       }
442     }
443     unsigned int sse1, sse2;
444     unsigned int var1, var2;
445
446     ASM_REGISTER_STATE_CHECK(
447         var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
448     var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
449                         src_stride, ref_stride, &sse2, use_high_bit_depth(),
450                         params_.bit_depth);
451     EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
452     EXPECT_EQ(var1, var2) << "Error at test index: " << i;
453   }
454 }
455
456 template <typename VarianceFunctionType>
457 void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
458   const int half = block_size() / 2;
459   if (!use_high_bit_depth()) {
460     memset(src_, 255, block_size());
461     memset(ref_, 255, half);
462     memset(ref_ + half, 0, half);
463 #if CONFIG_VP9_HIGHBITDEPTH
464   } else {
465     vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size());
466     vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << byte_shift(), half);
467     vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
468 #endif  // CONFIG_VP9_HIGHBITDEPTH
469   }
470   unsigned int sse, var, expected;
471   ASM_REGISTER_STATE_CHECK(
472       var = params_.func(src_, width(), ref_, width(), &sse));
473   expected = block_size() * 255 * 255 / 4;
474   EXPECT_EQ(expected, var);
475 }
476
477 template <typename VarianceFunctionType>
478 void MainTestClass<VarianceFunctionType>::SpeedTest() {
479   const int half = block_size() / 2;
480   if (!use_high_bit_depth()) {
481     memset(src_, 255, block_size());
482     memset(ref_, 255, half);
483     memset(ref_ + half, 0, half);
484 #if CONFIG_VP9_HIGHBITDEPTH
485   } else {
486     vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size());
487     vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << byte_shift(), half);
488     vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
489 #endif  // CONFIG_VP9_HIGHBITDEPTH
490   }
491   unsigned int sse;
492
493   vpx_usec_timer timer;
494   vpx_usec_timer_start(&timer);
495   for (int i = 0; i < 100000000 / block_size(); ++i) {
496     const uint32_t variance = params_.func(src_, width(), ref_, width(), &sse);
497     // Ignore return value.
498     (void)variance;
499   }
500   vpx_usec_timer_mark(&timer);
501   const int elapsed_time = static_cast<int>(vpx_usec_timer_elapsed(&timer));
502   printf("Variance %dx%d time: %5d ms\n", width(), height(),
503          elapsed_time / 1000);
504 }
505
506 ////////////////////////////////////////////////////////////////////////////////
507 // Tests related to MSE / SSE.
508
509 template <typename FunctionType>
510 void MainTestClass<FunctionType>::RefTestMse() {
511   for (int i = 0; i < 10; ++i) {
512     for (int j = 0; j < block_size(); ++j) {
513       src_[j] = rnd_.Rand8();
514       ref_[j] = rnd_.Rand8();
515     }
516     unsigned int sse1, sse2;
517     const int stride = width();
518     ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
519     variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
520                  stride, &sse2, false, VPX_BITS_8);
521     EXPECT_EQ(sse1, sse2);
522   }
523 }
524
525 template <typename FunctionType>
526 void MainTestClass<FunctionType>::RefTestSse() {
527   for (int i = 0; i < 10; ++i) {
528     for (int j = 0; j < block_size(); ++j) {
529       src_[j] = rnd_.Rand8();
530       ref_[j] = rnd_.Rand8();
531     }
532     unsigned int sse2;
533     unsigned int var1;
534     const int stride = width();
535     ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
536     variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
537                  stride, &sse2, false, VPX_BITS_8);
538     EXPECT_EQ(var1, sse2);
539   }
540 }
541
542 template <typename FunctionType>
543 void MainTestClass<FunctionType>::MaxTestMse() {
544   memset(src_, 255, block_size());
545   memset(ref_, 0, block_size());
546   unsigned int sse;
547   ASM_REGISTER_STATE_CHECK(params_.func(src_, width(), ref_, width(), &sse));
548   const unsigned int expected = block_size() * 255 * 255;
549   EXPECT_EQ(expected, sse);
550 }
551
552 template <typename FunctionType>
553 void MainTestClass<FunctionType>::MaxTestSse() {
554   memset(src_, 255, block_size());
555   memset(ref_, 0, block_size());
556   unsigned int var;
557   ASM_REGISTER_STATE_CHECK(var = params_.func(src_, width(), ref_, width()));
558   const unsigned int expected = block_size() * 255 * 255;
559   EXPECT_EQ(expected, var);
560 }
561
562 ////////////////////////////////////////////////////////////////////////////////
563
564 using ::std::tr1::get;
565 using ::std::tr1::make_tuple;
566 using ::std::tr1::tuple;
567
568 template <typename SubpelVarianceFunctionType>
569 class SubpelVarianceTest
570     : public ::testing::TestWithParam<
571           tuple<int, int, SubpelVarianceFunctionType, int> > {
572  public:
573   virtual void SetUp() {
574     const tuple<int, int, SubpelVarianceFunctionType, int> &params =
575         this->GetParam();
576     log2width_ = get<0>(params);
577     width_ = 1 << log2width_;
578     log2height_ = get<1>(params);
579     height_ = 1 << log2height_;
580     subpel_variance_ = get<2>(params);
581     if (get<3>(params)) {
582       bit_depth_ = (vpx_bit_depth_t)get<3>(params);
583       use_high_bit_depth_ = true;
584     } else {
585       bit_depth_ = VPX_BITS_8;
586       use_high_bit_depth_ = false;
587     }
588     mask_ = (1 << bit_depth_) - 1;
589
590     rnd_.Reset(ACMRandom::DeterministicSeed());
591     block_size_ = width_ * height_;
592     if (!use_high_bit_depth_) {
593       src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
594       sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
595       ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
596 #if CONFIG_VP9_HIGHBITDEPTH
597     } else {
598       src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
599           vpx_memalign(16, block_size_ * sizeof(uint16_t))));
600       sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
601           vpx_memalign(16, block_size_ * sizeof(uint16_t))));
602       ref_ =
603           CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
604 #endif  // CONFIG_VP9_HIGHBITDEPTH
605     }
606     ASSERT_TRUE(src_ != NULL);
607     ASSERT_TRUE(sec_ != NULL);
608     ASSERT_TRUE(ref_ != NULL);
609   }
610
611   virtual void TearDown() {
612     if (!use_high_bit_depth_) {
613       vpx_free(src_);
614       delete[] ref_;
615       vpx_free(sec_);
616 #if CONFIG_VP9_HIGHBITDEPTH
617     } else {
618       vpx_free(CONVERT_TO_SHORTPTR(src_));
619       delete[] CONVERT_TO_SHORTPTR(ref_);
620       vpx_free(CONVERT_TO_SHORTPTR(sec_));
621 #endif  // CONFIG_VP9_HIGHBITDEPTH
622     }
623     libvpx_test::ClearSystemState();
624   }
625
626  protected:
627   void RefTest();
628   void ExtremeRefTest();
629
630   ACMRandom rnd_;
631   uint8_t *src_;
632   uint8_t *ref_;
633   uint8_t *sec_;
634   bool use_high_bit_depth_;
635   vpx_bit_depth_t bit_depth_;
636   int width_, log2width_;
637   int height_, log2height_;
638   int block_size_, mask_;
639   SubpelVarianceFunctionType subpel_variance_;
640 };
641
642 template <typename SubpelVarianceFunctionType>
643 void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
644   for (int x = 0; x < 8; ++x) {
645     for (int y = 0; y < 8; ++y) {
646       if (!use_high_bit_depth_) {
647         for (int j = 0; j < block_size_; j++) {
648           src_[j] = rnd_.Rand8();
649         }
650         for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
651           ref_[j] = rnd_.Rand8();
652         }
653 #if CONFIG_VP9_HIGHBITDEPTH
654       } else {
655         for (int j = 0; j < block_size_; j++) {
656           CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
657         }
658         for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
659           CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
660         }
661 #endif  // CONFIG_VP9_HIGHBITDEPTH
662       }
663       unsigned int sse1, sse2;
664       unsigned int var1;
665       ASM_REGISTER_STATE_CHECK(
666           var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
667       const unsigned int var2 =
668           subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
669                               use_high_bit_depth_, bit_depth_);
670       EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
671       EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
672     }
673   }
674 }
675
676 template <typename SubpelVarianceFunctionType>
677 void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
678   // Compare against reference.
679   // Src: Set the first half of values to 0, the second half to the maximum.
680   // Ref: Set the first half of values to the maximum, the second half to 0.
681   for (int x = 0; x < 8; ++x) {
682     for (int y = 0; y < 8; ++y) {
683       const int half = block_size_ / 2;
684       if (!use_high_bit_depth_) {
685         memset(src_, 0, half);
686         memset(src_ + half, 255, half);
687         memset(ref_, 255, half);
688         memset(ref_ + half, 0, half + width_ + height_ + 1);
689 #if CONFIG_VP9_HIGHBITDEPTH
690       } else {
691         vpx_memset16(CONVERT_TO_SHORTPTR(src_), mask_, half);
692         vpx_memset16(CONVERT_TO_SHORTPTR(src_) + half, 0, half);
693         vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, half);
694         vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, mask_,
695                      half + width_ + height_ + 1);
696 #endif  // CONFIG_VP9_HIGHBITDEPTH
697       }
698       unsigned int sse1, sse2;
699       unsigned int var1;
700       ASM_REGISTER_STATE_CHECK(
701           var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
702       const unsigned int var2 =
703           subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
704                               use_high_bit_depth_, bit_depth_);
705       EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
706       EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
707     }
708   }
709 }
710
711 template <>
712 void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
713   for (int x = 0; x < 8; ++x) {
714     for (int y = 0; y < 8; ++y) {
715       if (!use_high_bit_depth_) {
716         for (int j = 0; j < block_size_; j++) {
717           src_[j] = rnd_.Rand8();
718           sec_[j] = rnd_.Rand8();
719         }
720         for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
721           ref_[j] = rnd_.Rand8();
722         }
723 #if CONFIG_VP9_HIGHBITDEPTH
724       } else {
725         for (int j = 0; j < block_size_; j++) {
726           CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
727           CONVERT_TO_SHORTPTR(sec_)[j] = rnd_.Rand16() & mask_;
728         }
729         for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
730           CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
731         }
732 #endif  // CONFIG_VP9_HIGHBITDEPTH
733       }
734       uint32_t sse1, sse2;
735       uint32_t var1, var2;
736       ASM_REGISTER_STATE_CHECK(var1 =
737                                    subpel_variance_(ref_, width_ + 1, x, y,
738                                                     src_, width_, &sse1, sec_));
739       var2 = subpel_avg_variance_ref(ref_, src_, sec_, log2width_, log2height_,
740                                      x, y, &sse2, use_high_bit_depth_,
741                                      static_cast<vpx_bit_depth_t>(bit_depth_));
742       EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
743       EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
744     }
745   }
746 }
747
748 typedef MainTestClass<Get4x4SseFunc> VpxSseTest;
749 typedef MainTestClass<VarianceMxNFunc> VpxMseTest;
750 typedef MainTestClass<VarianceMxNFunc> VpxVarianceTest;
751 typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxSubpelVarianceTest;
752 typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxSubpelAvgVarianceTest;
753
754 TEST_P(VpxSseTest, RefSse) { RefTestSse(); }
755 TEST_P(VpxSseTest, MaxSse) { MaxTestSse(); }
756 TEST_P(VpxMseTest, RefMse) { RefTestMse(); }
757 TEST_P(VpxMseTest, MaxMse) { MaxTestMse(); }
758 TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
759 TEST_P(VpxVarianceTest, Ref) { RefTest(); }
760 TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
761 TEST_P(VpxVarianceTest, OneQuarter) { OneQuarterTest(); }
762 TEST_P(VpxVarianceTest, DISABLED_Speed) { SpeedTest(); }
763 TEST_P(SumOfSquaresTest, Const) { ConstTest(); }
764 TEST_P(SumOfSquaresTest, Ref) { RefTest(); }
765 TEST_P(VpxSubpelVarianceTest, Ref) { RefTest(); }
766 TEST_P(VpxSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
767 TEST_P(VpxSubpelAvgVarianceTest, Ref) { RefTest(); }
768
769 INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
770                         ::testing::Values(vpx_get_mb_ss_c));
771
772 typedef TestParams<Get4x4SseFunc> SseParams;
773 INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
774                         ::testing::Values(SseParams(2, 2,
775                                                     &vpx_get4x4sse_cs_c)));
776
777 typedef TestParams<VarianceMxNFunc> MseParams;
778 INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
779                         ::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
780                                           MseParams(4, 3, &vpx_mse16x8_c),
781                                           MseParams(3, 4, &vpx_mse8x16_c),
782                                           MseParams(3, 3, &vpx_mse8x8_c)));
783
784 typedef TestParams<VarianceMxNFunc> VarianceParams;
785 INSTANTIATE_TEST_CASE_P(
786     C, VpxVarianceTest,
787     ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_c),
788                       VarianceParams(6, 5, &vpx_variance64x32_c),
789                       VarianceParams(5, 6, &vpx_variance32x64_c),
790                       VarianceParams(5, 5, &vpx_variance32x32_c),
791                       VarianceParams(5, 4, &vpx_variance32x16_c),
792                       VarianceParams(4, 5, &vpx_variance16x32_c),
793                       VarianceParams(4, 4, &vpx_variance16x16_c),
794                       VarianceParams(4, 3, &vpx_variance16x8_c),
795                       VarianceParams(3, 4, &vpx_variance8x16_c),
796                       VarianceParams(3, 3, &vpx_variance8x8_c),
797                       VarianceParams(3, 2, &vpx_variance8x4_c),
798                       VarianceParams(2, 3, &vpx_variance4x8_c),
799                       VarianceParams(2, 2, &vpx_variance4x4_c)));
800
801 INSTANTIATE_TEST_CASE_P(
802     C, VpxSubpelVarianceTest,
803     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_c, 0),
804                       make_tuple(6, 5, &vpx_sub_pixel_variance64x32_c, 0),
805                       make_tuple(5, 6, &vpx_sub_pixel_variance32x64_c, 0),
806                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_c, 0),
807                       make_tuple(5, 4, &vpx_sub_pixel_variance32x16_c, 0),
808                       make_tuple(4, 5, &vpx_sub_pixel_variance16x32_c, 0),
809                       make_tuple(4, 4, &vpx_sub_pixel_variance16x16_c, 0),
810                       make_tuple(4, 3, &vpx_sub_pixel_variance16x8_c, 0),
811                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_c, 0),
812                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_c, 0),
813                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_c, 0),
814                       make_tuple(2, 3, &vpx_sub_pixel_variance4x8_c, 0),
815                       make_tuple(2, 2, &vpx_sub_pixel_variance4x4_c, 0)));
816
817 INSTANTIATE_TEST_CASE_P(
818     C, VpxSubpelAvgVarianceTest,
819     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_c, 0),
820                       make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_c, 0),
821                       make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_c, 0),
822                       make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_c, 0),
823                       make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_c, 0),
824                       make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_c, 0),
825                       make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_c, 0),
826                       make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_c, 0),
827                       make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_c, 0),
828                       make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_c, 0),
829                       make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_c, 0),
830                       make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_c, 0),
831                       make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_c, 0)));
832
833 #if CONFIG_VP9_HIGHBITDEPTH
834 typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
835 typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
836 typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
837 typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxHBDSubpelAvgVarianceTest;
838
839 TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
840 TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
841 TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); }
842 TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); }
843 TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); }
844 TEST_P(VpxHBDVarianceTest, OneQuarter) { OneQuarterTest(); }
845 TEST_P(VpxHBDVarianceTest, DISABLED_Speed) { SpeedTest(); }
846 TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); }
847 TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
848 TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); }
849
850 /* TODO(debargha): This test does not support the highbd version
851 INSTANTIATE_TEST_CASE_P(
852     C, VpxHBDMseTest,
853     ::testing::Values(make_tuple(4, 4, &vpx_highbd_12_mse16x16_c),
854                       make_tuple(4, 4, &vpx_highbd_12_mse16x8_c),
855                       make_tuple(4, 4, &vpx_highbd_12_mse8x16_c),
856                       make_tuple(4, 4, &vpx_highbd_12_mse8x8_c),
857                       make_tuple(4, 4, &vpx_highbd_10_mse16x16_c),
858                       make_tuple(4, 4, &vpx_highbd_10_mse16x8_c),
859                       make_tuple(4, 4, &vpx_highbd_10_mse8x16_c),
860                       make_tuple(4, 4, &vpx_highbd_10_mse8x8_c),
861                       make_tuple(4, 4, &vpx_highbd_8_mse16x16_c),
862                       make_tuple(4, 4, &vpx_highbd_8_mse16x8_c),
863                       make_tuple(4, 4, &vpx_highbd_8_mse8x16_c),
864                       make_tuple(4, 4, &vpx_highbd_8_mse8x8_c)));
865 */
866
867 INSTANTIATE_TEST_CASE_P(
868     C, VpxHBDVarianceTest,
869     ::testing::Values(VarianceParams(6, 6, &vpx_highbd_12_variance64x64_c, 12),
870                       VarianceParams(6, 5, &vpx_highbd_12_variance64x32_c, 12),
871                       VarianceParams(5, 6, &vpx_highbd_12_variance32x64_c, 12),
872                       VarianceParams(5, 5, &vpx_highbd_12_variance32x32_c, 12),
873                       VarianceParams(5, 4, &vpx_highbd_12_variance32x16_c, 12),
874                       VarianceParams(4, 5, &vpx_highbd_12_variance16x32_c, 12),
875                       VarianceParams(4, 4, &vpx_highbd_12_variance16x16_c, 12),
876                       VarianceParams(4, 3, &vpx_highbd_12_variance16x8_c, 12),
877                       VarianceParams(3, 4, &vpx_highbd_12_variance8x16_c, 12),
878                       VarianceParams(3, 3, &vpx_highbd_12_variance8x8_c, 12),
879                       VarianceParams(3, 2, &vpx_highbd_12_variance8x4_c, 12),
880                       VarianceParams(2, 3, &vpx_highbd_12_variance4x8_c, 12),
881                       VarianceParams(2, 2, &vpx_highbd_12_variance4x4_c, 12),
882                       VarianceParams(6, 6, &vpx_highbd_10_variance64x64_c, 10),
883                       VarianceParams(6, 5, &vpx_highbd_10_variance64x32_c, 10),
884                       VarianceParams(5, 6, &vpx_highbd_10_variance32x64_c, 10),
885                       VarianceParams(5, 5, &vpx_highbd_10_variance32x32_c, 10),
886                       VarianceParams(5, 4, &vpx_highbd_10_variance32x16_c, 10),
887                       VarianceParams(4, 5, &vpx_highbd_10_variance16x32_c, 10),
888                       VarianceParams(4, 4, &vpx_highbd_10_variance16x16_c, 10),
889                       VarianceParams(4, 3, &vpx_highbd_10_variance16x8_c, 10),
890                       VarianceParams(3, 4, &vpx_highbd_10_variance8x16_c, 10),
891                       VarianceParams(3, 3, &vpx_highbd_10_variance8x8_c, 10),
892                       VarianceParams(3, 2, &vpx_highbd_10_variance8x4_c, 10),
893                       VarianceParams(2, 3, &vpx_highbd_10_variance4x8_c, 10),
894                       VarianceParams(2, 2, &vpx_highbd_10_variance4x4_c, 10),
895                       VarianceParams(6, 6, &vpx_highbd_8_variance64x64_c, 8),
896                       VarianceParams(6, 5, &vpx_highbd_8_variance64x32_c, 8),
897                       VarianceParams(5, 6, &vpx_highbd_8_variance32x64_c, 8),
898                       VarianceParams(5, 5, &vpx_highbd_8_variance32x32_c, 8),
899                       VarianceParams(5, 4, &vpx_highbd_8_variance32x16_c, 8),
900                       VarianceParams(4, 5, &vpx_highbd_8_variance16x32_c, 8),
901                       VarianceParams(4, 4, &vpx_highbd_8_variance16x16_c, 8),
902                       VarianceParams(4, 3, &vpx_highbd_8_variance16x8_c, 8),
903                       VarianceParams(3, 4, &vpx_highbd_8_variance8x16_c, 8),
904                       VarianceParams(3, 3, &vpx_highbd_8_variance8x8_c, 8),
905                       VarianceParams(3, 2, &vpx_highbd_8_variance8x4_c, 8),
906                       VarianceParams(2, 3, &vpx_highbd_8_variance4x8_c, 8),
907                       VarianceParams(2, 2, &vpx_highbd_8_variance4x4_c, 8)));
908
909 INSTANTIATE_TEST_CASE_P(
910     C, VpxHBDSubpelVarianceTest,
911     ::testing::Values(
912         make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_c, 8),
913         make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_c, 8),
914         make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_c, 8),
915         make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_c, 8),
916         make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_c, 8),
917         make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_c, 8),
918         make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_c, 8),
919         make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_c, 8),
920         make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_c, 8),
921         make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_c, 8),
922         make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_c, 8),
923         make_tuple(2, 3, &vpx_highbd_8_sub_pixel_variance4x8_c, 8),
924         make_tuple(2, 2, &vpx_highbd_8_sub_pixel_variance4x4_c, 8),
925         make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_c, 10),
926         make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_c, 10),
927         make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_c, 10),
928         make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_c, 10),
929         make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_c, 10),
930         make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_c, 10),
931         make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_c, 10),
932         make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_c, 10),
933         make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_c, 10),
934         make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_c, 10),
935         make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_c, 10),
936         make_tuple(2, 3, &vpx_highbd_10_sub_pixel_variance4x8_c, 10),
937         make_tuple(2, 2, &vpx_highbd_10_sub_pixel_variance4x4_c, 10),
938         make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_c, 12),
939         make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_c, 12),
940         make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_c, 12),
941         make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_c, 12),
942         make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_c, 12),
943         make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_c, 12),
944         make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_c, 12),
945         make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_c, 12),
946         make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_c, 12),
947         make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_c, 12),
948         make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_c, 12),
949         make_tuple(2, 3, &vpx_highbd_12_sub_pixel_variance4x8_c, 12),
950         make_tuple(2, 2, &vpx_highbd_12_sub_pixel_variance4x4_c, 12)));
951
952 INSTANTIATE_TEST_CASE_P(
953     C, VpxHBDSubpelAvgVarianceTest,
954     ::testing::Values(
955         make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_c, 8),
956         make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_c, 8),
957         make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_c, 8),
958         make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_c, 8),
959         make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_c, 8),
960         make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_c, 8),
961         make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_c, 8),
962         make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_c, 8),
963         make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_c, 8),
964         make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_c, 8),
965         make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_c, 8),
966         make_tuple(2, 3, &vpx_highbd_8_sub_pixel_avg_variance4x8_c, 8),
967         make_tuple(2, 2, &vpx_highbd_8_sub_pixel_avg_variance4x4_c, 8),
968         make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_c, 10),
969         make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_c, 10),
970         make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_c, 10),
971         make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_c, 10),
972         make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_c, 10),
973         make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_c, 10),
974         make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_c, 10),
975         make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_c, 10),
976         make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_c, 10),
977         make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_c, 10),
978         make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_c, 10),
979         make_tuple(2, 3, &vpx_highbd_10_sub_pixel_avg_variance4x8_c, 10),
980         make_tuple(2, 2, &vpx_highbd_10_sub_pixel_avg_variance4x4_c, 10),
981         make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_c, 12),
982         make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_c, 12),
983         make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_c, 12),
984         make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_c, 12),
985         make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_c, 12),
986         make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_c, 12),
987         make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_c, 12),
988         make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_c, 12),
989         make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_c, 12),
990         make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_c, 12),
991         make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_c, 12),
992         make_tuple(2, 3, &vpx_highbd_12_sub_pixel_avg_variance4x8_c, 12),
993         make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12)));
994 #endif  // CONFIG_VP9_HIGHBITDEPTH
995
996 #if HAVE_SSE2
997 INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
998                         ::testing::Values(vpx_get_mb_ss_sse2));
999
1000 INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
1001                         ::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
1002                                           MseParams(4, 3, &vpx_mse16x8_sse2),
1003                                           MseParams(3, 4, &vpx_mse8x16_sse2),
1004                                           MseParams(3, 3, &vpx_mse8x8_sse2)));
1005
1006 INSTANTIATE_TEST_CASE_P(
1007     SSE2, VpxVarianceTest,
1008     ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_sse2),
1009                       VarianceParams(6, 5, &vpx_variance64x32_sse2),
1010                       VarianceParams(5, 6, &vpx_variance32x64_sse2),
1011                       VarianceParams(5, 5, &vpx_variance32x32_sse2),
1012                       VarianceParams(5, 4, &vpx_variance32x16_sse2),
1013                       VarianceParams(4, 5, &vpx_variance16x32_sse2),
1014                       VarianceParams(4, 4, &vpx_variance16x16_sse2),
1015                       VarianceParams(4, 3, &vpx_variance16x8_sse2),
1016                       VarianceParams(3, 4, &vpx_variance8x16_sse2),
1017                       VarianceParams(3, 3, &vpx_variance8x8_sse2),
1018                       VarianceParams(3, 2, &vpx_variance8x4_sse2),
1019                       VarianceParams(2, 3, &vpx_variance4x8_sse2),
1020                       VarianceParams(2, 2, &vpx_variance4x4_sse2)));
1021
1022 INSTANTIATE_TEST_CASE_P(
1023     SSE2, VpxSubpelVarianceTest,
1024     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_sse2, 0),
1025                       make_tuple(6, 5, &vpx_sub_pixel_variance64x32_sse2, 0),
1026                       make_tuple(5, 6, &vpx_sub_pixel_variance32x64_sse2, 0),
1027                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_sse2, 0),
1028                       make_tuple(5, 4, &vpx_sub_pixel_variance32x16_sse2, 0),
1029                       make_tuple(4, 5, &vpx_sub_pixel_variance16x32_sse2, 0),
1030                       make_tuple(4, 4, &vpx_sub_pixel_variance16x16_sse2, 0),
1031                       make_tuple(4, 3, &vpx_sub_pixel_variance16x8_sse2, 0),
1032                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_sse2, 0),
1033                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_sse2, 0),
1034                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_sse2, 0),
1035                       make_tuple(2, 3, &vpx_sub_pixel_variance4x8_sse2, 0),
1036                       make_tuple(2, 2, &vpx_sub_pixel_variance4x4_sse2, 0)));
1037
1038 INSTANTIATE_TEST_CASE_P(
1039     SSE2, VpxSubpelAvgVarianceTest,
1040     ::testing::Values(
1041         make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_sse2, 0),
1042         make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_sse2, 0),
1043         make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_sse2, 0),
1044         make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_sse2, 0),
1045         make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_sse2, 0),
1046         make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_sse2, 0),
1047         make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_sse2, 0),
1048         make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_sse2, 0),
1049         make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_sse2, 0),
1050         make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_sse2, 0),
1051         make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_sse2, 0),
1052         make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_sse2, 0),
1053         make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_sse2, 0)));
1054
1055 #if CONFIG_VP9_HIGHBITDEPTH
1056 /* TODO(debargha): This test does not support the highbd version
1057 INSTANTIATE_TEST_CASE_P(
1058     SSE2, VpxHBDMseTest,
1059     ::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_sse2),
1060                       MseParams(4, 3, &vpx_highbd_12_mse16x8_sse2),
1061                       MseParams(3, 4, &vpx_highbd_12_mse8x16_sse2),
1062                       MseParams(3, 3, &vpx_highbd_12_mse8x8_sse2),
1063                       MseParams(4, 4, &vpx_highbd_10_mse16x16_sse2),
1064                       MseParams(4, 3, &vpx_highbd_10_mse16x8_sse2),
1065                       MseParams(3, 4, &vpx_highbd_10_mse8x16_sse2),
1066                       MseParams(3, 3, &vpx_highbd_10_mse8x8_sse2),
1067                       MseParams(4, 4, &vpx_highbd_8_mse16x16_sse2),
1068                       MseParams(4, 3, &vpx_highbd_8_mse16x8_sse2),
1069                       MseParams(3, 4, &vpx_highbd_8_mse8x16_sse2),
1070                       MseParams(3, 3, &vpx_highbd_8_mse8x8_sse2)));
1071 */
1072
1073 INSTANTIATE_TEST_CASE_P(
1074     SSE2, VpxHBDVarianceTest,
1075     ::testing::Values(
1076         VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
1077         VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
1078         VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
1079         VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
1080         VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
1081         VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
1082         VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
1083         VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
1084         VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
1085         VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
1086         VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
1087         VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
1088         VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
1089         VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
1090         VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
1091         VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
1092         VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
1093         VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
1094         VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
1095         VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
1096         VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
1097         VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
1098         VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
1099         VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
1100         VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
1101         VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
1102         VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
1103         VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
1104         VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
1105         VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
1106
1107 INSTANTIATE_TEST_CASE_P(
1108     SSE2, VpxHBDSubpelVarianceTest,
1109     ::testing::Values(
1110         make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_sse2, 12),
1111         make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_sse2, 12),
1112         make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_sse2, 12),
1113         make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_sse2, 12),
1114         make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_sse2, 12),
1115         make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_sse2, 12),
1116         make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_sse2, 12),
1117         make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_sse2, 12),
1118         make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_sse2, 12),
1119         make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_sse2, 12),
1120         make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_sse2, 12),
1121         make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_sse2, 10),
1122         make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_sse2, 10),
1123         make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_sse2, 10),
1124         make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_sse2, 10),
1125         make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_sse2, 10),
1126         make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_sse2, 10),
1127         make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_sse2, 10),
1128         make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_sse2, 10),
1129         make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_sse2, 10),
1130         make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_sse2, 10),
1131         make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_sse2, 10),
1132         make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_sse2, 8),
1133         make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_sse2, 8),
1134         make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_sse2, 8),
1135         make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_sse2, 8),
1136         make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_sse2, 8),
1137         make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_sse2, 8),
1138         make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_sse2, 8),
1139         make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_sse2, 8),
1140         make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_sse2, 8),
1141         make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_sse2, 8),
1142         make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_sse2, 8)));
1143
1144 INSTANTIATE_TEST_CASE_P(
1145     SSE2, VpxHBDSubpelAvgVarianceTest,
1146     ::testing::Values(
1147         make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_sse2, 12),
1148         make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_sse2, 12),
1149         make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_sse2, 12),
1150         make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_sse2, 12),
1151         make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_sse2, 12),
1152         make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_sse2, 12),
1153         make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_sse2, 12),
1154         make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_sse2, 12),
1155         make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_sse2, 12),
1156         make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_sse2, 12),
1157         make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_sse2, 12),
1158         make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_sse2, 10),
1159         make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_sse2, 10),
1160         make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_sse2, 10),
1161         make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_sse2, 10),
1162         make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_sse2, 10),
1163         make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_sse2, 10),
1164         make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_sse2, 10),
1165         make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_sse2, 10),
1166         make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_sse2, 10),
1167         make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_sse2, 10),
1168         make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_sse2, 10),
1169         make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_sse2, 8),
1170         make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_sse2, 8),
1171         make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_sse2, 8),
1172         make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_sse2, 8),
1173         make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_sse2, 8),
1174         make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_sse2, 8),
1175         make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_sse2, 8),
1176         make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_sse2, 8),
1177         make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_sse2, 8),
1178         make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_sse2, 8),
1179         make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_sse2, 8)));
1180 #endif  // CONFIG_VP9_HIGHBITDEPTH
1181 #endif  // HAVE_SSE2
1182
1183 #if HAVE_SSSE3
1184 INSTANTIATE_TEST_CASE_P(
1185     SSSE3, VpxSubpelVarianceTest,
1186     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_ssse3, 0),
1187                       make_tuple(6, 5, &vpx_sub_pixel_variance64x32_ssse3, 0),
1188                       make_tuple(5, 6, &vpx_sub_pixel_variance32x64_ssse3, 0),
1189                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_ssse3, 0),
1190                       make_tuple(5, 4, &vpx_sub_pixel_variance32x16_ssse3, 0),
1191                       make_tuple(4, 5, &vpx_sub_pixel_variance16x32_ssse3, 0),
1192                       make_tuple(4, 4, &vpx_sub_pixel_variance16x16_ssse3, 0),
1193                       make_tuple(4, 3, &vpx_sub_pixel_variance16x8_ssse3, 0),
1194                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_ssse3, 0),
1195                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_ssse3, 0),
1196                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_ssse3, 0),
1197                       make_tuple(2, 3, &vpx_sub_pixel_variance4x8_ssse3, 0),
1198                       make_tuple(2, 2, &vpx_sub_pixel_variance4x4_ssse3, 0)));
1199
1200 INSTANTIATE_TEST_CASE_P(
1201     SSSE3, VpxSubpelAvgVarianceTest,
1202     ::testing::Values(
1203         make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_ssse3, 0),
1204         make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_ssse3, 0),
1205         make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_ssse3, 0),
1206         make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_ssse3, 0),
1207         make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_ssse3, 0),
1208         make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_ssse3, 0),
1209         make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_ssse3, 0),
1210         make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_ssse3, 0),
1211         make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_ssse3, 0),
1212         make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_ssse3, 0),
1213         make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_ssse3, 0),
1214         make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_ssse3, 0),
1215         make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_ssse3, 0)));
1216 #endif  // HAVE_SSSE3
1217
1218 #if HAVE_AVX2
1219 INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
1220                         ::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
1221
1222 INSTANTIATE_TEST_CASE_P(
1223     AVX2, VpxVarianceTest,
1224     ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_avx2),
1225                       VarianceParams(6, 5, &vpx_variance64x32_avx2),
1226                       VarianceParams(5, 5, &vpx_variance32x32_avx2),
1227                       VarianceParams(5, 4, &vpx_variance32x16_avx2),
1228                       VarianceParams(4, 4, &vpx_variance16x16_avx2)));
1229
1230 INSTANTIATE_TEST_CASE_P(
1231     AVX2, VpxSubpelVarianceTest,
1232     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_avx2, 0),
1233                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_avx2, 0)));
1234
1235 INSTANTIATE_TEST_CASE_P(
1236     AVX2, VpxSubpelAvgVarianceTest,
1237     ::testing::Values(
1238         make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_avx2, 0),
1239         make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_avx2, 0)));
1240 #endif  // HAVE_AVX2
1241
1242 #if HAVE_NEON
1243 INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
1244                         ::testing::Values(SseParams(2, 2,
1245                                                     &vpx_get4x4sse_cs_neon)));
1246
1247 INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
1248                         ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
1249
1250 INSTANTIATE_TEST_CASE_P(
1251     NEON, VpxVarianceTest,
1252     ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_neon),
1253                       VarianceParams(6, 5, &vpx_variance64x32_neon),
1254                       VarianceParams(5, 6, &vpx_variance32x64_neon),
1255                       VarianceParams(5, 5, &vpx_variance32x32_neon),
1256                       VarianceParams(5, 4, &vpx_variance32x16_neon),
1257                       VarianceParams(4, 5, &vpx_variance16x32_neon),
1258                       VarianceParams(4, 4, &vpx_variance16x16_neon),
1259                       VarianceParams(4, 3, &vpx_variance16x8_neon),
1260                       VarianceParams(3, 4, &vpx_variance8x16_neon),
1261                       VarianceParams(3, 3, &vpx_variance8x8_neon),
1262                       VarianceParams(3, 2, &vpx_variance8x4_neon)));
1263
1264 INSTANTIATE_TEST_CASE_P(
1265     NEON, VpxSubpelVarianceTest,
1266     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_neon, 0),
1267                       make_tuple(6, 5, &vpx_sub_pixel_variance64x32_neon, 0),
1268                       make_tuple(5, 6, &vpx_sub_pixel_variance32x64_neon, 0),
1269                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_neon, 0),
1270                       make_tuple(5, 4, &vpx_sub_pixel_variance32x16_neon, 0),
1271                       make_tuple(4, 5, &vpx_sub_pixel_variance16x32_neon, 0),
1272                       make_tuple(4, 4, &vpx_sub_pixel_variance16x16_neon, 0),
1273                       make_tuple(4, 3, &vpx_sub_pixel_variance16x8_neon, 0),
1274                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_neon, 0),
1275                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_neon, 0),
1276                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_neon, 0)));
1277 #endif  // HAVE_NEON
1278
1279 #if HAVE_MSA
1280 INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
1281                         ::testing::Values(vpx_get_mb_ss_msa));
1282
1283 INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
1284                         ::testing::Values(SseParams(2, 2,
1285                                                     &vpx_get4x4sse_cs_msa)));
1286
1287 INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
1288                         ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
1289                                           MseParams(4, 3, &vpx_mse16x8_msa),
1290                                           MseParams(3, 4, &vpx_mse8x16_msa),
1291                                           MseParams(3, 3, &vpx_mse8x8_msa)));
1292
1293 INSTANTIATE_TEST_CASE_P(
1294     MSA, VpxVarianceTest,
1295     ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_msa),
1296                       VarianceParams(6, 5, &vpx_variance64x32_msa),
1297                       VarianceParams(5, 6, &vpx_variance32x64_msa),
1298                       VarianceParams(5, 5, &vpx_variance32x32_msa),
1299                       VarianceParams(5, 4, &vpx_variance32x16_msa),
1300                       VarianceParams(4, 5, &vpx_variance16x32_msa),
1301                       VarianceParams(4, 4, &vpx_variance16x16_msa),
1302                       VarianceParams(4, 3, &vpx_variance16x8_msa),
1303                       VarianceParams(3, 4, &vpx_variance8x16_msa),
1304                       VarianceParams(3, 3, &vpx_variance8x8_msa),
1305                       VarianceParams(3, 2, &vpx_variance8x4_msa),
1306                       VarianceParams(2, 3, &vpx_variance4x8_msa),
1307                       VarianceParams(2, 2, &vpx_variance4x4_msa)));
1308
1309 INSTANTIATE_TEST_CASE_P(
1310     MSA, VpxSubpelVarianceTest,
1311     ::testing::Values(make_tuple(2, 2, &vpx_sub_pixel_variance4x4_msa, 0),
1312                       make_tuple(2, 3, &vpx_sub_pixel_variance4x8_msa, 0),
1313                       make_tuple(3, 2, &vpx_sub_pixel_variance8x4_msa, 0),
1314                       make_tuple(3, 3, &vpx_sub_pixel_variance8x8_msa, 0),
1315                       make_tuple(3, 4, &vpx_sub_pixel_variance8x16_msa, 0),
1316                       make_tuple(4, 3, &vpx_sub_pixel_variance16x8_msa, 0),
1317                       make_tuple(4, 4, &vpx_sub_pixel_variance16x16_msa, 0),
1318                       make_tuple(4, 5, &vpx_sub_pixel_variance16x32_msa, 0),
1319                       make_tuple(5, 4, &vpx_sub_pixel_variance32x16_msa, 0),
1320                       make_tuple(5, 5, &vpx_sub_pixel_variance32x32_msa, 0),
1321                       make_tuple(5, 6, &vpx_sub_pixel_variance32x64_msa, 0),
1322                       make_tuple(6, 5, &vpx_sub_pixel_variance64x32_msa, 0),
1323                       make_tuple(6, 6, &vpx_sub_pixel_variance64x64_msa, 0)));
1324
1325 INSTANTIATE_TEST_CASE_P(
1326     MSA, VpxSubpelAvgVarianceTest,
1327     ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_msa, 0),
1328                       make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_msa, 0),
1329                       make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_msa, 0),
1330                       make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_msa, 0),
1331                       make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_msa, 0),
1332                       make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_msa, 0),
1333                       make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_msa, 0),
1334                       make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_msa, 0),
1335                       make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_msa, 0),
1336                       make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_msa, 0),
1337                       make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_msa, 0),
1338                       make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_msa, 0),
1339                       make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_msa, 0)));
1340 #endif  // HAVE_MSA
1341
1342 #if HAVE_VSX
1343 INSTANTIATE_TEST_CASE_P(VSX, SumOfSquaresTest,
1344                         ::testing::Values(vpx_get_mb_ss_vsx));
1345
1346 INSTANTIATE_TEST_CASE_P(VSX, VpxSseTest,
1347                         ::testing::Values(SseParams(2, 2,
1348                                                     &vpx_get4x4sse_cs_vsx)));
1349 #endif  // HAVE_VSX
1350 }  // namespace