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