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