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
26namespace {
27
28typedef unsigned int (*VarianceMxNFunc)(const uint8_t *a, int a_stride,
29                                        const uint8_t *b, int b_stride,
30                                        unsigned int *sse);
31typedef 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);
35typedef 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);
40typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
41                                      const uint8_t *b, int b_stride);
42typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
43
44
45using ::std::tr1::get;
46using ::std::tr1::make_tuple;
47using ::std::tr1::tuple;
48using libvpx_test::ACMRandom;
49
50// Truncate high bit depth results by downshifting (with rounding) by:
51// 2 * (bit_depth - 8) for sse
52// (bit_depth - 8) for se
53static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
54  switch (bit_depth) {
55    case VPX_BITS_12:
56      *sse = (*sse + 128) >> 8;
57      *se = (*se + 8) >> 4;
58      break;
59    case VPX_BITS_10:
60      *sse = (*sse + 8) >> 4;
61      *se = (*se + 2) >> 2;
62      break;
63    case VPX_BITS_8:
64    default:
65      break;
66  }
67}
68
69static unsigned int mb_ss_ref(const int16_t *src) {
70  unsigned int res = 0;
71  for (int i = 0; i < 256; ++i) {
72    res += src[i] * src[i];
73  }
74  return res;
75}
76
77static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
78                             int l2w, int l2h, int src_stride_coeff,
79                             int ref_stride_coeff, 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 = ref[w * y * ref_stride_coeff + x] -
91               src[w * y * src_stride_coeff + x];
92        se += diff;
93        sse += diff * diff;
94#if CONFIG_VP9_HIGHBITDEPTH
95      } else {
96        diff = CONVERT_TO_SHORTPTR(ref)[w * y * ref_stride_coeff + x] -
97               CONVERT_TO_SHORTPTR(src)[w * y * src_stride_coeff + 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 */
117static 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
169class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
170 public:
171  SumOfSquaresTest() : func_(GetParam()) {}
172
173  virtual ~SumOfSquaresTest() {
174    libvpx_test::ClearSystemState();
175  }
176
177 protected:
178  void ConstTest();
179  void RefTest();
180
181  SumOfSquaresFunction func_;
182  ACMRandom rnd_;
183};
184
185void SumOfSquaresTest::ConstTest() {
186  int16_t mem[256];
187  unsigned int res;
188  for (int v = 0; v < 256; ++v) {
189    for (int i = 0; i < 256; ++i) {
190      mem[i] = v;
191    }
192    ASM_REGISTER_STATE_CHECK(res = func_(mem));
193    EXPECT_EQ(256u * (v * v), res);
194  }
195}
196
197void SumOfSquaresTest::RefTest() {
198  int16_t mem[256];
199  for (int i = 0; i < 100; ++i) {
200    for (int j = 0; j < 256; ++j) {
201      mem[j] = rnd_.Rand8() - rnd_.Rand8();
202    }
203
204    const unsigned int expected = mb_ss_ref(mem);
205    unsigned int res;
206    ASM_REGISTER_STATE_CHECK(res = func_(mem));
207    EXPECT_EQ(expected, res);
208  }
209}
210
211template<typename VarianceFunctionType>
212class VarianceTest
213    : public ::testing::TestWithParam<tuple<int, int,
214                                            VarianceFunctionType, int> > {
215 public:
216  virtual void SetUp() {
217    const tuple<int, int, VarianceFunctionType, int>& params = this->GetParam();
218    log2width_  = get<0>(params);
219    width_ = 1 << log2width_;
220    log2height_ = get<1>(params);
221    height_ = 1 << log2height_;
222    variance_ = get<2>(params);
223    if (get<3>(params)) {
224      bit_depth_ = static_cast<vpx_bit_depth_t>(get<3>(params));
225      use_high_bit_depth_ = true;
226    } else {
227      bit_depth_ = VPX_BITS_8;
228      use_high_bit_depth_ = false;
229    }
230    mask_ = (1 << bit_depth_) - 1;
231
232    rnd_.Reset(ACMRandom::DeterministicSeed());
233    block_size_ = width_ * height_;
234    if (!use_high_bit_depth_) {
235      src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_ * 2));
236      ref_ = new uint8_t[block_size_ * 2];
237#if CONFIG_VP9_HIGHBITDEPTH
238    } else {
239      src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
240          vpx_memalign(16, block_size_ * 2 * sizeof(uint16_t))));
241      ref_ = CONVERT_TO_BYTEPTR(new uint16_t[block_size_ * 2]);
242#endif  // CONFIG_VP9_HIGHBITDEPTH
243    }
244    ASSERT_TRUE(src_ != NULL);
245    ASSERT_TRUE(ref_ != NULL);
246  }
247
248  virtual void TearDown() {
249    if (!use_high_bit_depth_) {
250      vpx_free(src_);
251      delete[] ref_;
252#if CONFIG_VP9_HIGHBITDEPTH
253    } else {
254      vpx_free(CONVERT_TO_SHORTPTR(src_));
255      delete[] CONVERT_TO_SHORTPTR(ref_);
256#endif  // CONFIG_VP9_HIGHBITDEPTH
257    }
258    libvpx_test::ClearSystemState();
259  }
260
261 protected:
262  void ZeroTest();
263  void RefTest();
264  void RefStrideTest();
265  void OneQuarterTest();
266
267  ACMRandom rnd_;
268  uint8_t *src_;
269  uint8_t *ref_;
270  int width_, log2width_;
271  int height_, log2height_;
272  vpx_bit_depth_t bit_depth_;
273  int mask_;
274  bool use_high_bit_depth_;
275  int block_size_;
276  VarianceFunctionType variance_;
277};
278
279template<typename VarianceFunctionType>
280void VarianceTest<VarianceFunctionType>::ZeroTest() {
281  for (int i = 0; i <= 255; ++i) {
282    if (!use_high_bit_depth_) {
283      memset(src_, i, block_size_);
284#if CONFIG_VP9_HIGHBITDEPTH
285    } else {
286      vpx_memset16(CONVERT_TO_SHORTPTR(src_), i << (bit_depth_ - 8),
287                   block_size_);
288#endif  // CONFIG_VP9_HIGHBITDEPTH
289    }
290    for (int j = 0; j <= 255; ++j) {
291      if (!use_high_bit_depth_) {
292        memset(ref_, j, block_size_);
293#if CONFIG_VP9_HIGHBITDEPTH
294      } else {
295        vpx_memset16(CONVERT_TO_SHORTPTR(ref_), j  << (bit_depth_ - 8),
296                     block_size_);
297#endif  // CONFIG_VP9_HIGHBITDEPTH
298      }
299      unsigned int sse;
300      unsigned int var;
301      ASM_REGISTER_STATE_CHECK(
302          var = variance_(src_, width_, ref_, width_, &sse));
303      EXPECT_EQ(0u, var) << "src values: " << i << " ref values: " << j;
304    }
305  }
306}
307
308template<typename VarianceFunctionType>
309void VarianceTest<VarianceFunctionType>::RefTest() {
310  for (int i = 0; i < 10; ++i) {
311    for (int j = 0; j < block_size_; j++) {
312    if (!use_high_bit_depth_) {
313      src_[j] = rnd_.Rand8();
314      ref_[j] = rnd_.Rand8();
315#if CONFIG_VP9_HIGHBITDEPTH
316    } else {
317      CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() && mask_;
318      CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() && mask_;
319#endif  // CONFIG_VP9_HIGHBITDEPTH
320    }
321    }
322    unsigned int sse1, sse2;
323    unsigned int var1;
324    const int stride_coeff = 1;
325    ASM_REGISTER_STATE_CHECK(
326        var1 = variance_(src_, width_, ref_, width_, &sse1));
327    const unsigned int var2 = variance_ref(src_, ref_, log2width_,
328                                           log2height_, stride_coeff,
329                                           stride_coeff, &sse2,
330                                           use_high_bit_depth_, bit_depth_);
331    EXPECT_EQ(sse1, sse2);
332    EXPECT_EQ(var1, var2);
333  }
334}
335
336template<typename VarianceFunctionType>
337void VarianceTest<VarianceFunctionType>::RefStrideTest() {
338  for (int i = 0; i < 10; ++i) {
339    int ref_stride_coeff = i % 2;
340    int src_stride_coeff = (i >> 1) % 2;
341    for (int j = 0; j < block_size_; j++) {
342      int ref_ind = (j / width_) * ref_stride_coeff * width_ + j % width_;
343      int src_ind = (j / width_) * src_stride_coeff * width_ + j % width_;
344      if (!use_high_bit_depth_) {
345        src_[src_ind] = rnd_.Rand8();
346        ref_[ref_ind] = rnd_.Rand8();
347#if CONFIG_VP9_HIGHBITDEPTH
348      } else {
349        CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() && mask_;
350        CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() && mask_;
351#endif  // CONFIG_VP9_HIGHBITDEPTH
352      }
353    }
354    unsigned int sse1, sse2;
355    unsigned int var1;
356
357    ASM_REGISTER_STATE_CHECK(
358        var1 = variance_(src_, width_ * src_stride_coeff,
359                         ref_, width_ * ref_stride_coeff, &sse1));
360    const unsigned int var2 = variance_ref(src_, ref_, log2width_,
361                                           log2height_, src_stride_coeff,
362                                           ref_stride_coeff, &sse2,
363                                           use_high_bit_depth_, bit_depth_);
364    EXPECT_EQ(sse1, sse2);
365    EXPECT_EQ(var1, var2);
366  }
367}
368
369template<typename VarianceFunctionType>
370void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
371  const int half = block_size_ / 2;
372  if (!use_high_bit_depth_) {
373    memset(src_, 255, block_size_);
374    memset(ref_, 255, half);
375    memset(ref_ + half, 0, half);
376#if CONFIG_VP9_HIGHBITDEPTH
377  } else {
378    vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << (bit_depth_ - 8),
379                 block_size_);
380    vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << (bit_depth_ - 8), half);
381    vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
382#endif  // CONFIG_VP9_HIGHBITDEPTH
383  }
384  unsigned int sse;
385  unsigned int var;
386  ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
387  const unsigned int expected = block_size_ * 255 * 255 / 4;
388  EXPECT_EQ(expected, var);
389}
390
391template<typename MseFunctionType>
392class MseTest
393    : public ::testing::TestWithParam<tuple<int, int, MseFunctionType> > {
394 public:
395  virtual void SetUp() {
396    const tuple<int, int, MseFunctionType>& params = this->GetParam();
397    log2width_  = get<0>(params);
398    width_ = 1 << log2width_;
399    log2height_ = get<1>(params);
400    height_ = 1 << log2height_;
401    mse_ = get<2>(params);
402
403    rnd(ACMRandom::DeterministicSeed());
404    block_size_ = width_ * height_;
405    src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
406    ref_ = new uint8_t[block_size_];
407    ASSERT_TRUE(src_ != NULL);
408    ASSERT_TRUE(ref_ != NULL);
409  }
410
411  virtual void TearDown() {
412    vpx_free(src_);
413    delete[] ref_;
414    libvpx_test::ClearSystemState();
415  }
416
417 protected:
418  void RefTest_mse();
419  void RefTest_sse();
420  void MaxTest_mse();
421  void MaxTest_sse();
422
423  ACMRandom rnd;
424  uint8_t* src_;
425  uint8_t* ref_;
426  int width_, log2width_;
427  int height_, log2height_;
428  int block_size_;
429  MseFunctionType mse_;
430};
431
432template<typename MseFunctionType>
433void MseTest<MseFunctionType>::RefTest_mse() {
434  for (int i = 0; i < 10; ++i) {
435    for (int j = 0; j < block_size_; j++) {
436      src_[j] = rnd.Rand8();
437      ref_[j] = rnd.Rand8();
438    }
439    unsigned int sse1, sse2;
440    const int stride_coeff = 1;
441    ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse1));
442    variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
443                 stride_coeff, &sse2, false, VPX_BITS_8);
444    EXPECT_EQ(sse1, sse2);
445  }
446}
447
448template<typename MseFunctionType>
449void MseTest<MseFunctionType>::RefTest_sse() {
450  for (int i = 0; i < 10; ++i) {
451    for (int j = 0; j < block_size_; j++) {
452      src_[j] = rnd.Rand8();
453      ref_[j] = rnd.Rand8();
454    }
455    unsigned int sse2;
456    unsigned int var1;
457    const int stride_coeff = 1;
458    ASM_REGISTER_STATE_CHECK(var1 = mse_(src_, width_, ref_, width_));
459    variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
460                 stride_coeff, &sse2, false, VPX_BITS_8);
461    EXPECT_EQ(var1, sse2);
462  }
463}
464
465template<typename MseFunctionType>
466void MseTest<MseFunctionType>::MaxTest_mse() {
467  memset(src_, 255, block_size_);
468  memset(ref_, 0, block_size_);
469  unsigned int sse;
470  ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse));
471  const unsigned int expected = block_size_ * 255 * 255;
472  EXPECT_EQ(expected, sse);
473}
474
475template<typename MseFunctionType>
476void MseTest<MseFunctionType>::MaxTest_sse() {
477  memset(src_, 255, block_size_);
478  memset(ref_, 0, block_size_);
479  unsigned int var;
480  ASM_REGISTER_STATE_CHECK(var = mse_(src_, width_, ref_, width_));
481  const unsigned int expected = block_size_ * 255 * 255;
482  EXPECT_EQ(expected, var);
483}
484
485static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
486                                        const uint8_t *src,
487                                        const uint8_t *second_pred,
488                                        int l2w, int l2h,
489                                        int xoff, int yoff,
490                                        uint32_t *sse_ptr,
491                                        bool use_high_bit_depth,
492                                        vpx_bit_depth_t bit_depth) {
493  int64_t se = 0;
494  uint64_t sse = 0;
495  const int w = 1 << l2w;
496  const int h = 1 << l2h;
497
498  xoff <<= 1;
499  yoff <<= 1;
500
501  for (int y = 0; y < h; y++) {
502    for (int x = 0; x < w; x++) {
503      // bilinear interpolation at a 16th pel step
504      if (!use_high_bit_depth) {
505        const int a1 = ref[(w + 1) * (y + 0) + x + 0];
506        const int a2 = ref[(w + 1) * (y + 0) + x + 1];
507        const int b1 = ref[(w + 1) * (y + 1) + x + 0];
508        const int b2 = ref[(w + 1) * (y + 1) + x + 1];
509        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
510        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
511        const int r = a + (((b - a) * yoff + 8) >> 4);
512        const int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
513        se += diff;
514        sse += diff * diff;
515#if CONFIG_VP9_HIGHBITDEPTH
516      } else {
517        uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
518        uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
519        uint16_t *sec16   = CONVERT_TO_SHORTPTR(second_pred);
520        const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
521        const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
522        const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
523        const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
524        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
525        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
526        const int r = a + (((b - a) * yoff + 8) >> 4);
527        const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
528        se += diff;
529        sse += diff * diff;
530#endif  // CONFIG_VP9_HIGHBITDEPTH
531      }
532    }
533  }
534  RoundHighBitDepth(bit_depth, &se, &sse);
535  *sse_ptr = static_cast<uint32_t>(sse);
536  return static_cast<uint32_t>(sse -
537                               ((static_cast<int64_t>(se) * se) >>
538                                (l2w + l2h)));
539}
540
541template<typename SubpelVarianceFunctionType>
542class SubpelVarianceTest
543    : public ::testing::TestWithParam<tuple<int, int,
544                                            SubpelVarianceFunctionType, int> > {
545 public:
546  virtual void SetUp() {
547    const tuple<int, int, SubpelVarianceFunctionType, int>& params =
548        this->GetParam();
549    log2width_  = get<0>(params);
550    width_ = 1 << log2width_;
551    log2height_ = get<1>(params);
552    height_ = 1 << log2height_;
553    subpel_variance_ = get<2>(params);
554    if (get<3>(params)) {
555      bit_depth_ = (vpx_bit_depth_t) get<3>(params);
556      use_high_bit_depth_ = true;
557    } else {
558      bit_depth_ = VPX_BITS_8;
559      use_high_bit_depth_ = false;
560    }
561    mask_ = (1 << bit_depth_)-1;
562
563    rnd_.Reset(ACMRandom::DeterministicSeed());
564    block_size_ = width_ * height_;
565    if (!use_high_bit_depth_) {
566      src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
567      sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
568      ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
569#if CONFIG_VP9_HIGHBITDEPTH
570    } else {
571      src_ = CONVERT_TO_BYTEPTR(
572          reinterpret_cast<uint16_t *>(
573              vpx_memalign(16, block_size_*sizeof(uint16_t))));
574      sec_ = CONVERT_TO_BYTEPTR(
575          reinterpret_cast<uint16_t *>(
576              vpx_memalign(16, block_size_*sizeof(uint16_t))));
577      ref_ = CONVERT_TO_BYTEPTR(
578          new uint16_t[block_size_ + width_ + height_ + 1]);
579#endif  // CONFIG_VP9_HIGHBITDEPTH
580    }
581    ASSERT_TRUE(src_ != NULL);
582    ASSERT_TRUE(sec_ != NULL);
583    ASSERT_TRUE(ref_ != NULL);
584  }
585
586  virtual void TearDown() {
587    if (!use_high_bit_depth_) {
588      vpx_free(src_);
589      delete[] ref_;
590      vpx_free(sec_);
591#if CONFIG_VP9_HIGHBITDEPTH
592    } else {
593      vpx_free(CONVERT_TO_SHORTPTR(src_));
594      delete[] CONVERT_TO_SHORTPTR(ref_);
595      vpx_free(CONVERT_TO_SHORTPTR(sec_));
596#endif  // CONFIG_VP9_HIGHBITDEPTH
597    }
598    libvpx_test::ClearSystemState();
599  }
600
601 protected:
602  void RefTest();
603  void ExtremeRefTest();
604
605  ACMRandom rnd_;
606  uint8_t *src_;
607  uint8_t *ref_;
608  uint8_t *sec_;
609  bool use_high_bit_depth_;
610  vpx_bit_depth_t bit_depth_;
611  int width_, log2width_;
612  int height_, log2height_;
613  int block_size_,  mask_;
614  SubpelVarianceFunctionType subpel_variance_;
615};
616
617template<typename SubpelVarianceFunctionType>
618void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
619  for (int x = 0; x < 8; ++x) {
620    for (int y = 0; y < 8; ++y) {
621      if (!use_high_bit_depth_) {
622        for (int j = 0; j < block_size_; j++) {
623          src_[j] = rnd_.Rand8();
624        }
625        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
626          ref_[j] = rnd_.Rand8();
627        }
628#if CONFIG_VP9_HIGHBITDEPTH
629      } else {
630        for (int j = 0; j < block_size_; j++) {
631          CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
632        }
633        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
634          CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
635        }
636#endif  // CONFIG_VP9_HIGHBITDEPTH
637      }
638      unsigned int sse1, sse2;
639      unsigned int var1;
640      ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
641                                                       src_, width_, &sse1));
642      const unsigned int var2 = subpel_variance_ref(ref_, src_,
643                                                    log2width_, log2height_,
644                                                    x, y, &sse2,
645                                                    use_high_bit_depth_,
646                                                    bit_depth_);
647      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
648      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
649    }
650  }
651}
652
653template<typename SubpelVarianceFunctionType>
654void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
655  // Compare against reference.
656  // Src: Set the first half of values to 0, the second half to the maximum.
657  // Ref: Set the first half of values to the maximum, the second half to 0.
658  for (int x = 0; x < 8; ++x) {
659    for (int y = 0; y < 8; ++y) {
660      const int half = block_size_ / 2;
661      if (!use_high_bit_depth_) {
662        memset(src_, 0, half);
663        memset(src_ + half, 255, half);
664        memset(ref_, 255, half);
665        memset(ref_ + half, 0, half + width_ + height_ + 1);
666#if CONFIG_VP9_HIGHBITDEPTH
667      } else {
668        vpx_memset16(CONVERT_TO_SHORTPTR(src_), mask_, half);
669        vpx_memset16(CONVERT_TO_SHORTPTR(src_) + half, 0, half);
670        vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, half);
671        vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, mask_,
672                     half + width_ + height_ + 1);
673#endif  // CONFIG_VP9_HIGHBITDEPTH
674      }
675      unsigned int sse1, sse2;
676      unsigned int var1;
677      ASM_REGISTER_STATE_CHECK(
678          var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
679      const unsigned int var2 =
680          subpel_variance_ref(ref_, src_, log2width_, log2height_,
681                              x, y, &sse2, use_high_bit_depth_, bit_depth_);
682      EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
683      EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
684    }
685  }
686}
687
688template<>
689void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
690  for (int x = 0; x < 8; ++x) {
691    for (int y = 0; y < 8; ++y) {
692      if (!use_high_bit_depth_) {
693        for (int j = 0; j < block_size_; j++) {
694          src_[j] = rnd_.Rand8();
695          sec_[j] = rnd_.Rand8();
696        }
697        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
698          ref_[j] = rnd_.Rand8();
699        }
700#if CONFIG_VP9_HIGHBITDEPTH
701      } else {
702        for (int j = 0; j < block_size_; j++) {
703          CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
704          CONVERT_TO_SHORTPTR(sec_)[j] = rnd_.Rand16() & mask_;
705        }
706        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
707          CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
708        }
709#endif  // CONFIG_VP9_HIGHBITDEPTH
710      }
711      unsigned int sse1, sse2;
712      unsigned int var1;
713      ASM_REGISTER_STATE_CHECK(
714          var1 = subpel_variance_(ref_, width_ + 1, x, y,
715                                  src_, width_, &sse1, sec_));
716      const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
717                                                        log2width_, log2height_,
718                                                        x, y, &sse2,
719                                                        use_high_bit_depth_,
720                                                        bit_depth_);
721      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
722      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
723    }
724  }
725}
726
727typedef MseTest<Get4x4SseFunc> VpxSseTest;
728typedef MseTest<VarianceMxNFunc> VpxMseTest;
729typedef VarianceTest<VarianceMxNFunc> VpxVarianceTest;
730typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxSubpelVarianceTest;
731typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxSubpelAvgVarianceTest;
732
733TEST_P(VpxSseTest, Ref_sse) { RefTest_sse(); }
734TEST_P(VpxSseTest, Max_sse) { MaxTest_sse(); }
735TEST_P(VpxMseTest, Ref_mse) { RefTest_mse(); }
736TEST_P(VpxMseTest, Max_mse) { MaxTest_mse(); }
737TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
738TEST_P(VpxVarianceTest, Ref) { RefTest(); }
739TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
740TEST_P(VpxVarianceTest, OneQuarter) { OneQuarterTest(); }
741TEST_P(SumOfSquaresTest, Const) { ConstTest(); }
742TEST_P(SumOfSquaresTest, Ref) { RefTest(); }
743TEST_P(VpxSubpelVarianceTest, Ref) { RefTest(); }
744TEST_P(VpxSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
745TEST_P(VpxSubpelAvgVarianceTest, Ref) { RefTest(); }
746
747INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
748                        ::testing::Values(vpx_get_mb_ss_c));
749
750const Get4x4SseFunc get4x4sse_cs_c = vpx_get4x4sse_cs_c;
751INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
752                        ::testing::Values(make_tuple(2, 2, get4x4sse_cs_c)));
753
754const VarianceMxNFunc mse16x16_c = vpx_mse16x16_c;
755const VarianceMxNFunc mse16x8_c = vpx_mse16x8_c;
756const VarianceMxNFunc mse8x16_c = vpx_mse8x16_c;
757const VarianceMxNFunc mse8x8_c = vpx_mse8x8_c;
758INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
759                        ::testing::Values(make_tuple(4, 4, mse16x16_c),
760                                          make_tuple(4, 3, mse16x8_c),
761                                          make_tuple(3, 4, mse8x16_c),
762                                          make_tuple(3, 3, mse8x8_c)));
763
764const VarianceMxNFunc variance64x64_c = vpx_variance64x64_c;
765const VarianceMxNFunc variance64x32_c = vpx_variance64x32_c;
766const VarianceMxNFunc variance32x64_c = vpx_variance32x64_c;
767const VarianceMxNFunc variance32x32_c = vpx_variance32x32_c;
768const VarianceMxNFunc variance32x16_c = vpx_variance32x16_c;
769const VarianceMxNFunc variance16x32_c = vpx_variance16x32_c;
770const VarianceMxNFunc variance16x16_c = vpx_variance16x16_c;
771const VarianceMxNFunc variance16x8_c = vpx_variance16x8_c;
772const VarianceMxNFunc variance8x16_c = vpx_variance8x16_c;
773const VarianceMxNFunc variance8x8_c = vpx_variance8x8_c;
774const VarianceMxNFunc variance8x4_c = vpx_variance8x4_c;
775const VarianceMxNFunc variance4x8_c = vpx_variance4x8_c;
776const VarianceMxNFunc variance4x4_c = vpx_variance4x4_c;
777INSTANTIATE_TEST_CASE_P(
778    C, VpxVarianceTest,
779    ::testing::Values(make_tuple(6, 6, variance64x64_c, 0),
780                      make_tuple(6, 5, variance64x32_c, 0),
781                      make_tuple(5, 6, variance32x64_c, 0),
782                      make_tuple(5, 5, variance32x32_c, 0),
783                      make_tuple(5, 4, variance32x16_c, 0),
784                      make_tuple(4, 5, variance16x32_c, 0),
785                      make_tuple(4, 4, variance16x16_c, 0),
786                      make_tuple(4, 3, variance16x8_c, 0),
787                      make_tuple(3, 4, variance8x16_c, 0),
788                      make_tuple(3, 3, variance8x8_c, 0),
789                      make_tuple(3, 2, variance8x4_c, 0),
790                      make_tuple(2, 3, variance4x8_c, 0),
791                      make_tuple(2, 2, variance4x4_c, 0)));
792
793const SubpixVarMxNFunc subpel_var64x64_c = vpx_sub_pixel_variance64x64_c;
794const SubpixVarMxNFunc subpel_var64x32_c = vpx_sub_pixel_variance64x32_c;
795const SubpixVarMxNFunc subpel_var32x64_c = vpx_sub_pixel_variance32x64_c;
796const SubpixVarMxNFunc subpel_var32x32_c = vpx_sub_pixel_variance32x32_c;
797const SubpixVarMxNFunc subpel_var32x16_c = vpx_sub_pixel_variance32x16_c;
798const SubpixVarMxNFunc subpel_var16x32_c = vpx_sub_pixel_variance16x32_c;
799const SubpixVarMxNFunc subpel_var16x16_c = vpx_sub_pixel_variance16x16_c;
800const SubpixVarMxNFunc subpel_var16x8_c = vpx_sub_pixel_variance16x8_c;
801const SubpixVarMxNFunc subpel_var8x16_c = vpx_sub_pixel_variance8x16_c;
802const SubpixVarMxNFunc subpel_var8x8_c = vpx_sub_pixel_variance8x8_c;
803const SubpixVarMxNFunc subpel_var8x4_c = vpx_sub_pixel_variance8x4_c;
804const SubpixVarMxNFunc subpel_var4x8_c = vpx_sub_pixel_variance4x8_c;
805const SubpixVarMxNFunc subpel_var4x4_c = vpx_sub_pixel_variance4x4_c;
806INSTANTIATE_TEST_CASE_P(
807    C, VpxSubpelVarianceTest,
808    ::testing::Values(make_tuple(6, 6, subpel_var64x64_c, 0),
809                      make_tuple(6, 5, subpel_var64x32_c, 0),
810                      make_tuple(5, 6, subpel_var32x64_c, 0),
811                      make_tuple(5, 5, subpel_var32x32_c, 0),
812                      make_tuple(5, 4, subpel_var32x16_c, 0),
813                      make_tuple(4, 5, subpel_var16x32_c, 0),
814                      make_tuple(4, 4, subpel_var16x16_c, 0),
815                      make_tuple(4, 3, subpel_var16x8_c, 0),
816                      make_tuple(3, 4, subpel_var8x16_c, 0),
817                      make_tuple(3, 3, subpel_var8x8_c, 0),
818                      make_tuple(3, 2, subpel_var8x4_c, 0),
819                      make_tuple(2, 3, subpel_var4x8_c, 0),
820                      make_tuple(2, 2, subpel_var4x4_c, 0)));
821
822const SubpixAvgVarMxNFunc subpel_avg_var64x64_c =
823    vpx_sub_pixel_avg_variance64x64_c;
824const SubpixAvgVarMxNFunc subpel_avg_var64x32_c =
825    vpx_sub_pixel_avg_variance64x32_c;
826const SubpixAvgVarMxNFunc subpel_avg_var32x64_c =
827    vpx_sub_pixel_avg_variance32x64_c;
828const SubpixAvgVarMxNFunc subpel_avg_var32x32_c =
829    vpx_sub_pixel_avg_variance32x32_c;
830const SubpixAvgVarMxNFunc subpel_avg_var32x16_c =
831    vpx_sub_pixel_avg_variance32x16_c;
832const SubpixAvgVarMxNFunc subpel_avg_var16x32_c =
833    vpx_sub_pixel_avg_variance16x32_c;
834const SubpixAvgVarMxNFunc subpel_avg_var16x16_c =
835    vpx_sub_pixel_avg_variance16x16_c;
836const SubpixAvgVarMxNFunc subpel_avg_var16x8_c =
837    vpx_sub_pixel_avg_variance16x8_c;
838const SubpixAvgVarMxNFunc subpel_avg_var8x16_c =
839    vpx_sub_pixel_avg_variance8x16_c;
840const SubpixAvgVarMxNFunc subpel_avg_var8x8_c = vpx_sub_pixel_avg_variance8x8_c;
841const SubpixAvgVarMxNFunc subpel_avg_var8x4_c = vpx_sub_pixel_avg_variance8x4_c;
842const SubpixAvgVarMxNFunc subpel_avg_var4x8_c = vpx_sub_pixel_avg_variance4x8_c;
843const SubpixAvgVarMxNFunc subpel_avg_var4x4_c = vpx_sub_pixel_avg_variance4x4_c;
844INSTANTIATE_TEST_CASE_P(
845    C, VpxSubpelAvgVarianceTest,
846    ::testing::Values(make_tuple(6, 6, subpel_avg_var64x64_c, 0),
847                      make_tuple(6, 5, subpel_avg_var64x32_c, 0),
848                      make_tuple(5, 6, subpel_avg_var32x64_c, 0),
849                      make_tuple(5, 5, subpel_avg_var32x32_c, 0),
850                      make_tuple(5, 4, subpel_avg_var32x16_c, 0),
851                      make_tuple(4, 5, subpel_avg_var16x32_c, 0),
852                      make_tuple(4, 4, subpel_avg_var16x16_c, 0),
853                      make_tuple(4, 3, subpel_avg_var16x8_c, 0),
854                      make_tuple(3, 4, subpel_avg_var8x16_c, 0),
855                      make_tuple(3, 3, subpel_avg_var8x8_c, 0),
856                      make_tuple(3, 2, subpel_avg_var8x4_c, 0),
857                      make_tuple(2, 3, subpel_avg_var4x8_c, 0),
858                      make_tuple(2, 2, subpel_avg_var4x4_c, 0)));
859
860#if CONFIG_VP9_HIGHBITDEPTH
861typedef MseTest<VarianceMxNFunc> VpxHBDMseTest;
862typedef VarianceTest<VarianceMxNFunc> VpxHBDVarianceTest;
863typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
864typedef SubpelVarianceTest<SubpixAvgVarMxNFunc>
865    VpxHBDSubpelAvgVarianceTest;
866
867TEST_P(VpxHBDMseTest, Ref_mse) { RefTest_mse(); }
868TEST_P(VpxHBDMseTest, Max_mse) { MaxTest_mse(); }
869TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); }
870TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); }
871TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); }
872TEST_P(VpxHBDVarianceTest, OneQuarter) { OneQuarterTest(); }
873TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); }
874TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
875TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); }
876
877/* TODO(debargha): This test does not support the highbd version
878const VarianceMxNFunc highbd_12_mse16x16_c = vpx_highbd_12_mse16x16_c;
879const VarianceMxNFunc highbd_12_mse16x8_c = vpx_highbd_12_mse16x8_c;
880const VarianceMxNFunc highbd_12_mse8x16_c = vpx_highbd_12_mse8x16_c;
881const VarianceMxNFunc highbd_12_mse8x8_c = vpx_highbd_12_mse8x8_c;
882
883const VarianceMxNFunc highbd_10_mse16x16_c = vpx_highbd_10_mse16x16_c;
884const VarianceMxNFunc highbd_10_mse16x8_c = vpx_highbd_10_mse16x8_c;
885const VarianceMxNFunc highbd_10_mse8x16_c = vpx_highbd_10_mse8x16_c;
886const VarianceMxNFunc highbd_10_mse8x8_c = vpx_highbd_10_mse8x8_c;
887
888const VarianceMxNFunc highbd_8_mse16x16_c = vpx_highbd_8_mse16x16_c;
889const VarianceMxNFunc highbd_8_mse16x8_c = vpx_highbd_8_mse16x8_c;
890const VarianceMxNFunc highbd_8_mse8x16_c = vpx_highbd_8_mse8x16_c;
891const VarianceMxNFunc highbd_8_mse8x8_c = vpx_highbd_8_mse8x8_c;
892INSTANTIATE_TEST_CASE_P(
893    C, VpxHBDMseTest, ::testing::Values(make_tuple(4, 4, highbd_12_mse16x16_c),
894                                        make_tuple(4, 4, highbd_12_mse16x8_c),
895                                        make_tuple(4, 4, highbd_12_mse8x16_c),
896                                        make_tuple(4, 4, highbd_12_mse8x8_c),
897                                        make_tuple(4, 4, highbd_10_mse16x16_c),
898                                        make_tuple(4, 4, highbd_10_mse16x8_c),
899                                        make_tuple(4, 4, highbd_10_mse8x16_c),
900                                        make_tuple(4, 4, highbd_10_mse8x8_c),
901                                        make_tuple(4, 4, highbd_8_mse16x16_c),
902                                        make_tuple(4, 4, highbd_8_mse16x8_c),
903                                        make_tuple(4, 4, highbd_8_mse8x16_c),
904                                        make_tuple(4, 4, highbd_8_mse8x8_c)));
905*/
906
907const VarianceMxNFunc highbd_12_variance64x64_c = vpx_highbd_12_variance64x64_c;
908const VarianceMxNFunc highbd_12_variance64x32_c = vpx_highbd_12_variance64x32_c;
909const VarianceMxNFunc highbd_12_variance32x64_c = vpx_highbd_12_variance32x64_c;
910const VarianceMxNFunc highbd_12_variance32x32_c = vpx_highbd_12_variance32x32_c;
911const VarianceMxNFunc highbd_12_variance32x16_c = vpx_highbd_12_variance32x16_c;
912const VarianceMxNFunc highbd_12_variance16x32_c = vpx_highbd_12_variance16x32_c;
913const VarianceMxNFunc highbd_12_variance16x16_c = vpx_highbd_12_variance16x16_c;
914const VarianceMxNFunc highbd_12_variance16x8_c = vpx_highbd_12_variance16x8_c;
915const VarianceMxNFunc highbd_12_variance8x16_c = vpx_highbd_12_variance8x16_c;
916const VarianceMxNFunc highbd_12_variance8x8_c = vpx_highbd_12_variance8x8_c;
917const VarianceMxNFunc highbd_12_variance8x4_c = vpx_highbd_12_variance8x4_c;
918const VarianceMxNFunc highbd_12_variance4x8_c = vpx_highbd_12_variance4x8_c;
919const VarianceMxNFunc highbd_12_variance4x4_c = vpx_highbd_12_variance4x4_c;
920const VarianceMxNFunc highbd_10_variance64x64_c = vpx_highbd_10_variance64x64_c;
921const VarianceMxNFunc highbd_10_variance64x32_c = vpx_highbd_10_variance64x32_c;
922const VarianceMxNFunc highbd_10_variance32x64_c = vpx_highbd_10_variance32x64_c;
923const VarianceMxNFunc highbd_10_variance32x32_c = vpx_highbd_10_variance32x32_c;
924const VarianceMxNFunc highbd_10_variance32x16_c = vpx_highbd_10_variance32x16_c;
925const VarianceMxNFunc highbd_10_variance16x32_c = vpx_highbd_10_variance16x32_c;
926const VarianceMxNFunc highbd_10_variance16x16_c = vpx_highbd_10_variance16x16_c;
927const VarianceMxNFunc highbd_10_variance16x8_c = vpx_highbd_10_variance16x8_c;
928const VarianceMxNFunc highbd_10_variance8x16_c = vpx_highbd_10_variance8x16_c;
929const VarianceMxNFunc highbd_10_variance8x8_c = vpx_highbd_10_variance8x8_c;
930const VarianceMxNFunc highbd_10_variance8x4_c = vpx_highbd_10_variance8x4_c;
931const VarianceMxNFunc highbd_10_variance4x8_c = vpx_highbd_10_variance4x8_c;
932const VarianceMxNFunc highbd_10_variance4x4_c = vpx_highbd_10_variance4x4_c;
933const VarianceMxNFunc highbd_8_variance64x64_c = vpx_highbd_8_variance64x64_c;
934const VarianceMxNFunc highbd_8_variance64x32_c = vpx_highbd_8_variance64x32_c;
935const VarianceMxNFunc highbd_8_variance32x64_c = vpx_highbd_8_variance32x64_c;
936const VarianceMxNFunc highbd_8_variance32x32_c = vpx_highbd_8_variance32x32_c;
937const VarianceMxNFunc highbd_8_variance32x16_c = vpx_highbd_8_variance32x16_c;
938const VarianceMxNFunc highbd_8_variance16x32_c = vpx_highbd_8_variance16x32_c;
939const VarianceMxNFunc highbd_8_variance16x16_c = vpx_highbd_8_variance16x16_c;
940const VarianceMxNFunc highbd_8_variance16x8_c = vpx_highbd_8_variance16x8_c;
941const VarianceMxNFunc highbd_8_variance8x16_c = vpx_highbd_8_variance8x16_c;
942const VarianceMxNFunc highbd_8_variance8x8_c = vpx_highbd_8_variance8x8_c;
943const VarianceMxNFunc highbd_8_variance8x4_c = vpx_highbd_8_variance8x4_c;
944const VarianceMxNFunc highbd_8_variance4x8_c = vpx_highbd_8_variance4x8_c;
945const VarianceMxNFunc highbd_8_variance4x4_c = vpx_highbd_8_variance4x4_c;
946INSTANTIATE_TEST_CASE_P(
947    C, VpxHBDVarianceTest,
948    ::testing::Values(make_tuple(6, 6, highbd_12_variance64x64_c, 12),
949                      make_tuple(6, 5, highbd_12_variance64x32_c, 12),
950                      make_tuple(5, 6, highbd_12_variance32x64_c, 12),
951                      make_tuple(5, 5, highbd_12_variance32x32_c, 12),
952                      make_tuple(5, 4, highbd_12_variance32x16_c, 12),
953                      make_tuple(4, 5, highbd_12_variance16x32_c, 12),
954                      make_tuple(4, 4, highbd_12_variance16x16_c, 12),
955                      make_tuple(4, 3, highbd_12_variance16x8_c, 12),
956                      make_tuple(3, 4, highbd_12_variance8x16_c, 12),
957                      make_tuple(3, 3, highbd_12_variance8x8_c, 12),
958                      make_tuple(3, 2, highbd_12_variance8x4_c, 12),
959                      make_tuple(2, 3, highbd_12_variance4x8_c, 12),
960                      make_tuple(2, 2, highbd_12_variance4x4_c, 12),
961                      make_tuple(6, 6, highbd_10_variance64x64_c, 10),
962                      make_tuple(6, 5, highbd_10_variance64x32_c, 10),
963                      make_tuple(5, 6, highbd_10_variance32x64_c, 10),
964                      make_tuple(5, 5, highbd_10_variance32x32_c, 10),
965                      make_tuple(5, 4, highbd_10_variance32x16_c, 10),
966                      make_tuple(4, 5, highbd_10_variance16x32_c, 10),
967                      make_tuple(4, 4, highbd_10_variance16x16_c, 10),
968                      make_tuple(4, 3, highbd_10_variance16x8_c, 10),
969                      make_tuple(3, 4, highbd_10_variance8x16_c, 10),
970                      make_tuple(3, 3, highbd_10_variance8x8_c, 10),
971                      make_tuple(3, 2, highbd_10_variance8x4_c, 10),
972                      make_tuple(2, 3, highbd_10_variance4x8_c, 10),
973                      make_tuple(2, 2, highbd_10_variance4x4_c, 10),
974                      make_tuple(6, 6, highbd_8_variance64x64_c, 8),
975                      make_tuple(6, 5, highbd_8_variance64x32_c, 8),
976                      make_tuple(5, 6, highbd_8_variance32x64_c, 8),
977                      make_tuple(5, 5, highbd_8_variance32x32_c, 8),
978                      make_tuple(5, 4, highbd_8_variance32x16_c, 8),
979                      make_tuple(4, 5, highbd_8_variance16x32_c, 8),
980                      make_tuple(4, 4, highbd_8_variance16x16_c, 8),
981                      make_tuple(4, 3, highbd_8_variance16x8_c, 8),
982                      make_tuple(3, 4, highbd_8_variance8x16_c, 8),
983                      make_tuple(3, 3, highbd_8_variance8x8_c, 8),
984                      make_tuple(3, 2, highbd_8_variance8x4_c, 8),
985                      make_tuple(2, 3, highbd_8_variance4x8_c, 8),
986                      make_tuple(2, 2, highbd_8_variance4x4_c, 8)));
987
988const SubpixVarMxNFunc highbd_8_subpel_var64x64_c =
989    vpx_highbd_8_sub_pixel_variance64x64_c;
990const SubpixVarMxNFunc highbd_8_subpel_var64x32_c =
991    vpx_highbd_8_sub_pixel_variance64x32_c;
992const SubpixVarMxNFunc highbd_8_subpel_var32x64_c =
993    vpx_highbd_8_sub_pixel_variance32x64_c;
994const SubpixVarMxNFunc highbd_8_subpel_var32x32_c =
995    vpx_highbd_8_sub_pixel_variance32x32_c;
996const SubpixVarMxNFunc highbd_8_subpel_var32x16_c =
997    vpx_highbd_8_sub_pixel_variance32x16_c;
998const SubpixVarMxNFunc highbd_8_subpel_var16x32_c =
999    vpx_highbd_8_sub_pixel_variance16x32_c;
1000const SubpixVarMxNFunc highbd_8_subpel_var16x16_c =
1001    vpx_highbd_8_sub_pixel_variance16x16_c;
1002const SubpixVarMxNFunc highbd_8_subpel_var16x8_c =
1003    vpx_highbd_8_sub_pixel_variance16x8_c;
1004const SubpixVarMxNFunc highbd_8_subpel_var8x16_c =
1005    vpx_highbd_8_sub_pixel_variance8x16_c;
1006const SubpixVarMxNFunc highbd_8_subpel_var8x8_c =
1007    vpx_highbd_8_sub_pixel_variance8x8_c;
1008const SubpixVarMxNFunc highbd_8_subpel_var8x4_c =
1009    vpx_highbd_8_sub_pixel_variance8x4_c;
1010const SubpixVarMxNFunc highbd_8_subpel_var4x8_c =
1011    vpx_highbd_8_sub_pixel_variance4x8_c;
1012const SubpixVarMxNFunc highbd_8_subpel_var4x4_c =
1013    vpx_highbd_8_sub_pixel_variance4x4_c;
1014const SubpixVarMxNFunc highbd_10_subpel_var64x64_c =
1015    vpx_highbd_10_sub_pixel_variance64x64_c;
1016const SubpixVarMxNFunc highbd_10_subpel_var64x32_c =
1017    vpx_highbd_10_sub_pixel_variance64x32_c;
1018const SubpixVarMxNFunc highbd_10_subpel_var32x64_c =
1019    vpx_highbd_10_sub_pixel_variance32x64_c;
1020const SubpixVarMxNFunc highbd_10_subpel_var32x32_c =
1021    vpx_highbd_10_sub_pixel_variance32x32_c;
1022const SubpixVarMxNFunc highbd_10_subpel_var32x16_c =
1023    vpx_highbd_10_sub_pixel_variance32x16_c;
1024const SubpixVarMxNFunc highbd_10_subpel_var16x32_c =
1025    vpx_highbd_10_sub_pixel_variance16x32_c;
1026const SubpixVarMxNFunc highbd_10_subpel_var16x16_c =
1027    vpx_highbd_10_sub_pixel_variance16x16_c;
1028const SubpixVarMxNFunc highbd_10_subpel_var16x8_c =
1029    vpx_highbd_10_sub_pixel_variance16x8_c;
1030const SubpixVarMxNFunc highbd_10_subpel_var8x16_c =
1031    vpx_highbd_10_sub_pixel_variance8x16_c;
1032const SubpixVarMxNFunc highbd_10_subpel_var8x8_c =
1033    vpx_highbd_10_sub_pixel_variance8x8_c;
1034const SubpixVarMxNFunc highbd_10_subpel_var8x4_c =
1035    vpx_highbd_10_sub_pixel_variance8x4_c;
1036const SubpixVarMxNFunc highbd_10_subpel_var4x8_c =
1037    vpx_highbd_10_sub_pixel_variance4x8_c;
1038const SubpixVarMxNFunc highbd_10_subpel_var4x4_c =
1039    vpx_highbd_10_sub_pixel_variance4x4_c;
1040const SubpixVarMxNFunc highbd_12_subpel_var64x64_c =
1041    vpx_highbd_12_sub_pixel_variance64x64_c;
1042const SubpixVarMxNFunc highbd_12_subpel_var64x32_c =
1043    vpx_highbd_12_sub_pixel_variance64x32_c;
1044const SubpixVarMxNFunc highbd_12_subpel_var32x64_c =
1045    vpx_highbd_12_sub_pixel_variance32x64_c;
1046const SubpixVarMxNFunc highbd_12_subpel_var32x32_c =
1047    vpx_highbd_12_sub_pixel_variance32x32_c;
1048const SubpixVarMxNFunc highbd_12_subpel_var32x16_c =
1049    vpx_highbd_12_sub_pixel_variance32x16_c;
1050const SubpixVarMxNFunc highbd_12_subpel_var16x32_c =
1051    vpx_highbd_12_sub_pixel_variance16x32_c;
1052const SubpixVarMxNFunc highbd_12_subpel_var16x16_c =
1053    vpx_highbd_12_sub_pixel_variance16x16_c;
1054const SubpixVarMxNFunc highbd_12_subpel_var16x8_c =
1055    vpx_highbd_12_sub_pixel_variance16x8_c;
1056const SubpixVarMxNFunc highbd_12_subpel_var8x16_c =
1057    vpx_highbd_12_sub_pixel_variance8x16_c;
1058const SubpixVarMxNFunc highbd_12_subpel_var8x8_c =
1059    vpx_highbd_12_sub_pixel_variance8x8_c;
1060const SubpixVarMxNFunc highbd_12_subpel_var8x4_c =
1061    vpx_highbd_12_sub_pixel_variance8x4_c;
1062const SubpixVarMxNFunc highbd_12_subpel_var4x8_c =
1063    vpx_highbd_12_sub_pixel_variance4x8_c;
1064const SubpixVarMxNFunc highbd_12_subpel_var4x4_c =
1065    vpx_highbd_12_sub_pixel_variance4x4_c;
1066INSTANTIATE_TEST_CASE_P(
1067    C, VpxHBDSubpelVarianceTest,
1068    ::testing::Values(make_tuple(6, 6, highbd_8_subpel_var64x64_c, 8),
1069                      make_tuple(6, 5, highbd_8_subpel_var64x32_c, 8),
1070                      make_tuple(5, 6, highbd_8_subpel_var32x64_c, 8),
1071                      make_tuple(5, 5, highbd_8_subpel_var32x32_c, 8),
1072                      make_tuple(5, 4, highbd_8_subpel_var32x16_c, 8),
1073                      make_tuple(4, 5, highbd_8_subpel_var16x32_c, 8),
1074                      make_tuple(4, 4, highbd_8_subpel_var16x16_c, 8),
1075                      make_tuple(4, 3, highbd_8_subpel_var16x8_c, 8),
1076                      make_tuple(3, 4, highbd_8_subpel_var8x16_c, 8),
1077                      make_tuple(3, 3, highbd_8_subpel_var8x8_c, 8),
1078                      make_tuple(3, 2, highbd_8_subpel_var8x4_c, 8),
1079                      make_tuple(2, 3, highbd_8_subpel_var4x8_c, 8),
1080                      make_tuple(2, 2, highbd_8_subpel_var4x4_c, 8),
1081                      make_tuple(6, 6, highbd_10_subpel_var64x64_c, 10),
1082                      make_tuple(6, 5, highbd_10_subpel_var64x32_c, 10),
1083                      make_tuple(5, 6, highbd_10_subpel_var32x64_c, 10),
1084                      make_tuple(5, 5, highbd_10_subpel_var32x32_c, 10),
1085                      make_tuple(5, 4, highbd_10_subpel_var32x16_c, 10),
1086                      make_tuple(4, 5, highbd_10_subpel_var16x32_c, 10),
1087                      make_tuple(4, 4, highbd_10_subpel_var16x16_c, 10),
1088                      make_tuple(4, 3, highbd_10_subpel_var16x8_c, 10),
1089                      make_tuple(3, 4, highbd_10_subpel_var8x16_c, 10),
1090                      make_tuple(3, 3, highbd_10_subpel_var8x8_c, 10),
1091                      make_tuple(3, 2, highbd_10_subpel_var8x4_c, 10),
1092                      make_tuple(2, 3, highbd_10_subpel_var4x8_c, 10),
1093                      make_tuple(2, 2, highbd_10_subpel_var4x4_c, 10),
1094                      make_tuple(6, 6, highbd_12_subpel_var64x64_c, 12),
1095                      make_tuple(6, 5, highbd_12_subpel_var64x32_c, 12),
1096                      make_tuple(5, 6, highbd_12_subpel_var32x64_c, 12),
1097                      make_tuple(5, 5, highbd_12_subpel_var32x32_c, 12),
1098                      make_tuple(5, 4, highbd_12_subpel_var32x16_c, 12),
1099                      make_tuple(4, 5, highbd_12_subpel_var16x32_c, 12),
1100                      make_tuple(4, 4, highbd_12_subpel_var16x16_c, 12),
1101                      make_tuple(4, 3, highbd_12_subpel_var16x8_c, 12),
1102                      make_tuple(3, 4, highbd_12_subpel_var8x16_c, 12),
1103                      make_tuple(3, 3, highbd_12_subpel_var8x8_c, 12),
1104                      make_tuple(3, 2, highbd_12_subpel_var8x4_c, 12),
1105                      make_tuple(2, 3, highbd_12_subpel_var4x8_c, 12),
1106                      make_tuple(2, 2, highbd_12_subpel_var4x4_c, 12)));
1107
1108const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var64x64_c =
1109    vpx_highbd_8_sub_pixel_avg_variance64x64_c;
1110const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var64x32_c =
1111    vpx_highbd_8_sub_pixel_avg_variance64x32_c;
1112const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var32x64_c =
1113    vpx_highbd_8_sub_pixel_avg_variance32x64_c;
1114const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var32x32_c =
1115    vpx_highbd_8_sub_pixel_avg_variance32x32_c;
1116const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var32x16_c =
1117    vpx_highbd_8_sub_pixel_avg_variance32x16_c;
1118const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var16x32_c =
1119    vpx_highbd_8_sub_pixel_avg_variance16x32_c;
1120const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var16x16_c =
1121    vpx_highbd_8_sub_pixel_avg_variance16x16_c;
1122const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var16x8_c =
1123    vpx_highbd_8_sub_pixel_avg_variance16x8_c;
1124const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var8x16_c =
1125    vpx_highbd_8_sub_pixel_avg_variance8x16_c;
1126const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var8x8_c =
1127    vpx_highbd_8_sub_pixel_avg_variance8x8_c;
1128const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var8x4_c =
1129    vpx_highbd_8_sub_pixel_avg_variance8x4_c;
1130const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var4x8_c =
1131    vpx_highbd_8_sub_pixel_avg_variance4x8_c;
1132const SubpixAvgVarMxNFunc highbd_8_subpel_avg_var4x4_c =
1133    vpx_highbd_8_sub_pixel_avg_variance4x4_c;
1134const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var64x64_c =
1135    vpx_highbd_10_sub_pixel_avg_variance64x64_c;
1136const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var64x32_c =
1137    vpx_highbd_10_sub_pixel_avg_variance64x32_c;
1138const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var32x64_c =
1139    vpx_highbd_10_sub_pixel_avg_variance32x64_c;
1140const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var32x32_c =
1141    vpx_highbd_10_sub_pixel_avg_variance32x32_c;
1142const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var32x16_c =
1143    vpx_highbd_10_sub_pixel_avg_variance32x16_c;
1144const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var16x32_c =
1145    vpx_highbd_10_sub_pixel_avg_variance16x32_c;
1146const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var16x16_c =
1147    vpx_highbd_10_sub_pixel_avg_variance16x16_c;
1148const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var16x8_c =
1149    vpx_highbd_10_sub_pixel_avg_variance16x8_c;
1150const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var8x16_c =
1151    vpx_highbd_10_sub_pixel_avg_variance8x16_c;
1152const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var8x8_c =
1153    vpx_highbd_10_sub_pixel_avg_variance8x8_c;
1154const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var8x4_c =
1155    vpx_highbd_10_sub_pixel_avg_variance8x4_c;
1156const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var4x8_c =
1157    vpx_highbd_10_sub_pixel_avg_variance4x8_c;
1158const SubpixAvgVarMxNFunc highbd_10_subpel_avg_var4x4_c =
1159    vpx_highbd_10_sub_pixel_avg_variance4x4_c;
1160const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var64x64_c =
1161    vpx_highbd_12_sub_pixel_avg_variance64x64_c;
1162const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var64x32_c =
1163    vpx_highbd_12_sub_pixel_avg_variance64x32_c;
1164const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var32x64_c =
1165    vpx_highbd_12_sub_pixel_avg_variance32x64_c;
1166const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var32x32_c =
1167    vpx_highbd_12_sub_pixel_avg_variance32x32_c;
1168const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var32x16_c =
1169    vpx_highbd_12_sub_pixel_avg_variance32x16_c;
1170const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var16x32_c =
1171    vpx_highbd_12_sub_pixel_avg_variance16x32_c;
1172const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var16x16_c =
1173    vpx_highbd_12_sub_pixel_avg_variance16x16_c;
1174const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var16x8_c =
1175    vpx_highbd_12_sub_pixel_avg_variance16x8_c;
1176const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var8x16_c =
1177    vpx_highbd_12_sub_pixel_avg_variance8x16_c;
1178const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var8x8_c =
1179    vpx_highbd_12_sub_pixel_avg_variance8x8_c;
1180const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var8x4_c =
1181    vpx_highbd_12_sub_pixel_avg_variance8x4_c;
1182const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var4x8_c =
1183    vpx_highbd_12_sub_pixel_avg_variance4x8_c;
1184const SubpixAvgVarMxNFunc highbd_12_subpel_avg_var4x4_c =
1185    vpx_highbd_12_sub_pixel_avg_variance4x4_c;
1186INSTANTIATE_TEST_CASE_P(
1187    C, VpxHBDSubpelAvgVarianceTest,
1188    ::testing::Values(
1189        make_tuple(6, 6, highbd_8_subpel_avg_var64x64_c, 8),
1190        make_tuple(6, 5, highbd_8_subpel_avg_var64x32_c, 8),
1191        make_tuple(5, 6, highbd_8_subpel_avg_var32x64_c, 8),
1192        make_tuple(5, 5, highbd_8_subpel_avg_var32x32_c, 8),
1193        make_tuple(5, 4, highbd_8_subpel_avg_var32x16_c, 8),
1194        make_tuple(4, 5, highbd_8_subpel_avg_var16x32_c, 8),
1195        make_tuple(4, 4, highbd_8_subpel_avg_var16x16_c, 8),
1196        make_tuple(4, 3, highbd_8_subpel_avg_var16x8_c, 8),
1197        make_tuple(3, 4, highbd_8_subpel_avg_var8x16_c, 8),
1198        make_tuple(3, 3, highbd_8_subpel_avg_var8x8_c, 8),
1199        make_tuple(3, 2, highbd_8_subpel_avg_var8x4_c, 8),
1200        make_tuple(2, 3, highbd_8_subpel_avg_var4x8_c, 8),
1201        make_tuple(2, 2, highbd_8_subpel_avg_var4x4_c, 8),
1202        make_tuple(6, 6, highbd_10_subpel_avg_var64x64_c, 10),
1203        make_tuple(6, 5, highbd_10_subpel_avg_var64x32_c, 10),
1204        make_tuple(5, 6, highbd_10_subpel_avg_var32x64_c, 10),
1205        make_tuple(5, 5, highbd_10_subpel_avg_var32x32_c, 10),
1206        make_tuple(5, 4, highbd_10_subpel_avg_var32x16_c, 10),
1207        make_tuple(4, 5, highbd_10_subpel_avg_var16x32_c, 10),
1208        make_tuple(4, 4, highbd_10_subpel_avg_var16x16_c, 10),
1209        make_tuple(4, 3, highbd_10_subpel_avg_var16x8_c, 10),
1210        make_tuple(3, 4, highbd_10_subpel_avg_var8x16_c, 10),
1211        make_tuple(3, 3, highbd_10_subpel_avg_var8x8_c, 10),
1212        make_tuple(3, 2, highbd_10_subpel_avg_var8x4_c, 10),
1213        make_tuple(2, 3, highbd_10_subpel_avg_var4x8_c, 10),
1214        make_tuple(2, 2, highbd_10_subpel_avg_var4x4_c, 10),
1215        make_tuple(6, 6, highbd_12_subpel_avg_var64x64_c, 12),
1216        make_tuple(6, 5, highbd_12_subpel_avg_var64x32_c, 12),
1217        make_tuple(5, 6, highbd_12_subpel_avg_var32x64_c, 12),
1218        make_tuple(5, 5, highbd_12_subpel_avg_var32x32_c, 12),
1219        make_tuple(5, 4, highbd_12_subpel_avg_var32x16_c, 12),
1220        make_tuple(4, 5, highbd_12_subpel_avg_var16x32_c, 12),
1221        make_tuple(4, 4, highbd_12_subpel_avg_var16x16_c, 12),
1222        make_tuple(4, 3, highbd_12_subpel_avg_var16x8_c, 12),
1223        make_tuple(3, 4, highbd_12_subpel_avg_var8x16_c, 12),
1224        make_tuple(3, 3, highbd_12_subpel_avg_var8x8_c, 12),
1225        make_tuple(3, 2, highbd_12_subpel_avg_var8x4_c, 12),
1226        make_tuple(2, 3, highbd_12_subpel_avg_var4x8_c, 12),
1227        make_tuple(2, 2, highbd_12_subpel_avg_var4x4_c, 12)));
1228#endif  // CONFIG_VP9_HIGHBITDEPTH
1229
1230#if HAVE_MMX
1231const VarianceMxNFunc mse16x16_mmx = vpx_mse16x16_mmx;
1232INSTANTIATE_TEST_CASE_P(MMX, VpxMseTest,
1233                        ::testing::Values(make_tuple(4, 4, mse16x16_mmx)));
1234
1235INSTANTIATE_TEST_CASE_P(MMX, SumOfSquaresTest,
1236                        ::testing::Values(vpx_get_mb_ss_mmx));
1237
1238const VarianceMxNFunc variance16x16_mmx = vpx_variance16x16_mmx;
1239const VarianceMxNFunc variance16x8_mmx = vpx_variance16x8_mmx;
1240const VarianceMxNFunc variance8x16_mmx = vpx_variance8x16_mmx;
1241const VarianceMxNFunc variance8x8_mmx = vpx_variance8x8_mmx;
1242const VarianceMxNFunc variance4x4_mmx = vpx_variance4x4_mmx;
1243INSTANTIATE_TEST_CASE_P(
1244    MMX, VpxVarianceTest,
1245    ::testing::Values(make_tuple(4, 4, variance16x16_mmx, 0),
1246                      make_tuple(4, 3, variance16x8_mmx, 0),
1247                      make_tuple(3, 4, variance8x16_mmx, 0),
1248                      make_tuple(3, 3, variance8x8_mmx, 0),
1249                      make_tuple(2, 2, variance4x4_mmx, 0)));
1250
1251const SubpixVarMxNFunc subpel_var16x16_mmx = vpx_sub_pixel_variance16x16_mmx;
1252const SubpixVarMxNFunc subpel_var16x8_mmx = vpx_sub_pixel_variance16x8_mmx;
1253const SubpixVarMxNFunc subpel_var8x16_mmx = vpx_sub_pixel_variance8x16_mmx;
1254const SubpixVarMxNFunc subpel_var8x8_mmx = vpx_sub_pixel_variance8x8_mmx;
1255const SubpixVarMxNFunc subpel_var4x4_mmx = vpx_sub_pixel_variance4x4_mmx;
1256INSTANTIATE_TEST_CASE_P(
1257    MMX, VpxSubpelVarianceTest,
1258    ::testing::Values(make_tuple(4, 4, subpel_var16x16_mmx, 0),
1259                      make_tuple(4, 3, subpel_var16x8_mmx, 0),
1260                      make_tuple(3, 4, subpel_var8x16_mmx, 0),
1261                      make_tuple(3, 3, subpel_var8x8_mmx, 0),
1262                      make_tuple(2, 2, subpel_var4x4_mmx, 0)));
1263#endif  // HAVE_MMX
1264
1265#if HAVE_SSE2
1266INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
1267                        ::testing::Values(vpx_get_mb_ss_sse2));
1268
1269const VarianceMxNFunc mse16x16_sse2 = vpx_mse16x16_sse2;
1270const VarianceMxNFunc mse16x8_sse2 = vpx_mse16x8_sse2;
1271const VarianceMxNFunc mse8x16_sse2 = vpx_mse8x16_sse2;
1272const VarianceMxNFunc mse8x8_sse2 = vpx_mse8x8_sse2;
1273INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
1274                        ::testing::Values(make_tuple(4, 4, mse16x16_sse2),
1275                                          make_tuple(4, 3, mse16x8_sse2),
1276                                          make_tuple(3, 4, mse8x16_sse2),
1277                                          make_tuple(3, 3, mse8x8_sse2)));
1278
1279const VarianceMxNFunc variance64x64_sse2 = vpx_variance64x64_sse2;
1280const VarianceMxNFunc variance64x32_sse2 = vpx_variance64x32_sse2;
1281const VarianceMxNFunc variance32x64_sse2 = vpx_variance32x64_sse2;
1282const VarianceMxNFunc variance32x32_sse2 = vpx_variance32x32_sse2;
1283const VarianceMxNFunc variance32x16_sse2 = vpx_variance32x16_sse2;
1284const VarianceMxNFunc variance16x32_sse2 = vpx_variance16x32_sse2;
1285const VarianceMxNFunc variance16x16_sse2 = vpx_variance16x16_sse2;
1286const VarianceMxNFunc variance16x8_sse2 = vpx_variance16x8_sse2;
1287const VarianceMxNFunc variance8x16_sse2 = vpx_variance8x16_sse2;
1288const VarianceMxNFunc variance8x8_sse2 = vpx_variance8x8_sse2;
1289const VarianceMxNFunc variance8x4_sse2 = vpx_variance8x4_sse2;
1290const VarianceMxNFunc variance4x8_sse2 = vpx_variance4x8_sse2;
1291const VarianceMxNFunc variance4x4_sse2 = vpx_variance4x4_sse2;
1292INSTANTIATE_TEST_CASE_P(
1293    SSE2, VpxVarianceTest,
1294    ::testing::Values(make_tuple(6, 6, variance64x64_sse2, 0),
1295                      make_tuple(6, 5, variance64x32_sse2, 0),
1296                      make_tuple(5, 6, variance32x64_sse2, 0),
1297                      make_tuple(5, 5, variance32x32_sse2, 0),
1298                      make_tuple(5, 4, variance32x16_sse2, 0),
1299                      make_tuple(4, 5, variance16x32_sse2, 0),
1300                      make_tuple(4, 4, variance16x16_sse2, 0),
1301                      make_tuple(4, 3, variance16x8_sse2, 0),
1302                      make_tuple(3, 4, variance8x16_sse2, 0),
1303                      make_tuple(3, 3, variance8x8_sse2, 0),
1304                      make_tuple(3, 2, variance8x4_sse2, 0),
1305                      make_tuple(2, 3, variance4x8_sse2, 0),
1306                      make_tuple(2, 2, variance4x4_sse2, 0)));
1307
1308#if CONFIG_USE_X86INC
1309const SubpixVarMxNFunc subpel_variance64x64_sse2 =
1310    vpx_sub_pixel_variance64x64_sse2;
1311const SubpixVarMxNFunc subpel_variance64x32_sse2 =
1312    vpx_sub_pixel_variance64x32_sse2;
1313const SubpixVarMxNFunc subpel_variance32x64_sse2 =
1314    vpx_sub_pixel_variance32x64_sse2;
1315const SubpixVarMxNFunc subpel_variance32x32_sse2 =
1316    vpx_sub_pixel_variance32x32_sse2;
1317const SubpixVarMxNFunc subpel_variance32x16_sse2 =
1318    vpx_sub_pixel_variance32x16_sse2;
1319const SubpixVarMxNFunc subpel_variance16x32_sse2 =
1320    vpx_sub_pixel_variance16x32_sse2;
1321const SubpixVarMxNFunc subpel_variance16x16_sse2 =
1322    vpx_sub_pixel_variance16x16_sse2;
1323const SubpixVarMxNFunc subpel_variance16x8_sse2 =
1324    vpx_sub_pixel_variance16x8_sse2;
1325const SubpixVarMxNFunc subpel_variance8x16_sse2 =
1326    vpx_sub_pixel_variance8x16_sse2;
1327const SubpixVarMxNFunc subpel_variance8x8_sse2 = vpx_sub_pixel_variance8x8_sse2;
1328const SubpixVarMxNFunc subpel_variance8x4_sse2 = vpx_sub_pixel_variance8x4_sse2;
1329const SubpixVarMxNFunc subpel_variance4x8_sse = vpx_sub_pixel_variance4x8_sse;
1330const SubpixVarMxNFunc subpel_variance4x4_sse = vpx_sub_pixel_variance4x4_sse;
1331INSTANTIATE_TEST_CASE_P(
1332    SSE2, VpxSubpelVarianceTest,
1333    ::testing::Values(make_tuple(6, 6, subpel_variance64x64_sse2, 0),
1334                      make_tuple(6, 5, subpel_variance64x32_sse2, 0),
1335                      make_tuple(5, 6, subpel_variance32x64_sse2, 0),
1336                      make_tuple(5, 5, subpel_variance32x32_sse2, 0),
1337                      make_tuple(5, 4, subpel_variance32x16_sse2, 0),
1338                      make_tuple(4, 5, subpel_variance16x32_sse2, 0),
1339                      make_tuple(4, 4, subpel_variance16x16_sse2, 0),
1340                      make_tuple(4, 3, subpel_variance16x8_sse2, 0),
1341                      make_tuple(3, 4, subpel_variance8x16_sse2, 0),
1342                      make_tuple(3, 3, subpel_variance8x8_sse2, 0),
1343                      make_tuple(3, 2, subpel_variance8x4_sse2, 0),
1344                      make_tuple(2, 3, subpel_variance4x8_sse, 0),
1345                      make_tuple(2, 2, subpel_variance4x4_sse, 0)));
1346
1347const SubpixAvgVarMxNFunc subpel_avg_variance64x64_sse2 =
1348    vpx_sub_pixel_avg_variance64x64_sse2;
1349const SubpixAvgVarMxNFunc subpel_avg_variance64x32_sse2 =
1350    vpx_sub_pixel_avg_variance64x32_sse2;
1351const SubpixAvgVarMxNFunc subpel_avg_variance32x64_sse2 =
1352    vpx_sub_pixel_avg_variance32x64_sse2;
1353const SubpixAvgVarMxNFunc subpel_avg_variance32x32_sse2 =
1354    vpx_sub_pixel_avg_variance32x32_sse2;
1355const SubpixAvgVarMxNFunc subpel_avg_variance32x16_sse2 =
1356    vpx_sub_pixel_avg_variance32x16_sse2;
1357const SubpixAvgVarMxNFunc subpel_avg_variance16x32_sse2 =
1358    vpx_sub_pixel_avg_variance16x32_sse2;
1359const SubpixAvgVarMxNFunc subpel_avg_variance16x16_sse2 =
1360    vpx_sub_pixel_avg_variance16x16_sse2;
1361const SubpixAvgVarMxNFunc subpel_avg_variance16x8_sse2 =
1362    vpx_sub_pixel_avg_variance16x8_sse2;
1363const SubpixAvgVarMxNFunc subpel_avg_variance8x16_sse2 =
1364    vpx_sub_pixel_avg_variance8x16_sse2;
1365const SubpixAvgVarMxNFunc subpel_avg_variance8x8_sse2 =
1366    vpx_sub_pixel_avg_variance8x8_sse2;
1367const SubpixAvgVarMxNFunc subpel_avg_variance8x4_sse2 =
1368    vpx_sub_pixel_avg_variance8x4_sse2;
1369const SubpixAvgVarMxNFunc subpel_avg_variance4x8_sse =
1370    vpx_sub_pixel_avg_variance4x8_sse;
1371const SubpixAvgVarMxNFunc subpel_avg_variance4x4_sse =
1372    vpx_sub_pixel_avg_variance4x4_sse;
1373INSTANTIATE_TEST_CASE_P(
1374    SSE2, VpxSubpelAvgVarianceTest,
1375    ::testing::Values(
1376                      make_tuple(6, 6, subpel_avg_variance64x64_sse2, 0),
1377                      make_tuple(6, 5, subpel_avg_variance64x32_sse2, 0),
1378                      make_tuple(5, 6, subpel_avg_variance32x64_sse2, 0),
1379                      make_tuple(5, 5, subpel_avg_variance32x32_sse2, 0),
1380                      make_tuple(5, 4, subpel_avg_variance32x16_sse2, 0),
1381                      make_tuple(4, 5, subpel_avg_variance16x32_sse2, 0),
1382                      make_tuple(4, 4, subpel_avg_variance16x16_sse2, 0),
1383                      make_tuple(4, 3, subpel_avg_variance16x8_sse2, 0),
1384                      make_tuple(3, 4, subpel_avg_variance8x16_sse2, 0),
1385                      make_tuple(3, 3, subpel_avg_variance8x8_sse2, 0),
1386                      make_tuple(3, 2, subpel_avg_variance8x4_sse2, 0),
1387                      make_tuple(2, 3, subpel_avg_variance4x8_sse, 0),
1388                      make_tuple(2, 2, subpel_avg_variance4x4_sse, 0)));
1389#endif  // CONFIG_USE_X86INC
1390
1391#if CONFIG_VP9_HIGHBITDEPTH
1392/* TODO(debargha): This test does not support the highbd version
1393const VarianceMxNFunc highbd_12_mse16x16_sse2 = vpx_highbd_12_mse16x16_sse2;
1394const VarianceMxNFunc highbd_12_mse16x8_sse2 = vpx_highbd_12_mse16x8_sse2;
1395const VarianceMxNFunc highbd_12_mse8x16_sse2 = vpx_highbd_12_mse8x16_sse2;
1396const VarianceMxNFunc highbd_12_mse8x8_sse2 = vpx_highbd_12_mse8x8_sse2;
1397
1398const VarianceMxNFunc highbd_10_mse16x16_sse2 = vpx_highbd_10_mse16x16_sse2;
1399const VarianceMxNFunc highbd_10_mse16x8_sse2 = vpx_highbd_10_mse16x8_sse2;
1400const VarianceMxNFunc highbd_10_mse8x16_sse2 = vpx_highbd_10_mse8x16_sse2;
1401const VarianceMxNFunc highbd_10_mse8x8_sse2 = vpx_highbd_10_mse8x8_sse2;
1402
1403const VarianceMxNFunc highbd_8_mse16x16_sse2 = vpx_highbd_8_mse16x16_sse2;
1404const VarianceMxNFunc highbd_8_mse16x8_sse2 = vpx_highbd_8_mse16x8_sse2;
1405const VarianceMxNFunc highbd_8_mse8x16_sse2 = vpx_highbd_8_mse8x16_sse2;
1406const VarianceMxNFunc highbd_8_mse8x8_sse2 = vpx_highbd_8_mse8x8_sse2;
1407INSTANTIATE_TEST_CASE_P(
1408    SSE2, VpxHBDMseTest, ::testing::Values(make_tuple(4, 4, highbd_12_mse16x16_sse2),
1409                                           make_tuple(4, 3, highbd_12_mse16x8_sse2),
1410                                           make_tuple(3, 4, highbd_12_mse8x16_sse2),
1411                                           make_tuple(3, 3, highbd_12_mse8x8_sse2),
1412                                           make_tuple(4, 4, highbd_10_mse16x16_sse2),
1413                                           make_tuple(4, 3, highbd_10_mse16x8_sse2),
1414                                           make_tuple(3, 4, highbd_10_mse8x16_sse2),
1415                                           make_tuple(3, 3, highbd_10_mse8x8_sse2),
1416                                           make_tuple(4, 4, highbd_8_mse16x16_sse2),
1417                                           make_tuple(4, 3, highbd_8_mse16x8_sse2),
1418                                           make_tuple(3, 4, highbd_8_mse8x16_sse2),
1419                                           make_tuple(3, 3, highbd_8_mse8x8_sse2)));
1420*/
1421
1422const VarianceMxNFunc highbd_12_variance64x64_sse2 =
1423    vpx_highbd_12_variance64x64_sse2;
1424const VarianceMxNFunc highbd_12_variance64x32_sse2 =
1425    vpx_highbd_12_variance64x32_sse2;
1426const VarianceMxNFunc highbd_12_variance32x64_sse2 =
1427    vpx_highbd_12_variance32x64_sse2;
1428const VarianceMxNFunc highbd_12_variance32x32_sse2 =
1429    vpx_highbd_12_variance32x32_sse2;
1430const VarianceMxNFunc highbd_12_variance32x16_sse2 =
1431    vpx_highbd_12_variance32x16_sse2;
1432const VarianceMxNFunc highbd_12_variance16x32_sse2 =
1433    vpx_highbd_12_variance16x32_sse2;
1434const VarianceMxNFunc highbd_12_variance16x16_sse2 =
1435    vpx_highbd_12_variance16x16_sse2;
1436const VarianceMxNFunc highbd_12_variance16x8_sse2 =
1437    vpx_highbd_12_variance16x8_sse2;
1438const VarianceMxNFunc highbd_12_variance8x16_sse2 =
1439    vpx_highbd_12_variance8x16_sse2;
1440const VarianceMxNFunc highbd_12_variance8x8_sse2 =
1441    vpx_highbd_12_variance8x8_sse2;
1442const VarianceMxNFunc highbd_10_variance64x64_sse2 =
1443    vpx_highbd_10_variance64x64_sse2;
1444const VarianceMxNFunc highbd_10_variance64x32_sse2 =
1445    vpx_highbd_10_variance64x32_sse2;
1446const VarianceMxNFunc highbd_10_variance32x64_sse2 =
1447    vpx_highbd_10_variance32x64_sse2;
1448const VarianceMxNFunc highbd_10_variance32x32_sse2 =
1449    vpx_highbd_10_variance32x32_sse2;
1450const VarianceMxNFunc highbd_10_variance32x16_sse2 =
1451    vpx_highbd_10_variance32x16_sse2;
1452const VarianceMxNFunc highbd_10_variance16x32_sse2 =
1453    vpx_highbd_10_variance16x32_sse2;
1454const VarianceMxNFunc highbd_10_variance16x16_sse2 =
1455    vpx_highbd_10_variance16x16_sse2;
1456const VarianceMxNFunc highbd_10_variance16x8_sse2 =
1457    vpx_highbd_10_variance16x8_sse2;
1458const VarianceMxNFunc highbd_10_variance8x16_sse2 =
1459    vpx_highbd_10_variance8x16_sse2;
1460const VarianceMxNFunc highbd_10_variance8x8_sse2 =
1461    vpx_highbd_10_variance8x8_sse2;
1462const VarianceMxNFunc highbd_8_variance64x64_sse2 =
1463    vpx_highbd_8_variance64x64_sse2;
1464const VarianceMxNFunc highbd_8_variance64x32_sse2 =
1465    vpx_highbd_8_variance64x32_sse2;
1466const VarianceMxNFunc highbd_8_variance32x64_sse2 =
1467    vpx_highbd_8_variance32x64_sse2;
1468const VarianceMxNFunc highbd_8_variance32x32_sse2 =
1469    vpx_highbd_8_variance32x32_sse2;
1470const VarianceMxNFunc highbd_8_variance32x16_sse2 =
1471    vpx_highbd_8_variance32x16_sse2;
1472const VarianceMxNFunc highbd_8_variance16x32_sse2 =
1473    vpx_highbd_8_variance16x32_sse2;
1474const VarianceMxNFunc highbd_8_variance16x16_sse2 =
1475    vpx_highbd_8_variance16x16_sse2;
1476const VarianceMxNFunc highbd_8_variance16x8_sse2 =
1477    vpx_highbd_8_variance16x8_sse2;
1478const VarianceMxNFunc highbd_8_variance8x16_sse2 =
1479    vpx_highbd_8_variance8x16_sse2;
1480const VarianceMxNFunc highbd_8_variance8x8_sse2 =
1481    vpx_highbd_8_variance8x8_sse2;
1482
1483INSTANTIATE_TEST_CASE_P(
1484    SSE2, VpxHBDVarianceTest,
1485    ::testing::Values(make_tuple(6, 6, highbd_12_variance64x64_sse2, 12),
1486                      make_tuple(6, 5, highbd_12_variance64x32_sse2, 12),
1487                      make_tuple(5, 6, highbd_12_variance32x64_sse2, 12),
1488                      make_tuple(5, 5, highbd_12_variance32x32_sse2, 12),
1489                      make_tuple(5, 4, highbd_12_variance32x16_sse2, 12),
1490                      make_tuple(4, 5, highbd_12_variance16x32_sse2, 12),
1491                      make_tuple(4, 4, highbd_12_variance16x16_sse2, 12),
1492                      make_tuple(4, 3, highbd_12_variance16x8_sse2, 12),
1493                      make_tuple(3, 4, highbd_12_variance8x16_sse2, 12),
1494                      make_tuple(3, 3, highbd_12_variance8x8_sse2, 12),
1495                      make_tuple(6, 6, highbd_10_variance64x64_sse2, 10),
1496                      make_tuple(6, 5, highbd_10_variance64x32_sse2, 10),
1497                      make_tuple(5, 6, highbd_10_variance32x64_sse2, 10),
1498                      make_tuple(5, 5, highbd_10_variance32x32_sse2, 10),
1499                      make_tuple(5, 4, highbd_10_variance32x16_sse2, 10),
1500                      make_tuple(4, 5, highbd_10_variance16x32_sse2, 10),
1501                      make_tuple(4, 4, highbd_10_variance16x16_sse2, 10),
1502                      make_tuple(4, 3, highbd_10_variance16x8_sse2, 10),
1503                      make_tuple(3, 4, highbd_10_variance8x16_sse2, 10),
1504                      make_tuple(3, 3, highbd_10_variance8x8_sse2, 10),
1505                      make_tuple(6, 6, highbd_8_variance64x64_sse2, 8),
1506                      make_tuple(6, 5, highbd_8_variance64x32_sse2, 8),
1507                      make_tuple(5, 6, highbd_8_variance32x64_sse2, 8),
1508                      make_tuple(5, 5, highbd_8_variance32x32_sse2, 8),
1509                      make_tuple(5, 4, highbd_8_variance32x16_sse2, 8),
1510                      make_tuple(4, 5, highbd_8_variance16x32_sse2, 8),
1511                      make_tuple(4, 4, highbd_8_variance16x16_sse2, 8),
1512                      make_tuple(4, 3, highbd_8_variance16x8_sse2, 8),
1513                      make_tuple(3, 4, highbd_8_variance8x16_sse2, 8),
1514                      make_tuple(3, 3, highbd_8_variance8x8_sse2, 8)));
1515
1516#if CONFIG_USE_X86INC
1517const SubpixVarMxNFunc highbd_12_subpel_variance64x64_sse2 =
1518    vpx_highbd_12_sub_pixel_variance64x64_sse2;
1519const SubpixVarMxNFunc highbd_12_subpel_variance64x32_sse2 =
1520    vpx_highbd_12_sub_pixel_variance64x32_sse2;
1521const SubpixVarMxNFunc highbd_12_subpel_variance32x64_sse2 =
1522    vpx_highbd_12_sub_pixel_variance32x64_sse2;
1523const SubpixVarMxNFunc highbd_12_subpel_variance32x32_sse2 =
1524    vpx_highbd_12_sub_pixel_variance32x32_sse2;
1525const SubpixVarMxNFunc highbd_12_subpel_variance32x16_sse2 =
1526    vpx_highbd_12_sub_pixel_variance32x16_sse2;
1527const SubpixVarMxNFunc highbd_12_subpel_variance16x32_sse2 =
1528    vpx_highbd_12_sub_pixel_variance16x32_sse2;
1529const SubpixVarMxNFunc highbd_12_subpel_variance16x16_sse2 =
1530    vpx_highbd_12_sub_pixel_variance16x16_sse2;
1531const SubpixVarMxNFunc highbd_12_subpel_variance16x8_sse2 =
1532    vpx_highbd_12_sub_pixel_variance16x8_sse2;
1533const SubpixVarMxNFunc highbd_12_subpel_variance8x16_sse2 =
1534    vpx_highbd_12_sub_pixel_variance8x16_sse2;
1535const SubpixVarMxNFunc highbd_12_subpel_variance8x8_sse2 =
1536    vpx_highbd_12_sub_pixel_variance8x8_sse2;
1537const SubpixVarMxNFunc highbd_12_subpel_variance8x4_sse2 =
1538    vpx_highbd_12_sub_pixel_variance8x4_sse2;
1539const SubpixVarMxNFunc highbd_10_subpel_variance64x64_sse2 =
1540    vpx_highbd_10_sub_pixel_variance64x64_sse2;
1541const SubpixVarMxNFunc highbd_10_subpel_variance64x32_sse2 =
1542    vpx_highbd_10_sub_pixel_variance64x32_sse2;
1543const SubpixVarMxNFunc highbd_10_subpel_variance32x64_sse2 =
1544    vpx_highbd_10_sub_pixel_variance32x64_sse2;
1545const SubpixVarMxNFunc highbd_10_subpel_variance32x32_sse2 =
1546    vpx_highbd_10_sub_pixel_variance32x32_sse2;
1547const SubpixVarMxNFunc highbd_10_subpel_variance32x16_sse2 =
1548    vpx_highbd_10_sub_pixel_variance32x16_sse2;
1549const SubpixVarMxNFunc highbd_10_subpel_variance16x32_sse2 =
1550    vpx_highbd_10_sub_pixel_variance16x32_sse2;
1551const SubpixVarMxNFunc highbd_10_subpel_variance16x16_sse2 =
1552    vpx_highbd_10_sub_pixel_variance16x16_sse2;
1553const SubpixVarMxNFunc highbd_10_subpel_variance16x8_sse2 =
1554    vpx_highbd_10_sub_pixel_variance16x8_sse2;
1555const SubpixVarMxNFunc highbd_10_subpel_variance8x16_sse2 =
1556    vpx_highbd_10_sub_pixel_variance8x16_sse2;
1557const SubpixVarMxNFunc highbd_10_subpel_variance8x8_sse2 =
1558    vpx_highbd_10_sub_pixel_variance8x8_sse2;
1559const SubpixVarMxNFunc highbd_10_subpel_variance8x4_sse2 =
1560    vpx_highbd_10_sub_pixel_variance8x4_sse2;
1561const SubpixVarMxNFunc highbd_8_subpel_variance64x64_sse2 =
1562    vpx_highbd_8_sub_pixel_variance64x64_sse2;
1563const SubpixVarMxNFunc highbd_8_subpel_variance64x32_sse2 =
1564    vpx_highbd_8_sub_pixel_variance64x32_sse2;
1565const SubpixVarMxNFunc highbd_8_subpel_variance32x64_sse2 =
1566    vpx_highbd_8_sub_pixel_variance32x64_sse2;
1567const SubpixVarMxNFunc highbd_8_subpel_variance32x32_sse2 =
1568    vpx_highbd_8_sub_pixel_variance32x32_sse2;
1569const SubpixVarMxNFunc highbd_8_subpel_variance32x16_sse2 =
1570    vpx_highbd_8_sub_pixel_variance32x16_sse2;
1571const SubpixVarMxNFunc highbd_8_subpel_variance16x32_sse2 =
1572    vpx_highbd_8_sub_pixel_variance16x32_sse2;
1573const SubpixVarMxNFunc highbd_8_subpel_variance16x16_sse2 =
1574    vpx_highbd_8_sub_pixel_variance16x16_sse2;
1575const SubpixVarMxNFunc highbd_8_subpel_variance16x8_sse2 =
1576    vpx_highbd_8_sub_pixel_variance16x8_sse2;
1577const SubpixVarMxNFunc highbd_8_subpel_variance8x16_sse2 =
1578    vpx_highbd_8_sub_pixel_variance8x16_sse2;
1579const SubpixVarMxNFunc highbd_8_subpel_variance8x8_sse2 =
1580    vpx_highbd_8_sub_pixel_variance8x8_sse2;
1581const SubpixVarMxNFunc highbd_8_subpel_variance8x4_sse2 =
1582    vpx_highbd_8_sub_pixel_variance8x4_sse2;
1583INSTANTIATE_TEST_CASE_P(
1584    SSE2, VpxHBDSubpelVarianceTest,
1585    ::testing::Values(make_tuple(6, 6, highbd_12_subpel_variance64x64_sse2, 12),
1586                      make_tuple(6, 5, highbd_12_subpel_variance64x32_sse2, 12),
1587                      make_tuple(5, 6, highbd_12_subpel_variance32x64_sse2, 12),
1588                      make_tuple(5, 5, highbd_12_subpel_variance32x32_sse2, 12),
1589                      make_tuple(5, 4, highbd_12_subpel_variance32x16_sse2, 12),
1590                      make_tuple(4, 5, highbd_12_subpel_variance16x32_sse2, 12),
1591                      make_tuple(4, 4, highbd_12_subpel_variance16x16_sse2, 12),
1592                      make_tuple(4, 3, highbd_12_subpel_variance16x8_sse2, 12),
1593                      make_tuple(3, 4, highbd_12_subpel_variance8x16_sse2, 12),
1594                      make_tuple(3, 3, highbd_12_subpel_variance8x8_sse2, 12),
1595                      make_tuple(3, 2, highbd_12_subpel_variance8x4_sse2, 12),
1596                      make_tuple(6, 6, highbd_10_subpel_variance64x64_sse2, 10),
1597                      make_tuple(6, 5, highbd_10_subpel_variance64x32_sse2, 10),
1598                      make_tuple(5, 6, highbd_10_subpel_variance32x64_sse2, 10),
1599                      make_tuple(5, 5, highbd_10_subpel_variance32x32_sse2, 10),
1600                      make_tuple(5, 4, highbd_10_subpel_variance32x16_sse2, 10),
1601                      make_tuple(4, 5, highbd_10_subpel_variance16x32_sse2, 10),
1602                      make_tuple(4, 4, highbd_10_subpel_variance16x16_sse2, 10),
1603                      make_tuple(4, 3, highbd_10_subpel_variance16x8_sse2, 10),
1604                      make_tuple(3, 4, highbd_10_subpel_variance8x16_sse2, 10),
1605                      make_tuple(3, 3, highbd_10_subpel_variance8x8_sse2, 10),
1606                      make_tuple(3, 2, highbd_10_subpel_variance8x4_sse2, 10),
1607                      make_tuple(6, 6, highbd_8_subpel_variance64x64_sse2, 8),
1608                      make_tuple(6, 5, highbd_8_subpel_variance64x32_sse2, 8),
1609                      make_tuple(5, 6, highbd_8_subpel_variance32x64_sse2, 8),
1610                      make_tuple(5, 5, highbd_8_subpel_variance32x32_sse2, 8),
1611                      make_tuple(5, 4, highbd_8_subpel_variance32x16_sse2, 8),
1612                      make_tuple(4, 5, highbd_8_subpel_variance16x32_sse2, 8),
1613                      make_tuple(4, 4, highbd_8_subpel_variance16x16_sse2, 8),
1614                      make_tuple(4, 3, highbd_8_subpel_variance16x8_sse2, 8),
1615                      make_tuple(3, 4, highbd_8_subpel_variance8x16_sse2, 8),
1616                      make_tuple(3, 3, highbd_8_subpel_variance8x8_sse2, 8),
1617                      make_tuple(3, 2, highbd_8_subpel_variance8x4_sse2, 8)));
1618
1619const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance64x64_sse2 =
1620    vpx_highbd_12_sub_pixel_avg_variance64x64_sse2;
1621const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance64x32_sse2 =
1622    vpx_highbd_12_sub_pixel_avg_variance64x32_sse2;
1623const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance32x64_sse2 =
1624    vpx_highbd_12_sub_pixel_avg_variance32x64_sse2;
1625const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance32x32_sse2 =
1626    vpx_highbd_12_sub_pixel_avg_variance32x32_sse2;
1627const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance32x16_sse2 =
1628    vpx_highbd_12_sub_pixel_avg_variance32x16_sse2;
1629const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance16x32_sse2 =
1630    vpx_highbd_12_sub_pixel_avg_variance16x32_sse2;
1631const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance16x16_sse2 =
1632    vpx_highbd_12_sub_pixel_avg_variance16x16_sse2;
1633const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance16x8_sse2 =
1634    vpx_highbd_12_sub_pixel_avg_variance16x8_sse2;
1635const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance8x16_sse2 =
1636    vpx_highbd_12_sub_pixel_avg_variance8x16_sse2;
1637const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance8x8_sse2 =
1638    vpx_highbd_12_sub_pixel_avg_variance8x8_sse2;
1639const SubpixAvgVarMxNFunc highbd_12_subpel_avg_variance8x4_sse2 =
1640    vpx_highbd_12_sub_pixel_avg_variance8x4_sse2;
1641const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance64x64_sse2 =
1642    vpx_highbd_10_sub_pixel_avg_variance64x64_sse2;
1643const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance64x32_sse2 =
1644    vpx_highbd_10_sub_pixel_avg_variance64x32_sse2;
1645const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance32x64_sse2 =
1646    vpx_highbd_10_sub_pixel_avg_variance32x64_sse2;
1647const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance32x32_sse2 =
1648    vpx_highbd_10_sub_pixel_avg_variance32x32_sse2;
1649const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance32x16_sse2 =
1650    vpx_highbd_10_sub_pixel_avg_variance32x16_sse2;
1651const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance16x32_sse2 =
1652    vpx_highbd_10_sub_pixel_avg_variance16x32_sse2;
1653const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance16x16_sse2 =
1654    vpx_highbd_10_sub_pixel_avg_variance16x16_sse2;
1655const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance16x8_sse2 =
1656    vpx_highbd_10_sub_pixel_avg_variance16x8_sse2;
1657const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance8x16_sse2 =
1658    vpx_highbd_10_sub_pixel_avg_variance8x16_sse2;
1659const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance8x8_sse2 =
1660    vpx_highbd_10_sub_pixel_avg_variance8x8_sse2;
1661const SubpixAvgVarMxNFunc highbd_10_subpel_avg_variance8x4_sse2 =
1662    vpx_highbd_10_sub_pixel_avg_variance8x4_sse2;
1663const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance64x64_sse2 =
1664    vpx_highbd_8_sub_pixel_avg_variance64x64_sse2;
1665const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance64x32_sse2 =
1666    vpx_highbd_8_sub_pixel_avg_variance64x32_sse2;
1667const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance32x64_sse2 =
1668    vpx_highbd_8_sub_pixel_avg_variance32x64_sse2;
1669const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance32x32_sse2 =
1670    vpx_highbd_8_sub_pixel_avg_variance32x32_sse2;
1671const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance32x16_sse2 =
1672    vpx_highbd_8_sub_pixel_avg_variance32x16_sse2;
1673const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance16x32_sse2 =
1674    vpx_highbd_8_sub_pixel_avg_variance16x32_sse2;
1675const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance16x16_sse2 =
1676    vpx_highbd_8_sub_pixel_avg_variance16x16_sse2;
1677const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance16x8_sse2 =
1678    vpx_highbd_8_sub_pixel_avg_variance16x8_sse2;
1679const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance8x16_sse2 =
1680    vpx_highbd_8_sub_pixel_avg_variance8x16_sse2;
1681const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance8x8_sse2 =
1682    vpx_highbd_8_sub_pixel_avg_variance8x8_sse2;
1683const SubpixAvgVarMxNFunc highbd_8_subpel_avg_variance8x4_sse2 =
1684    vpx_highbd_8_sub_pixel_avg_variance8x4_sse2;
1685INSTANTIATE_TEST_CASE_P(
1686    SSE2, VpxHBDSubpelAvgVarianceTest,
1687    ::testing::Values(
1688        make_tuple(6, 6, highbd_12_subpel_avg_variance64x64_sse2, 12),
1689        make_tuple(6, 5, highbd_12_subpel_avg_variance64x32_sse2, 12),
1690        make_tuple(5, 6, highbd_12_subpel_avg_variance32x64_sse2, 12),
1691        make_tuple(5, 5, highbd_12_subpel_avg_variance32x32_sse2, 12),
1692        make_tuple(5, 4, highbd_12_subpel_avg_variance32x16_sse2, 12),
1693        make_tuple(4, 5, highbd_12_subpel_avg_variance16x32_sse2, 12),
1694        make_tuple(4, 4, highbd_12_subpel_avg_variance16x16_sse2, 12),
1695        make_tuple(4, 3, highbd_12_subpel_avg_variance16x8_sse2, 12),
1696        make_tuple(3, 4, highbd_12_subpel_avg_variance8x16_sse2, 12),
1697        make_tuple(3, 3, highbd_12_subpel_avg_variance8x8_sse2, 12),
1698        make_tuple(3, 2, highbd_12_subpel_avg_variance8x4_sse2, 12),
1699        make_tuple(6, 6, highbd_10_subpel_avg_variance64x64_sse2, 10),
1700        make_tuple(6, 5, highbd_10_subpel_avg_variance64x32_sse2, 10),
1701        make_tuple(5, 6, highbd_10_subpel_avg_variance32x64_sse2, 10),
1702        make_tuple(5, 5, highbd_10_subpel_avg_variance32x32_sse2, 10),
1703        make_tuple(5, 4, highbd_10_subpel_avg_variance32x16_sse2, 10),
1704        make_tuple(4, 5, highbd_10_subpel_avg_variance16x32_sse2, 10),
1705        make_tuple(4, 4, highbd_10_subpel_avg_variance16x16_sse2, 10),
1706        make_tuple(4, 3, highbd_10_subpel_avg_variance16x8_sse2, 10),
1707        make_tuple(3, 4, highbd_10_subpel_avg_variance8x16_sse2, 10),
1708        make_tuple(3, 3, highbd_10_subpel_avg_variance8x8_sse2, 10),
1709        make_tuple(3, 2, highbd_10_subpel_avg_variance8x4_sse2, 10),
1710        make_tuple(6, 6, highbd_8_subpel_avg_variance64x64_sse2, 8),
1711        make_tuple(6, 5, highbd_8_subpel_avg_variance64x32_sse2, 8),
1712        make_tuple(5, 6, highbd_8_subpel_avg_variance32x64_sse2, 8),
1713        make_tuple(5, 5, highbd_8_subpel_avg_variance32x32_sse2, 8),
1714        make_tuple(5, 4, highbd_8_subpel_avg_variance32x16_sse2, 8),
1715        make_tuple(4, 5, highbd_8_subpel_avg_variance16x32_sse2, 8),
1716        make_tuple(4, 4, highbd_8_subpel_avg_variance16x16_sse2, 8),
1717        make_tuple(4, 3, highbd_8_subpel_avg_variance16x8_sse2, 8),
1718        make_tuple(3, 4, highbd_8_subpel_avg_variance8x16_sse2, 8),
1719        make_tuple(3, 3, highbd_8_subpel_avg_variance8x8_sse2, 8),
1720        make_tuple(3, 2, highbd_8_subpel_avg_variance8x4_sse2, 8)));
1721#endif  // CONFIG_USE_X86INC
1722#endif  // CONFIG_VP9_HIGHBITDEPTH
1723#endif  // HAVE_SSE2
1724
1725#if HAVE_SSSE3
1726#if CONFIG_USE_X86INC
1727const SubpixVarMxNFunc subpel_variance64x64_ssse3 =
1728    vpx_sub_pixel_variance64x64_ssse3;
1729const SubpixVarMxNFunc subpel_variance64x32_ssse3 =
1730    vpx_sub_pixel_variance64x32_ssse3;
1731const SubpixVarMxNFunc subpel_variance32x64_ssse3 =
1732    vpx_sub_pixel_variance32x64_ssse3;
1733const SubpixVarMxNFunc subpel_variance32x32_ssse3 =
1734    vpx_sub_pixel_variance32x32_ssse3;
1735const SubpixVarMxNFunc subpel_variance32x16_ssse3 =
1736    vpx_sub_pixel_variance32x16_ssse3;
1737const SubpixVarMxNFunc subpel_variance16x32_ssse3 =
1738    vpx_sub_pixel_variance16x32_ssse3;
1739const SubpixVarMxNFunc subpel_variance16x16_ssse3 =
1740    vpx_sub_pixel_variance16x16_ssse3;
1741const SubpixVarMxNFunc subpel_variance16x8_ssse3 =
1742    vpx_sub_pixel_variance16x8_ssse3;
1743const SubpixVarMxNFunc subpel_variance8x16_ssse3 =
1744    vpx_sub_pixel_variance8x16_ssse3;
1745const SubpixVarMxNFunc subpel_variance8x8_ssse3 =
1746    vpx_sub_pixel_variance8x8_ssse3;
1747const SubpixVarMxNFunc subpel_variance8x4_ssse3 =
1748    vpx_sub_pixel_variance8x4_ssse3;
1749const SubpixVarMxNFunc subpel_variance4x8_ssse3 =
1750    vpx_sub_pixel_variance4x8_ssse3;
1751const SubpixVarMxNFunc subpel_variance4x4_ssse3 =
1752    vpx_sub_pixel_variance4x4_ssse3;
1753INSTANTIATE_TEST_CASE_P(
1754    SSSE3, VpxSubpelVarianceTest,
1755    ::testing::Values(make_tuple(6, 6, subpel_variance64x64_ssse3, 0),
1756                      make_tuple(6, 5, subpel_variance64x32_ssse3, 0),
1757                      make_tuple(5, 6, subpel_variance32x64_ssse3, 0),
1758                      make_tuple(5, 5, subpel_variance32x32_ssse3, 0),
1759                      make_tuple(5, 4, subpel_variance32x16_ssse3, 0),
1760                      make_tuple(4, 5, subpel_variance16x32_ssse3, 0),
1761                      make_tuple(4, 4, subpel_variance16x16_ssse3, 0),
1762                      make_tuple(4, 3, subpel_variance16x8_ssse3, 0),
1763                      make_tuple(3, 4, subpel_variance8x16_ssse3, 0),
1764                      make_tuple(3, 3, subpel_variance8x8_ssse3, 0),
1765                      make_tuple(3, 2, subpel_variance8x4_ssse3, 0),
1766                      make_tuple(2, 3, subpel_variance4x8_ssse3, 0),
1767                      make_tuple(2, 2, subpel_variance4x4_ssse3, 0)));
1768
1769const SubpixAvgVarMxNFunc subpel_avg_variance64x64_ssse3 =
1770    vpx_sub_pixel_avg_variance64x64_ssse3;
1771const SubpixAvgVarMxNFunc subpel_avg_variance64x32_ssse3 =
1772    vpx_sub_pixel_avg_variance64x32_ssse3;
1773const SubpixAvgVarMxNFunc subpel_avg_variance32x64_ssse3 =
1774    vpx_sub_pixel_avg_variance32x64_ssse3;
1775const SubpixAvgVarMxNFunc subpel_avg_variance32x32_ssse3 =
1776    vpx_sub_pixel_avg_variance32x32_ssse3;
1777const SubpixAvgVarMxNFunc subpel_avg_variance32x16_ssse3 =
1778    vpx_sub_pixel_avg_variance32x16_ssse3;
1779const SubpixAvgVarMxNFunc subpel_avg_variance16x32_ssse3 =
1780    vpx_sub_pixel_avg_variance16x32_ssse3;
1781const SubpixAvgVarMxNFunc subpel_avg_variance16x16_ssse3 =
1782    vpx_sub_pixel_avg_variance16x16_ssse3;
1783const SubpixAvgVarMxNFunc subpel_avg_variance16x8_ssse3 =
1784    vpx_sub_pixel_avg_variance16x8_ssse3;
1785const SubpixAvgVarMxNFunc subpel_avg_variance8x16_ssse3 =
1786    vpx_sub_pixel_avg_variance8x16_ssse3;
1787const SubpixAvgVarMxNFunc subpel_avg_variance8x8_ssse3 =
1788    vpx_sub_pixel_avg_variance8x8_ssse3;
1789const SubpixAvgVarMxNFunc subpel_avg_variance8x4_ssse3 =
1790    vpx_sub_pixel_avg_variance8x4_ssse3;
1791const SubpixAvgVarMxNFunc subpel_avg_variance4x8_ssse3 =
1792    vpx_sub_pixel_avg_variance4x8_ssse3;
1793const SubpixAvgVarMxNFunc subpel_avg_variance4x4_ssse3 =
1794    vpx_sub_pixel_avg_variance4x4_ssse3;
1795INSTANTIATE_TEST_CASE_P(
1796    SSSE3, VpxSubpelAvgVarianceTest,
1797    ::testing::Values(make_tuple(6, 6, subpel_avg_variance64x64_ssse3, 0),
1798                      make_tuple(6, 5, subpel_avg_variance64x32_ssse3, 0),
1799                      make_tuple(5, 6, subpel_avg_variance32x64_ssse3, 0),
1800                      make_tuple(5, 5, subpel_avg_variance32x32_ssse3, 0),
1801                      make_tuple(5, 4, subpel_avg_variance32x16_ssse3, 0),
1802                      make_tuple(4, 5, subpel_avg_variance16x32_ssse3, 0),
1803                      make_tuple(4, 4, subpel_avg_variance16x16_ssse3, 0),
1804                      make_tuple(4, 3, subpel_avg_variance16x8_ssse3, 0),
1805                      make_tuple(3, 4, subpel_avg_variance8x16_ssse3, 0),
1806                      make_tuple(3, 3, subpel_avg_variance8x8_ssse3, 0),
1807                      make_tuple(3, 2, subpel_avg_variance8x4_ssse3, 0),
1808                      make_tuple(2, 3, subpel_avg_variance4x8_ssse3, 0),
1809                      make_tuple(2, 2, subpel_avg_variance4x4_ssse3, 0)));
1810#endif  // CONFIG_USE_X86INC
1811#endif  // HAVE_SSSE3
1812
1813#if HAVE_AVX2
1814const VarianceMxNFunc mse16x16_avx2 = vpx_mse16x16_avx2;
1815INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
1816                        ::testing::Values(make_tuple(4, 4, mse16x16_avx2)));
1817
1818const VarianceMxNFunc variance64x64_avx2 = vpx_variance64x64_avx2;
1819const VarianceMxNFunc variance64x32_avx2 = vpx_variance64x32_avx2;
1820const VarianceMxNFunc variance32x32_avx2 = vpx_variance32x32_avx2;
1821const VarianceMxNFunc variance32x16_avx2 = vpx_variance32x16_avx2;
1822const VarianceMxNFunc variance16x16_avx2 = vpx_variance16x16_avx2;
1823INSTANTIATE_TEST_CASE_P(
1824    AVX2, VpxVarianceTest,
1825    ::testing::Values(make_tuple(6, 6, variance64x64_avx2, 0),
1826                      make_tuple(6, 5, variance64x32_avx2, 0),
1827                      make_tuple(5, 5, variance32x32_avx2, 0),
1828                      make_tuple(5, 4, variance32x16_avx2, 0),
1829                      make_tuple(4, 4, variance16x16_avx2, 0)));
1830
1831const SubpixVarMxNFunc subpel_variance64x64_avx2 =
1832    vpx_sub_pixel_variance64x64_avx2;
1833const SubpixVarMxNFunc subpel_variance32x32_avx2 =
1834    vpx_sub_pixel_variance32x32_avx2;
1835INSTANTIATE_TEST_CASE_P(
1836    AVX2, VpxSubpelVarianceTest,
1837    ::testing::Values(make_tuple(6, 6, subpel_variance64x64_avx2, 0),
1838                      make_tuple(5, 5, subpel_variance32x32_avx2, 0)));
1839
1840const SubpixAvgVarMxNFunc subpel_avg_variance64x64_avx2 =
1841    vpx_sub_pixel_avg_variance64x64_avx2;
1842const SubpixAvgVarMxNFunc subpel_avg_variance32x32_avx2 =
1843    vpx_sub_pixel_avg_variance32x32_avx2;
1844INSTANTIATE_TEST_CASE_P(
1845    AVX2, VpxSubpelAvgVarianceTest,
1846    ::testing::Values(make_tuple(6, 6, subpel_avg_variance64x64_avx2, 0),
1847                      make_tuple(5, 5, subpel_avg_variance32x32_avx2, 0)));
1848#endif  // HAVE_AVX2
1849
1850#if HAVE_MEDIA
1851const VarianceMxNFunc mse16x16_media = vpx_mse16x16_media;
1852INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,
1853                        ::testing::Values(make_tuple(4, 4, mse16x16_media)));
1854
1855const VarianceMxNFunc variance16x16_media = vpx_variance16x16_media;
1856const VarianceMxNFunc variance8x8_media = vpx_variance8x8_media;
1857INSTANTIATE_TEST_CASE_P(
1858    MEDIA, VpxVarianceTest,
1859    ::testing::Values(make_tuple(4, 4, variance16x16_media, 0),
1860                      make_tuple(3, 3, variance8x8_media, 0)));
1861
1862const SubpixVarMxNFunc subpel_variance16x16_media =
1863    vpx_sub_pixel_variance16x16_media;
1864const SubpixVarMxNFunc subpel_variance8x8_media =
1865    vpx_sub_pixel_variance8x8_media;
1866INSTANTIATE_TEST_CASE_P(
1867    MEDIA, VpxSubpelVarianceTest,
1868    ::testing::Values(make_tuple(4, 4, subpel_variance16x16_media, 0),
1869                      make_tuple(3, 3, subpel_variance8x8_media, 0)));
1870#endif  // HAVE_MEDIA
1871
1872#if HAVE_NEON
1873const Get4x4SseFunc get4x4sse_cs_neon = vpx_get4x4sse_cs_neon;
1874INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
1875                        ::testing::Values(make_tuple(2, 2, get4x4sse_cs_neon)));
1876
1877const VarianceMxNFunc mse16x16_neon = vpx_mse16x16_neon;
1878INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
1879                        ::testing::Values(make_tuple(4, 4, mse16x16_neon)));
1880
1881const VarianceMxNFunc variance64x64_neon = vpx_variance64x64_neon;
1882const VarianceMxNFunc variance64x32_neon = vpx_variance64x32_neon;
1883const VarianceMxNFunc variance32x64_neon = vpx_variance32x64_neon;
1884const VarianceMxNFunc variance32x32_neon = vpx_variance32x32_neon;
1885const VarianceMxNFunc variance16x16_neon = vpx_variance16x16_neon;
1886const VarianceMxNFunc variance16x8_neon = vpx_variance16x8_neon;
1887const VarianceMxNFunc variance8x16_neon = vpx_variance8x16_neon;
1888const VarianceMxNFunc variance8x8_neon = vpx_variance8x8_neon;
1889INSTANTIATE_TEST_CASE_P(
1890    NEON, VpxVarianceTest,
1891    ::testing::Values(make_tuple(6, 6, variance64x64_neon, 0),
1892                      make_tuple(6, 5, variance64x32_neon, 0),
1893                      make_tuple(5, 6, variance32x64_neon, 0),
1894                      make_tuple(5, 5, variance32x32_neon, 0),
1895                      make_tuple(4, 4, variance16x16_neon, 0),
1896                      make_tuple(4, 3, variance16x8_neon, 0),
1897                      make_tuple(3, 4, variance8x16_neon, 0),
1898                      make_tuple(3, 3, variance8x8_neon, 0)));
1899
1900const SubpixVarMxNFunc subpel_variance64x64_neon =
1901    vpx_sub_pixel_variance64x64_neon;
1902const SubpixVarMxNFunc subpel_variance32x32_neon =
1903    vpx_sub_pixel_variance32x32_neon;
1904const SubpixVarMxNFunc subpel_variance16x16_neon =
1905    vpx_sub_pixel_variance16x16_neon;
1906const SubpixVarMxNFunc subpel_variance8x8_neon = vpx_sub_pixel_variance8x8_neon;
1907INSTANTIATE_TEST_CASE_P(
1908    NEON, VpxSubpelVarianceTest,
1909    ::testing::Values(make_tuple(6, 6, subpel_variance64x64_neon, 0),
1910                      make_tuple(5, 5, subpel_variance32x32_neon, 0),
1911                      make_tuple(4, 4, subpel_variance16x16_neon, 0),
1912                      make_tuple(3, 3, subpel_variance8x8_neon, 0)));
1913#endif  // HAVE_NEON
1914
1915#if HAVE_MSA
1916INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
1917                        ::testing::Values(vpx_get_mb_ss_msa));
1918
1919const Get4x4SseFunc get4x4sse_cs_msa = vpx_get4x4sse_cs_msa;
1920INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
1921                        ::testing::Values(make_tuple(2, 2, get4x4sse_cs_msa)));
1922
1923const VarianceMxNFunc mse16x16_msa = vpx_mse16x16_msa;
1924const VarianceMxNFunc mse16x8_msa = vpx_mse16x8_msa;
1925const VarianceMxNFunc mse8x16_msa = vpx_mse8x16_msa;
1926const VarianceMxNFunc mse8x8_msa = vpx_mse8x8_msa;
1927INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
1928                        ::testing::Values(make_tuple(4, 4, mse16x16_msa),
1929                                          make_tuple(4, 3, mse16x8_msa),
1930                                          make_tuple(3, 4, mse8x16_msa),
1931                                          make_tuple(3, 3, mse8x8_msa)));
1932
1933const VarianceMxNFunc variance64x64_msa = vpx_variance64x64_msa;
1934const VarianceMxNFunc variance64x32_msa = vpx_variance64x32_msa;
1935const VarianceMxNFunc variance32x64_msa = vpx_variance32x64_msa;
1936const VarianceMxNFunc variance32x32_msa = vpx_variance32x32_msa;
1937const VarianceMxNFunc variance32x16_msa = vpx_variance32x16_msa;
1938const VarianceMxNFunc variance16x32_msa = vpx_variance16x32_msa;
1939const VarianceMxNFunc variance16x16_msa = vpx_variance16x16_msa;
1940const VarianceMxNFunc variance16x8_msa = vpx_variance16x8_msa;
1941const VarianceMxNFunc variance8x16_msa = vpx_variance8x16_msa;
1942const VarianceMxNFunc variance8x8_msa = vpx_variance8x8_msa;
1943const VarianceMxNFunc variance8x4_msa = vpx_variance8x4_msa;
1944const VarianceMxNFunc variance4x8_msa = vpx_variance4x8_msa;
1945const VarianceMxNFunc variance4x4_msa = vpx_variance4x4_msa;
1946INSTANTIATE_TEST_CASE_P(
1947    MSA, VpxVarianceTest,
1948    ::testing::Values(make_tuple(6, 6, variance64x64_msa, 0),
1949                      make_tuple(6, 5, variance64x32_msa, 0),
1950                      make_tuple(5, 6, variance32x64_msa, 0),
1951                      make_tuple(5, 5, variance32x32_msa, 0),
1952                      make_tuple(5, 4, variance32x16_msa, 0),
1953                      make_tuple(4, 5, variance16x32_msa, 0),
1954                      make_tuple(4, 4, variance16x16_msa, 0),
1955                      make_tuple(4, 3, variance16x8_msa, 0),
1956                      make_tuple(3, 4, variance8x16_msa, 0),
1957                      make_tuple(3, 3, variance8x8_msa, 0),
1958                      make_tuple(3, 2, variance8x4_msa, 0),
1959                      make_tuple(2, 3, variance4x8_msa, 0),
1960                      make_tuple(2, 2, variance4x4_msa, 0)));
1961
1962const SubpixVarMxNFunc subpel_variance4x4_msa = vpx_sub_pixel_variance4x4_msa;
1963const SubpixVarMxNFunc subpel_variance4x8_msa = vpx_sub_pixel_variance4x8_msa;
1964const SubpixVarMxNFunc subpel_variance8x4_msa = vpx_sub_pixel_variance8x4_msa;
1965const SubpixVarMxNFunc subpel_variance8x8_msa = vpx_sub_pixel_variance8x8_msa;
1966const SubpixVarMxNFunc subpel_variance8x16_msa = vpx_sub_pixel_variance8x16_msa;
1967const SubpixVarMxNFunc subpel_variance16x8_msa = vpx_sub_pixel_variance16x8_msa;
1968const SubpixVarMxNFunc subpel_variance16x16_msa =
1969    vpx_sub_pixel_variance16x16_msa;
1970const SubpixVarMxNFunc subpel_variance16x32_msa =
1971    vpx_sub_pixel_variance16x32_msa;
1972const SubpixVarMxNFunc subpel_variance32x16_msa =
1973    vpx_sub_pixel_variance32x16_msa;
1974const SubpixVarMxNFunc subpel_variance32x32_msa =
1975    vpx_sub_pixel_variance32x32_msa;
1976const SubpixVarMxNFunc subpel_variance32x64_msa =
1977    vpx_sub_pixel_variance32x64_msa;
1978const SubpixVarMxNFunc subpel_variance64x32_msa =
1979    vpx_sub_pixel_variance64x32_msa;
1980const SubpixVarMxNFunc subpel_variance64x64_msa =
1981    vpx_sub_pixel_variance64x64_msa;
1982INSTANTIATE_TEST_CASE_P(
1983    MSA, VpxSubpelVarianceTest,
1984    ::testing::Values(make_tuple(2, 2, subpel_variance4x4_msa, 0),
1985                      make_tuple(2, 3, subpel_variance4x8_msa, 0),
1986                      make_tuple(3, 2, subpel_variance8x4_msa, 0),
1987                      make_tuple(3, 3, subpel_variance8x8_msa, 0),
1988                      make_tuple(3, 4, subpel_variance8x16_msa, 0),
1989                      make_tuple(4, 3, subpel_variance16x8_msa, 0),
1990                      make_tuple(4, 4, subpel_variance16x16_msa, 0),
1991                      make_tuple(4, 5, subpel_variance16x32_msa, 0),
1992                      make_tuple(5, 4, subpel_variance32x16_msa, 0),
1993                      make_tuple(5, 5, subpel_variance32x32_msa, 0),
1994                      make_tuple(5, 6, subpel_variance32x64_msa, 0),
1995                      make_tuple(6, 5, subpel_variance64x32_msa, 0),
1996                      make_tuple(6, 6, subpel_variance64x64_msa, 0)));
1997
1998const SubpixAvgVarMxNFunc subpel_avg_variance64x64_msa =
1999    vpx_sub_pixel_avg_variance64x64_msa;
2000const SubpixAvgVarMxNFunc subpel_avg_variance64x32_msa =
2001    vpx_sub_pixel_avg_variance64x32_msa;
2002const SubpixAvgVarMxNFunc subpel_avg_variance32x64_msa =
2003    vpx_sub_pixel_avg_variance32x64_msa;
2004const SubpixAvgVarMxNFunc subpel_avg_variance32x32_msa =
2005    vpx_sub_pixel_avg_variance32x32_msa;
2006const SubpixAvgVarMxNFunc subpel_avg_variance32x16_msa =
2007    vpx_sub_pixel_avg_variance32x16_msa;
2008const SubpixAvgVarMxNFunc subpel_avg_variance16x32_msa =
2009    vpx_sub_pixel_avg_variance16x32_msa;
2010const SubpixAvgVarMxNFunc subpel_avg_variance16x16_msa =
2011    vpx_sub_pixel_avg_variance16x16_msa;
2012const SubpixAvgVarMxNFunc subpel_avg_variance16x8_msa =
2013    vpx_sub_pixel_avg_variance16x8_msa;
2014const SubpixAvgVarMxNFunc subpel_avg_variance8x16_msa =
2015    vpx_sub_pixel_avg_variance8x16_msa;
2016const SubpixAvgVarMxNFunc subpel_avg_variance8x8_msa =
2017    vpx_sub_pixel_avg_variance8x8_msa;
2018const SubpixAvgVarMxNFunc subpel_avg_variance8x4_msa =
2019    vpx_sub_pixel_avg_variance8x4_msa;
2020const SubpixAvgVarMxNFunc subpel_avg_variance4x8_msa =
2021    vpx_sub_pixel_avg_variance4x8_msa;
2022const SubpixAvgVarMxNFunc subpel_avg_variance4x4_msa =
2023    vpx_sub_pixel_avg_variance4x4_msa;
2024INSTANTIATE_TEST_CASE_P(
2025    MSA, VpxSubpelAvgVarianceTest,
2026    ::testing::Values(make_tuple(6, 6, subpel_avg_variance64x64_msa, 0),
2027                      make_tuple(6, 5, subpel_avg_variance64x32_msa, 0),
2028                      make_tuple(5, 6, subpel_avg_variance32x64_msa, 0),
2029                      make_tuple(5, 5, subpel_avg_variance32x32_msa, 0),
2030                      make_tuple(5, 4, subpel_avg_variance32x16_msa, 0),
2031                      make_tuple(4, 5, subpel_avg_variance16x32_msa, 0),
2032                      make_tuple(4, 4, subpel_avg_variance16x16_msa, 0),
2033                      make_tuple(4, 3, subpel_avg_variance16x8_msa, 0),
2034                      make_tuple(3, 4, subpel_avg_variance8x16_msa, 0),
2035                      make_tuple(3, 3, subpel_avg_variance8x8_msa, 0),
2036                      make_tuple(3, 2, subpel_avg_variance8x4_msa, 0),
2037                      make_tuple(2, 3, subpel_avg_variance4x8_msa, 0),
2038                      make_tuple(2, 2, subpel_avg_variance4x4_msa, 0)));
2039#endif  // HAVE_MSA
2040}  // namespace
2041