]> granicus.if.org Git - libvpx/blob - test/sad_test.cc
Merge "mips msa vp9 idct 32x32 optimization"
[libvpx] / test / sad_test.cc
1 /*
2  *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11
12 #include <string.h>
13 #include <limits.h>
14 #include <stdio.h>
15
16 #include "./vpx_config.h"
17 #include "./vpx_dsp_rtcd.h"
18 #include "vpx_mem/vpx_mem.h"
19
20 /* Needed for ROUND_POWER_OF_TWO and CONVERT_TO* macros, both of which should be
21  * moved to a more generic location. Alternatively the *avg functions could be
22  * restricted to VP9 builds, but it would be better to avoid that sort of
23  * specificity.
24  * TODO(johannkoenig): move these macros to a common location.
25  */
26 #if CONFIG_VP9_HIGHBITDEPTH
27 #include "vp9/common/vp9_common.h"
28 #endif  // CONFIG_VP9_HIGHBITDEPTH
29
30 #ifndef ROUND_POWER_OF_TWO
31 #define ROUND_POWER_OF_TWO(value, n) \
32      (((value) + (1 << ((n) - 1))) >> (n))
33 #endif  // ROUND_POWER_OF_TWO
34
35
36 #include "test/acm_random.h"
37 #include "test/clear_system_state.h"
38 #include "test/register_state_check.h"
39 #include "test/util.h"
40 #include "third_party/googletest/src/include/gtest/gtest.h"
41 #include "vpx/vpx_codec.h"
42
43
44 typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr,
45                                    int src_stride,
46                                    const uint8_t *ref_ptr,
47                                    int ref_stride);
48 typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
49
50 typedef uint32_t (*SadMxNAvgFunc)(const uint8_t *src_ptr,
51                                   int src_stride,
52                                   const uint8_t *ref_ptr,
53                                   int ref_stride,
54                                   const uint8_t *second_pred);
55 typedef std::tr1::tuple<int, int, SadMxNAvgFunc, int> SadMxNAvgParam;
56
57 typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
58                              int src_stride,
59                              const uint8_t *const ref_ptr[],
60                              int ref_stride,
61                              uint32_t *sad_array);
62 typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
63
64 using libvpx_test::ACMRandom;
65
66 namespace {
67 class SADTestBase : public ::testing::Test {
68  public:
69   SADTestBase(int width, int height, int bit_depth) :
70       width_(width), height_(height), bd_(bit_depth) {}
71
72   static void SetUpTestCase() {
73     source_data8_ = reinterpret_cast<uint8_t*>(
74         vpx_memalign(kDataAlignment, kDataBlockSize));
75     reference_data8_ = reinterpret_cast<uint8_t*>(
76         vpx_memalign(kDataAlignment, kDataBufferSize));
77     second_pred8_ = reinterpret_cast<uint8_t*>(
78         vpx_memalign(kDataAlignment, 64*64));
79     source_data16_ = reinterpret_cast<uint16_t*>(
80         vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));
81     reference_data16_ = reinterpret_cast<uint16_t*>(
82         vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));
83     second_pred16_ = reinterpret_cast<uint16_t*>(
84         vpx_memalign(kDataAlignment, 64*64*sizeof(uint16_t)));
85   }
86
87   static void TearDownTestCase() {
88     vpx_free(source_data8_);
89     source_data8_ = NULL;
90     vpx_free(reference_data8_);
91     reference_data8_ = NULL;
92     vpx_free(second_pred8_);
93     second_pred8_ = NULL;
94     vpx_free(source_data16_);
95     source_data16_ = NULL;
96     vpx_free(reference_data16_);
97     reference_data16_ = NULL;
98     vpx_free(second_pred16_);
99     second_pred16_ = NULL;
100   }
101
102   virtual void TearDown() {
103     libvpx_test::ClearSystemState();
104   }
105
106  protected:
107   // Handle blocks up to 4 blocks 64x64 with stride up to 128
108   static const int kDataAlignment = 16;
109   static const int kDataBlockSize = 64 * 128;
110   static const int kDataBufferSize = 4 * kDataBlockSize;
111
112   virtual void SetUp() {
113     if (bd_ == -1) {
114       use_high_bit_depth_ = false;
115       bit_depth_ = VPX_BITS_8;
116       source_data_ = source_data8_;
117       reference_data_ = reference_data8_;
118       second_pred_ = second_pred8_;
119 #if CONFIG_VP9_HIGHBITDEPTH
120     } else {
121       use_high_bit_depth_ = true;
122       bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
123       source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
124       reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
125       second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
126 #endif  // CONFIG_VP9_HIGHBITDEPTH
127     }
128     mask_ = (1 << bit_depth_) - 1;
129     source_stride_ = (width_ + 31) & ~31;
130     reference_stride_ = width_ * 2;
131     rnd_.Reset(ACMRandom::DeterministicSeed());
132   }
133
134   virtual uint8_t *GetReference(int block_idx) {
135 #if CONFIG_VP9_HIGHBITDEPTH
136     if (use_high_bit_depth_)
137       return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
138                                 block_idx * kDataBlockSize);
139 #endif  // CONFIG_VP9_HIGHBITDEPTH
140     return reference_data_ + block_idx * kDataBlockSize;
141   }
142
143   // Sum of Absolute Differences. Given two blocks, calculate the absolute
144   // difference between two pixels in the same relative location; accumulate.
145   unsigned int ReferenceSAD(int block_idx) {
146     unsigned int sad = 0;
147       const uint8_t *const reference8 = GetReference(block_idx);
148       const uint8_t *const source8 = source_data_;
149 #if CONFIG_VP9_HIGHBITDEPTH
150       const uint16_t *const reference16 =
151           CONVERT_TO_SHORTPTR(GetReference(block_idx));
152       const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
153 #endif  // CONFIG_VP9_HIGHBITDEPTH
154     for (int h = 0; h < height_; ++h) {
155       for (int w = 0; w < width_; ++w) {
156         if (!use_high_bit_depth_) {
157           sad += abs(source8[h * source_stride_ + w] -
158                      reference8[h * reference_stride_ + w]);
159 #if CONFIG_VP9_HIGHBITDEPTH
160         } else {
161           sad += abs(source16[h * source_stride_ + w] -
162                      reference16[h * reference_stride_ + w]);
163 #endif  // CONFIG_VP9_HIGHBITDEPTH
164         }
165       }
166     }
167     return sad;
168   }
169
170   // Sum of Absolute Differences Average. Given two blocks, and a prediction
171   // calculate the absolute difference between one pixel and average of the
172   // corresponding and predicted pixels; accumulate.
173   unsigned int ReferenceSADavg(int block_idx) {
174     unsigned int sad = 0;
175     const uint8_t *const reference8 = GetReference(block_idx);
176     const uint8_t *const source8 = source_data_;
177     const uint8_t *const second_pred8 = second_pred_;
178 #if CONFIG_VP9_HIGHBITDEPTH
179     const uint16_t *const reference16 =
180         CONVERT_TO_SHORTPTR(GetReference(block_idx));
181     const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
182     const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
183 #endif  // CONFIG_VP9_HIGHBITDEPTH
184     for (int h = 0; h < height_; ++h) {
185       for (int w = 0; w < width_; ++w) {
186         if (!use_high_bit_depth_) {
187           const int tmp = second_pred8[h * width_ + w] +
188               reference8[h * reference_stride_ + w];
189           const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
190           sad += abs(source8[h * source_stride_ + w] - comp_pred);
191 #if CONFIG_VP9_HIGHBITDEPTH
192         } else {
193           const int tmp = second_pred16[h * width_ + w] +
194               reference16[h * reference_stride_ + w];
195           const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
196           sad += abs(source16[h * source_stride_ + w] - comp_pred);
197 #endif  // CONFIG_VP9_HIGHBITDEPTH
198         }
199       }
200     }
201     return sad;
202   }
203
204   void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
205     uint8_t *data8 = data;
206 #if CONFIG_VP9_HIGHBITDEPTH
207     uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
208 #endif  // CONFIG_VP9_HIGHBITDEPTH
209     for (int h = 0; h < height_; ++h) {
210       for (int w = 0; w < width_; ++w) {
211         if (!use_high_bit_depth_) {
212           data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
213 #if CONFIG_VP9_HIGHBITDEPTH
214         } else {
215           data16[h * stride + w] = fill_constant;
216 #endif  // CONFIG_VP9_HIGHBITDEPTH
217         }
218       }
219     }
220   }
221
222   void FillRandom(uint8_t *data, int stride) {
223     uint8_t *data8 = data;
224 #if CONFIG_VP9_HIGHBITDEPTH
225     uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
226 #endif  // CONFIG_VP9_HIGHBITDEPTH
227     for (int h = 0; h < height_; ++h) {
228       for (int w = 0; w < width_; ++w) {
229         if (!use_high_bit_depth_) {
230           data8[h * stride + w] = rnd_.Rand8();
231 #if CONFIG_VP9_HIGHBITDEPTH
232         } else {
233           data16[h * stride + w] = rnd_.Rand16() & mask_;
234 #endif  // CONFIG_VP9_HIGHBITDEPTH
235         }
236       }
237     }
238   }
239
240   int width_, height_, mask_, bd_;
241   vpx_bit_depth_t bit_depth_;
242   static uint8_t *source_data_;
243   static uint8_t *reference_data_;
244   static uint8_t *second_pred_;
245   int source_stride_;
246   bool use_high_bit_depth_;
247   static uint8_t *source_data8_;
248   static uint8_t *reference_data8_;
249   static uint8_t *second_pred8_;
250   static uint16_t *source_data16_;
251   static uint16_t *reference_data16_;
252   static uint16_t *second_pred16_;
253   int reference_stride_;
254
255   ACMRandom rnd_;
256 };
257
258 class SADx4Test
259     : public SADTestBase,
260       public ::testing::WithParamInterface<SadMxNx4Param> {
261  public:
262   SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
263
264  protected:
265   void SADs(unsigned int *results) {
266     const uint8_t *references[] = {GetReference(0), GetReference(1),
267                                    GetReference(2), GetReference(3)};
268
269     ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
270                                           references, reference_stride_,
271                                           results));
272   }
273
274   void CheckSADs() {
275     unsigned int reference_sad, exp_sad[4];
276
277     SADs(exp_sad);
278     for (int block = 0; block < 4; ++block) {
279       reference_sad = ReferenceSAD(block);
280
281       EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
282     }
283   }
284 };
285
286 class SADTest
287     : public SADTestBase,
288       public ::testing::WithParamInterface<SadMxNParam> {
289  public:
290   SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
291
292  protected:
293   unsigned int SAD(int block_idx) {
294     unsigned int ret;
295     const uint8_t *const reference = GetReference(block_idx);
296
297     ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
298                                                 reference, reference_stride_));
299     return ret;
300   }
301
302   void CheckSAD() {
303     const unsigned int reference_sad = ReferenceSAD(0);
304     const unsigned int exp_sad = SAD(0);
305
306     ASSERT_EQ(reference_sad, exp_sad);
307   }
308 };
309
310 class SADavgTest
311     : public SADTestBase,
312       public ::testing::WithParamInterface<SadMxNAvgParam> {
313  public:
314   SADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
315
316  protected:
317   unsigned int SAD_avg(int block_idx) {
318     unsigned int ret;
319     const uint8_t *const reference = GetReference(block_idx);
320
321     ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
322                                                 reference, reference_stride_,
323                                                 second_pred_));
324     return ret;
325   }
326
327   void CheckSAD() {
328     const unsigned int reference_sad = ReferenceSADavg(0);
329     const unsigned int exp_sad = SAD_avg(0);
330
331     ASSERT_EQ(reference_sad, exp_sad);
332   }
333 };
334
335 uint8_t *SADTestBase::source_data_ = NULL;
336 uint8_t *SADTestBase::reference_data_ = NULL;
337 uint8_t *SADTestBase::second_pred_ = NULL;
338 uint8_t *SADTestBase::source_data8_ = NULL;
339 uint8_t *SADTestBase::reference_data8_ = NULL;
340 uint8_t *SADTestBase::second_pred8_ = NULL;
341 uint16_t *SADTestBase::source_data16_ = NULL;
342 uint16_t *SADTestBase::reference_data16_ = NULL;
343 uint16_t *SADTestBase::second_pred16_ = NULL;
344
345 TEST_P(SADTest, MaxRef) {
346   FillConstant(source_data_, source_stride_, 0);
347   FillConstant(reference_data_, reference_stride_, mask_);
348   CheckSAD();
349 }
350
351 TEST_P(SADTest, MaxSrc) {
352   FillConstant(source_data_, source_stride_, mask_);
353   FillConstant(reference_data_, reference_stride_, 0);
354   CheckSAD();
355 }
356
357 TEST_P(SADTest, ShortRef) {
358   const int tmp_stride = reference_stride_;
359   reference_stride_ >>= 1;
360   FillRandom(source_data_, source_stride_);
361   FillRandom(reference_data_, reference_stride_);
362   CheckSAD();
363   reference_stride_ = tmp_stride;
364 }
365
366 TEST_P(SADTest, UnalignedRef) {
367   // The reference frame, but not the source frame, may be unaligned for
368   // certain types of searches.
369   const int tmp_stride = reference_stride_;
370   reference_stride_ -= 1;
371   FillRandom(source_data_, source_stride_);
372   FillRandom(reference_data_, reference_stride_);
373   CheckSAD();
374   reference_stride_ = tmp_stride;
375 }
376
377 TEST_P(SADTest, ShortSrc) {
378   const int tmp_stride = source_stride_;
379   source_stride_ >>= 1;
380   FillRandom(source_data_, source_stride_);
381   FillRandom(reference_data_, reference_stride_);
382   CheckSAD();
383   source_stride_ = tmp_stride;
384 }
385
386 TEST_P(SADavgTest, MaxRef) {
387   FillConstant(source_data_, source_stride_, 0);
388   FillConstant(reference_data_, reference_stride_, mask_);
389   FillConstant(second_pred_, width_, 0);
390   CheckSAD();
391 }
392 TEST_P(SADavgTest, MaxSrc) {
393   FillConstant(source_data_, source_stride_, mask_);
394   FillConstant(reference_data_, reference_stride_, 0);
395   FillConstant(second_pred_, width_, 0);
396   CheckSAD();
397 }
398
399 TEST_P(SADavgTest, ShortRef) {
400   const int tmp_stride = reference_stride_;
401   reference_stride_ >>= 1;
402   FillRandom(source_data_, source_stride_);
403   FillRandom(reference_data_, reference_stride_);
404   FillRandom(second_pred_, width_);
405   CheckSAD();
406   reference_stride_ = tmp_stride;
407 }
408
409 TEST_P(SADavgTest, UnalignedRef) {
410   // The reference frame, but not the source frame, may be unaligned for
411   // certain types of searches.
412   const int tmp_stride = reference_stride_;
413   reference_stride_ -= 1;
414   FillRandom(source_data_, source_stride_);
415   FillRandom(reference_data_, reference_stride_);
416   FillRandom(second_pred_, width_);
417   CheckSAD();
418   reference_stride_ = tmp_stride;
419 }
420
421 TEST_P(SADavgTest, ShortSrc) {
422   const int tmp_stride = source_stride_;
423   source_stride_ >>= 1;
424   FillRandom(source_data_, source_stride_);
425   FillRandom(reference_data_, reference_stride_);
426   FillRandom(second_pred_, width_);
427   CheckSAD();
428   source_stride_ = tmp_stride;
429 }
430
431 TEST_P(SADx4Test, MaxRef) {
432   FillConstant(source_data_, source_stride_, 0);
433   FillConstant(GetReference(0), reference_stride_, mask_);
434   FillConstant(GetReference(1), reference_stride_, mask_);
435   FillConstant(GetReference(2), reference_stride_, mask_);
436   FillConstant(GetReference(3), reference_stride_, mask_);
437   CheckSADs();
438 }
439
440 TEST_P(SADx4Test, MaxSrc) {
441   FillConstant(source_data_, source_stride_, mask_);
442   FillConstant(GetReference(0), reference_stride_, 0);
443   FillConstant(GetReference(1), reference_stride_, 0);
444   FillConstant(GetReference(2), reference_stride_, 0);
445   FillConstant(GetReference(3), reference_stride_, 0);
446   CheckSADs();
447 }
448
449 TEST_P(SADx4Test, ShortRef) {
450   int tmp_stride = reference_stride_;
451   reference_stride_ >>= 1;
452   FillRandom(source_data_, source_stride_);
453   FillRandom(GetReference(0), reference_stride_);
454   FillRandom(GetReference(1), reference_stride_);
455   FillRandom(GetReference(2), reference_stride_);
456   FillRandom(GetReference(3), reference_stride_);
457   CheckSADs();
458   reference_stride_ = tmp_stride;
459 }
460
461 TEST_P(SADx4Test, UnalignedRef) {
462   // The reference frame, but not the source frame, may be unaligned for
463   // certain types of searches.
464   int tmp_stride = reference_stride_;
465   reference_stride_ -= 1;
466   FillRandom(source_data_, source_stride_);
467   FillRandom(GetReference(0), reference_stride_);
468   FillRandom(GetReference(1), reference_stride_);
469   FillRandom(GetReference(2), reference_stride_);
470   FillRandom(GetReference(3), reference_stride_);
471   CheckSADs();
472   reference_stride_ = tmp_stride;
473 }
474
475 TEST_P(SADx4Test, ShortSrc) {
476   int tmp_stride = source_stride_;
477   source_stride_ >>= 1;
478   FillRandom(source_data_, source_stride_);
479   FillRandom(GetReference(0), reference_stride_);
480   FillRandom(GetReference(1), reference_stride_);
481   FillRandom(GetReference(2), reference_stride_);
482   FillRandom(GetReference(3), reference_stride_);
483   CheckSADs();
484   source_stride_ = tmp_stride;
485 }
486
487 TEST_P(SADx4Test, SrcAlignedByWidth) {
488   uint8_t * tmp_source_data = source_data_;
489   source_data_ += width_;
490   FillRandom(source_data_, source_stride_);
491   FillRandom(GetReference(0), reference_stride_);
492   FillRandom(GetReference(1), reference_stride_);
493   FillRandom(GetReference(2), reference_stride_);
494   FillRandom(GetReference(3), reference_stride_);
495   CheckSADs();
496   source_data_ = tmp_source_data;
497 }
498
499 using std::tr1::make_tuple;
500
501 //------------------------------------------------------------------------------
502 // C functions
503 const SadMxNFunc sad64x64_c = vpx_sad64x64_c;
504 const SadMxNFunc sad64x32_c = vpx_sad64x32_c;
505 const SadMxNFunc sad32x64_c = vpx_sad32x64_c;
506 const SadMxNFunc sad32x32_c = vpx_sad32x32_c;
507 const SadMxNFunc sad32x16_c = vpx_sad32x16_c;
508 const SadMxNFunc sad16x32_c = vpx_sad16x32_c;
509 const SadMxNFunc sad16x16_c = vpx_sad16x16_c;
510 const SadMxNFunc sad16x8_c = vpx_sad16x8_c;
511 const SadMxNFunc sad8x16_c = vpx_sad8x16_c;
512 const SadMxNFunc sad8x8_c = vpx_sad8x8_c;
513 const SadMxNFunc sad8x4_c = vpx_sad8x4_c;
514 const SadMxNFunc sad4x8_c = vpx_sad4x8_c;
515 const SadMxNFunc sad4x4_c = vpx_sad4x4_c;
516 #if CONFIG_VP9_HIGHBITDEPTH
517 const SadMxNFunc highbd_sad64x64_c = vpx_highbd_sad64x64_c;
518 const SadMxNFunc highbd_sad64x32_c = vpx_highbd_sad64x32_c;
519 const SadMxNFunc highbd_sad32x64_c = vpx_highbd_sad32x64_c;
520 const SadMxNFunc highbd_sad32x32_c = vpx_highbd_sad32x32_c;
521 const SadMxNFunc highbd_sad32x16_c = vpx_highbd_sad32x16_c;
522 const SadMxNFunc highbd_sad16x32_c = vpx_highbd_sad16x32_c;
523 const SadMxNFunc highbd_sad16x16_c = vpx_highbd_sad16x16_c;
524 const SadMxNFunc highbd_sad16x8_c = vpx_highbd_sad16x8_c;
525 const SadMxNFunc highbd_sad8x16_c = vpx_highbd_sad8x16_c;
526 const SadMxNFunc highbd_sad8x8_c = vpx_highbd_sad8x8_c;
527 const SadMxNFunc highbd_sad8x4_c = vpx_highbd_sad8x4_c;
528 const SadMxNFunc highbd_sad4x8_c = vpx_highbd_sad4x8_c;
529 const SadMxNFunc highbd_sad4x4_c = vpx_highbd_sad4x4_c;
530 #endif  // CONFIG_VP9_HIGHBITDEPTH
531 const SadMxNParam c_tests[] = {
532   make_tuple(64, 64, sad64x64_c, -1),
533   make_tuple(64, 32, sad64x32_c, -1),
534   make_tuple(32, 64, sad32x64_c, -1),
535   make_tuple(32, 32, sad32x32_c, -1),
536   make_tuple(32, 16, sad32x16_c, -1),
537   make_tuple(16, 32, sad16x32_c, -1),
538   make_tuple(16, 16, sad16x16_c, -1),
539   make_tuple(16, 8, sad16x8_c, -1),
540   make_tuple(8, 16, sad8x16_c, -1),
541   make_tuple(8, 8, sad8x8_c, -1),
542   make_tuple(8, 4, sad8x4_c, -1),
543   make_tuple(4, 8, sad4x8_c, -1),
544   make_tuple(4, 4, sad4x4_c, -1),
545 #if CONFIG_VP9_HIGHBITDEPTH
546   make_tuple(64, 64, highbd_sad64x64_c, 8),
547   make_tuple(64, 32, highbd_sad64x32_c, 8),
548   make_tuple(32, 64, highbd_sad32x64_c, 8),
549   make_tuple(32, 32, highbd_sad32x32_c, 8),
550   make_tuple(32, 16, highbd_sad32x16_c, 8),
551   make_tuple(16, 32, highbd_sad16x32_c, 8),
552   make_tuple(16, 16, highbd_sad16x16_c, 8),
553   make_tuple(16, 8, highbd_sad16x8_c, 8),
554   make_tuple(8, 16, highbd_sad8x16_c, 8),
555   make_tuple(8, 8, highbd_sad8x8_c, 8),
556   make_tuple(8, 4, highbd_sad8x4_c, 8),
557   make_tuple(4, 8, highbd_sad4x8_c, 8),
558   make_tuple(4, 4, highbd_sad4x4_c, 8),
559   make_tuple(64, 64, highbd_sad64x64_c, 10),
560   make_tuple(64, 32, highbd_sad64x32_c, 10),
561   make_tuple(32, 64, highbd_sad32x64_c, 10),
562   make_tuple(32, 32, highbd_sad32x32_c, 10),
563   make_tuple(32, 16, highbd_sad32x16_c, 10),
564   make_tuple(16, 32, highbd_sad16x32_c, 10),
565   make_tuple(16, 16, highbd_sad16x16_c, 10),
566   make_tuple(16, 8, highbd_sad16x8_c, 10),
567   make_tuple(8, 16, highbd_sad8x16_c, 10),
568   make_tuple(8, 8, highbd_sad8x8_c, 10),
569   make_tuple(8, 4, highbd_sad8x4_c, 10),
570   make_tuple(4, 8, highbd_sad4x8_c, 10),
571   make_tuple(4, 4, highbd_sad4x4_c, 10),
572   make_tuple(64, 64, highbd_sad64x64_c, 12),
573   make_tuple(64, 32, highbd_sad64x32_c, 12),
574   make_tuple(32, 64, highbd_sad32x64_c, 12),
575   make_tuple(32, 32, highbd_sad32x32_c, 12),
576   make_tuple(32, 16, highbd_sad32x16_c, 12),
577   make_tuple(16, 32, highbd_sad16x32_c, 12),
578   make_tuple(16, 16, highbd_sad16x16_c, 12),
579   make_tuple(16, 8, highbd_sad16x8_c, 12),
580   make_tuple(8, 16, highbd_sad8x16_c, 12),
581   make_tuple(8, 8, highbd_sad8x8_c, 12),
582   make_tuple(8, 4, highbd_sad8x4_c, 12),
583   make_tuple(4, 8, highbd_sad4x8_c, 12),
584   make_tuple(4, 4, highbd_sad4x4_c, 12),
585 #endif  // CONFIG_VP9_HIGHBITDEPTH
586 };
587 INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
588
589 const SadMxNAvgFunc sad64x64_avg_c = vpx_sad64x64_avg_c;
590 const SadMxNAvgFunc sad64x32_avg_c = vpx_sad64x32_avg_c;
591 const SadMxNAvgFunc sad32x64_avg_c = vpx_sad32x64_avg_c;
592 const SadMxNAvgFunc sad32x32_avg_c = vpx_sad32x32_avg_c;
593 const SadMxNAvgFunc sad32x16_avg_c = vpx_sad32x16_avg_c;
594 const SadMxNAvgFunc sad16x32_avg_c = vpx_sad16x32_avg_c;
595 const SadMxNAvgFunc sad16x16_avg_c = vpx_sad16x16_avg_c;
596 const SadMxNAvgFunc sad16x8_avg_c = vpx_sad16x8_avg_c;
597 const SadMxNAvgFunc sad8x16_avg_c = vpx_sad8x16_avg_c;
598 const SadMxNAvgFunc sad8x8_avg_c = vpx_sad8x8_avg_c;
599 const SadMxNAvgFunc sad8x4_avg_c = vpx_sad8x4_avg_c;
600 const SadMxNAvgFunc sad4x8_avg_c = vpx_sad4x8_avg_c;
601 const SadMxNAvgFunc sad4x4_avg_c = vpx_sad4x4_avg_c;
602 #if CONFIG_VP9_HIGHBITDEPTH
603 const SadMxNAvgFunc highbd_sad64x64_avg_c = vpx_highbd_sad64x64_avg_c;
604 const SadMxNAvgFunc highbd_sad64x32_avg_c = vpx_highbd_sad64x32_avg_c;
605 const SadMxNAvgFunc highbd_sad32x64_avg_c = vpx_highbd_sad32x64_avg_c;
606 const SadMxNAvgFunc highbd_sad32x32_avg_c = vpx_highbd_sad32x32_avg_c;
607 const SadMxNAvgFunc highbd_sad32x16_avg_c = vpx_highbd_sad32x16_avg_c;
608 const SadMxNAvgFunc highbd_sad16x32_avg_c = vpx_highbd_sad16x32_avg_c;
609 const SadMxNAvgFunc highbd_sad16x16_avg_c = vpx_highbd_sad16x16_avg_c;
610 const SadMxNAvgFunc highbd_sad16x8_avg_c = vpx_highbd_sad16x8_avg_c;
611 const SadMxNAvgFunc highbd_sad8x16_avg_c = vpx_highbd_sad8x16_avg_c;
612 const SadMxNAvgFunc highbd_sad8x8_avg_c = vpx_highbd_sad8x8_avg_c;
613 const SadMxNAvgFunc highbd_sad8x4_avg_c = vpx_highbd_sad8x4_avg_c;
614 const SadMxNAvgFunc highbd_sad4x8_avg_c = vpx_highbd_sad4x8_avg_c;
615 const SadMxNAvgFunc highbd_sad4x4_avg_c = vpx_highbd_sad4x4_avg_c;
616 #endif  // CONFIG_VP9_HIGHBITDEPTH
617 const SadMxNAvgParam avg_c_tests[] = {
618   make_tuple(64, 64, sad64x64_avg_c, -1),
619   make_tuple(64, 32, sad64x32_avg_c, -1),
620   make_tuple(32, 64, sad32x64_avg_c, -1),
621   make_tuple(32, 32, sad32x32_avg_c, -1),
622   make_tuple(32, 16, sad32x16_avg_c, -1),
623   make_tuple(16, 32, sad16x32_avg_c, -1),
624   make_tuple(16, 16, sad16x16_avg_c, -1),
625   make_tuple(16, 8, sad16x8_avg_c, -1),
626   make_tuple(8, 16, sad8x16_avg_c, -1),
627   make_tuple(8, 8, sad8x8_avg_c, -1),
628   make_tuple(8, 4, sad8x4_avg_c, -1),
629   make_tuple(4, 8, sad4x8_avg_c, -1),
630   make_tuple(4, 4, sad4x4_avg_c, -1),
631 #if CONFIG_VP9_HIGHBITDEPTH
632   make_tuple(64, 64, highbd_sad64x64_avg_c, 8),
633   make_tuple(64, 32, highbd_sad64x32_avg_c, 8),
634   make_tuple(32, 64, highbd_sad32x64_avg_c, 8),
635   make_tuple(32, 32, highbd_sad32x32_avg_c, 8),
636   make_tuple(32, 16, highbd_sad32x16_avg_c, 8),
637   make_tuple(16, 32, highbd_sad16x32_avg_c, 8),
638   make_tuple(16, 16, highbd_sad16x16_avg_c, 8),
639   make_tuple(16, 8, highbd_sad16x8_avg_c, 8),
640   make_tuple(8, 16, highbd_sad8x16_avg_c, 8),
641   make_tuple(8, 8, highbd_sad8x8_avg_c, 8),
642   make_tuple(8, 4, highbd_sad8x4_avg_c, 8),
643   make_tuple(4, 8, highbd_sad4x8_avg_c, 8),
644   make_tuple(4, 4, highbd_sad4x4_avg_c, 8),
645   make_tuple(64, 64, highbd_sad64x64_avg_c, 10),
646   make_tuple(64, 32, highbd_sad64x32_avg_c, 10),
647   make_tuple(32, 64, highbd_sad32x64_avg_c, 10),
648   make_tuple(32, 32, highbd_sad32x32_avg_c, 10),
649   make_tuple(32, 16, highbd_sad32x16_avg_c, 10),
650   make_tuple(16, 32, highbd_sad16x32_avg_c, 10),
651   make_tuple(16, 16, highbd_sad16x16_avg_c, 10),
652   make_tuple(16, 8, highbd_sad16x8_avg_c, 10),
653   make_tuple(8, 16, highbd_sad8x16_avg_c, 10),
654   make_tuple(8, 8, highbd_sad8x8_avg_c, 10),
655   make_tuple(8, 4, highbd_sad8x4_avg_c, 10),
656   make_tuple(4, 8, highbd_sad4x8_avg_c, 10),
657   make_tuple(4, 4, highbd_sad4x4_avg_c, 10),
658   make_tuple(64, 64, highbd_sad64x64_avg_c, 12),
659   make_tuple(64, 32, highbd_sad64x32_avg_c, 12),
660   make_tuple(32, 64, highbd_sad32x64_avg_c, 12),
661   make_tuple(32, 32, highbd_sad32x32_avg_c, 12),
662   make_tuple(32, 16, highbd_sad32x16_avg_c, 12),
663   make_tuple(16, 32, highbd_sad16x32_avg_c, 12),
664   make_tuple(16, 16, highbd_sad16x16_avg_c, 12),
665   make_tuple(16, 8, highbd_sad16x8_avg_c, 12),
666   make_tuple(8, 16, highbd_sad8x16_avg_c, 12),
667   make_tuple(8, 8, highbd_sad8x8_avg_c, 12),
668   make_tuple(8, 4, highbd_sad8x4_avg_c, 12),
669   make_tuple(4, 8, highbd_sad4x8_avg_c, 12),
670   make_tuple(4, 4, highbd_sad4x4_avg_c, 12),
671 #endif  // CONFIG_VP9_HIGHBITDEPTH
672 };
673 INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
674
675 const SadMxNx4Func sad64x64x4d_c = vpx_sad64x64x4d_c;
676 const SadMxNx4Func sad64x32x4d_c = vpx_sad64x32x4d_c;
677 const SadMxNx4Func sad32x64x4d_c = vpx_sad32x64x4d_c;
678 const SadMxNx4Func sad32x32x4d_c = vpx_sad32x32x4d_c;
679 const SadMxNx4Func sad32x16x4d_c = vpx_sad32x16x4d_c;
680 const SadMxNx4Func sad16x32x4d_c = vpx_sad16x32x4d_c;
681 const SadMxNx4Func sad16x16x4d_c = vpx_sad16x16x4d_c;
682 const SadMxNx4Func sad16x8x4d_c = vpx_sad16x8x4d_c;
683 const SadMxNx4Func sad8x16x4d_c = vpx_sad8x16x4d_c;
684 const SadMxNx4Func sad8x8x4d_c = vpx_sad8x8x4d_c;
685 const SadMxNx4Func sad8x4x4d_c = vpx_sad8x4x4d_c;
686 const SadMxNx4Func sad4x8x4d_c = vpx_sad4x8x4d_c;
687 const SadMxNx4Func sad4x4x4d_c = vpx_sad4x4x4d_c;
688 #if CONFIG_VP9_HIGHBITDEPTH
689 const SadMxNx4Func highbd_sad64x64x4d_c = vpx_highbd_sad64x64x4d_c;
690 const SadMxNx4Func highbd_sad64x32x4d_c = vpx_highbd_sad64x32x4d_c;
691 const SadMxNx4Func highbd_sad32x64x4d_c = vpx_highbd_sad32x64x4d_c;
692 const SadMxNx4Func highbd_sad32x32x4d_c = vpx_highbd_sad32x32x4d_c;
693 const SadMxNx4Func highbd_sad32x16x4d_c = vpx_highbd_sad32x16x4d_c;
694 const SadMxNx4Func highbd_sad16x32x4d_c = vpx_highbd_sad16x32x4d_c;
695 const SadMxNx4Func highbd_sad16x16x4d_c = vpx_highbd_sad16x16x4d_c;
696 const SadMxNx4Func highbd_sad16x8x4d_c = vpx_highbd_sad16x8x4d_c;
697 const SadMxNx4Func highbd_sad8x16x4d_c = vpx_highbd_sad8x16x4d_c;
698 const SadMxNx4Func highbd_sad8x8x4d_c = vpx_highbd_sad8x8x4d_c;
699 const SadMxNx4Func highbd_sad8x4x4d_c = vpx_highbd_sad8x4x4d_c;
700 const SadMxNx4Func highbd_sad4x8x4d_c = vpx_highbd_sad4x8x4d_c;
701 const SadMxNx4Func highbd_sad4x4x4d_c = vpx_highbd_sad4x4x4d_c;
702 #endif  // CONFIG_VP9_HIGHBITDEPTH
703 const SadMxNx4Param x4d_c_tests[] = {
704   make_tuple(64, 64, sad64x64x4d_c, -1),
705   make_tuple(64, 32, sad64x32x4d_c, -1),
706   make_tuple(32, 64, sad32x64x4d_c, -1),
707   make_tuple(32, 32, sad32x32x4d_c, -1),
708   make_tuple(32, 16, sad32x16x4d_c, -1),
709   make_tuple(16, 32, sad16x32x4d_c, -1),
710   make_tuple(16, 16, sad16x16x4d_c, -1),
711   make_tuple(16, 8, sad16x8x4d_c, -1),
712   make_tuple(8, 16, sad8x16x4d_c, -1),
713   make_tuple(8, 8, sad8x8x4d_c, -1),
714   make_tuple(8, 4, sad8x4x4d_c, -1),
715   make_tuple(4, 8, sad4x8x4d_c, -1),
716   make_tuple(4, 4, sad4x4x4d_c, -1),
717 #if CONFIG_VP9_HIGHBITDEPTH
718   make_tuple(64, 64, highbd_sad64x64x4d_c, 8),
719   make_tuple(64, 32, highbd_sad64x32x4d_c, 8),
720   make_tuple(32, 64, highbd_sad32x64x4d_c, 8),
721   make_tuple(32, 32, highbd_sad32x32x4d_c, 8),
722   make_tuple(32, 16, highbd_sad32x16x4d_c, 8),
723   make_tuple(16, 32, highbd_sad16x32x4d_c, 8),
724   make_tuple(16, 16, highbd_sad16x16x4d_c, 8),
725   make_tuple(16, 8, highbd_sad16x8x4d_c, 8),
726   make_tuple(8, 16, highbd_sad8x16x4d_c, 8),
727   make_tuple(8, 8, highbd_sad8x8x4d_c, 8),
728   make_tuple(8, 4, highbd_sad8x4x4d_c, 8),
729   make_tuple(4, 8, highbd_sad4x8x4d_c, 8),
730   make_tuple(4, 4, highbd_sad4x4x4d_c, 8),
731   make_tuple(64, 64, highbd_sad64x64x4d_c, 10),
732   make_tuple(64, 32, highbd_sad64x32x4d_c, 10),
733   make_tuple(32, 64, highbd_sad32x64x4d_c, 10),
734   make_tuple(32, 32, highbd_sad32x32x4d_c, 10),
735   make_tuple(32, 16, highbd_sad32x16x4d_c, 10),
736   make_tuple(16, 32, highbd_sad16x32x4d_c, 10),
737   make_tuple(16, 16, highbd_sad16x16x4d_c, 10),
738   make_tuple(16, 8, highbd_sad16x8x4d_c, 10),
739   make_tuple(8, 16, highbd_sad8x16x4d_c, 10),
740   make_tuple(8, 8, highbd_sad8x8x4d_c, 10),
741   make_tuple(8, 4, highbd_sad8x4x4d_c, 10),
742   make_tuple(4, 8, highbd_sad4x8x4d_c, 10),
743   make_tuple(4, 4, highbd_sad4x4x4d_c, 10),
744   make_tuple(64, 64, highbd_sad64x64x4d_c, 12),
745   make_tuple(64, 32, highbd_sad64x32x4d_c, 12),
746   make_tuple(32, 64, highbd_sad32x64x4d_c, 12),
747   make_tuple(32, 32, highbd_sad32x32x4d_c, 12),
748   make_tuple(32, 16, highbd_sad32x16x4d_c, 12),
749   make_tuple(16, 32, highbd_sad16x32x4d_c, 12),
750   make_tuple(16, 16, highbd_sad16x16x4d_c, 12),
751   make_tuple(16, 8, highbd_sad16x8x4d_c, 12),
752   make_tuple(8, 16, highbd_sad8x16x4d_c, 12),
753   make_tuple(8, 8, highbd_sad8x8x4d_c, 12),
754   make_tuple(8, 4, highbd_sad8x4x4d_c, 12),
755   make_tuple(4, 8, highbd_sad4x8x4d_c, 12),
756   make_tuple(4, 4, highbd_sad4x4x4d_c, 12),
757 #endif  // CONFIG_VP9_HIGHBITDEPTH
758 };
759 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
760
761 //------------------------------------------------------------------------------
762 // ARM functions
763 #if HAVE_MEDIA
764 const SadMxNFunc sad16x16_media = vpx_sad16x16_media;
765 const SadMxNParam media_tests[] = {
766   make_tuple(16, 16, sad16x16_media, -1),
767 };
768 INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::ValuesIn(media_tests));
769 #endif  // HAVE_MEDIA
770
771 #if HAVE_NEON
772 const SadMxNFunc sad64x64_neon = vpx_sad64x64_neon;
773 const SadMxNFunc sad32x32_neon = vpx_sad32x32_neon;
774 const SadMxNFunc sad16x16_neon = vpx_sad16x16_neon;
775 const SadMxNFunc sad16x8_neon = vpx_sad16x8_neon;
776 const SadMxNFunc sad8x16_neon = vpx_sad8x16_neon;
777 const SadMxNFunc sad8x8_neon = vpx_sad8x8_neon;
778 const SadMxNFunc sad4x4_neon = vpx_sad4x4_neon;
779
780 const SadMxNParam neon_tests[] = {
781   make_tuple(64, 64, sad64x64_neon, -1),
782   make_tuple(32, 32, sad32x32_neon, -1),
783   make_tuple(16, 16, sad16x16_neon, -1),
784   make_tuple(16, 8, sad16x8_neon, -1),
785   make_tuple(8, 16, sad8x16_neon, -1),
786   make_tuple(8, 8, sad8x8_neon, -1),
787   make_tuple(4, 4, sad4x4_neon, -1),
788 };
789 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
790
791 const SadMxNx4Func sad64x64x4d_neon = vpx_sad64x64x4d_neon;
792 const SadMxNx4Func sad32x32x4d_neon = vpx_sad32x32x4d_neon;
793 const SadMxNx4Func sad16x16x4d_neon = vpx_sad16x16x4d_neon;
794 const SadMxNx4Param x4d_neon_tests[] = {
795   make_tuple(64, 64, sad64x64x4d_neon, -1),
796   make_tuple(32, 32, sad32x32x4d_neon, -1),
797   make_tuple(16, 16, sad16x16x4d_neon, -1),
798 };
799 INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
800 #endif  // HAVE_NEON
801
802 //------------------------------------------------------------------------------
803 // x86 functions
804 #if HAVE_MMX
805 const SadMxNFunc sad16x16_mmx = vpx_sad16x16_mmx;
806 const SadMxNFunc sad16x8_mmx = vpx_sad16x8_mmx;
807 const SadMxNFunc sad8x16_mmx = vpx_sad8x16_mmx;
808 const SadMxNFunc sad8x8_mmx = vpx_sad8x8_mmx;
809 const SadMxNFunc sad4x4_mmx = vpx_sad4x4_mmx;
810 const SadMxNParam mmx_tests[] = {
811   make_tuple(16, 16, sad16x16_mmx, -1),
812   make_tuple(16, 8, sad16x8_mmx, -1),
813   make_tuple(8, 16, sad8x16_mmx, -1),
814   make_tuple(8, 8, sad8x8_mmx, -1),
815   make_tuple(4, 4, sad4x4_mmx, -1),
816 };
817 INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
818 #endif  // HAVE_MMX
819
820 #if HAVE_SSE
821 #if CONFIG_USE_X86INC
822 const SadMxNFunc sad4x8_sse = vpx_sad4x8_sse;
823 const SadMxNFunc sad4x4_sse = vpx_sad4x4_sse;
824 const SadMxNParam sse_tests[] = {
825   make_tuple(4, 8, sad4x8_sse, -1),
826   make_tuple(4, 4, sad4x4_sse, -1),
827 };
828 INSTANTIATE_TEST_CASE_P(SSE, SADTest, ::testing::ValuesIn(sse_tests));
829
830 const SadMxNAvgFunc sad4x8_avg_sse = vpx_sad4x8_avg_sse;
831 const SadMxNAvgFunc sad4x4_avg_sse = vpx_sad4x4_avg_sse;
832 const SadMxNAvgParam avg_sse_tests[] = {
833   make_tuple(4, 8, sad4x8_avg_sse, -1),
834   make_tuple(4, 4, sad4x4_avg_sse, -1),
835 };
836 INSTANTIATE_TEST_CASE_P(SSE, SADavgTest, ::testing::ValuesIn(avg_sse_tests));
837
838 const SadMxNx4Func sad4x8x4d_sse = vpx_sad4x8x4d_sse;
839 const SadMxNx4Func sad4x4x4d_sse = vpx_sad4x4x4d_sse;
840 const SadMxNx4Param x4d_sse_tests[] = {
841   make_tuple(4, 8, sad4x8x4d_sse, -1),
842   make_tuple(4, 4, sad4x4x4d_sse, -1),
843 };
844 INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::ValuesIn(x4d_sse_tests));
845 #endif  // CONFIG_USE_X86INC
846 #endif  // HAVE_SSE
847
848 #if HAVE_SSE2
849 #if CONFIG_USE_X86INC
850 const SadMxNFunc sad64x64_sse2 = vpx_sad64x64_sse2;
851 const SadMxNFunc sad64x32_sse2 = vpx_sad64x32_sse2;
852 const SadMxNFunc sad32x64_sse2 = vpx_sad32x64_sse2;
853 const SadMxNFunc sad32x32_sse2 = vpx_sad32x32_sse2;
854 const SadMxNFunc sad32x16_sse2 = vpx_sad32x16_sse2;
855 const SadMxNFunc sad16x32_sse2 = vpx_sad16x32_sse2;
856 const SadMxNFunc sad16x16_sse2 = vpx_sad16x16_sse2;
857 const SadMxNFunc sad16x8_sse2 = vpx_sad16x8_sse2;
858 const SadMxNFunc sad8x16_sse2 = vpx_sad8x16_sse2;
859 const SadMxNFunc sad8x8_sse2 = vpx_sad8x8_sse2;
860 const SadMxNFunc sad8x4_sse2 = vpx_sad8x4_sse2;
861 #if CONFIG_VP9_HIGHBITDEPTH
862 const SadMxNFunc highbd_sad64x64_sse2 = vpx_highbd_sad64x64_sse2;
863 const SadMxNFunc highbd_sad64x32_sse2 = vpx_highbd_sad64x32_sse2;
864 const SadMxNFunc highbd_sad32x64_sse2 = vpx_highbd_sad32x64_sse2;
865 const SadMxNFunc highbd_sad32x32_sse2 = vpx_highbd_sad32x32_sse2;
866 const SadMxNFunc highbd_sad32x16_sse2 = vpx_highbd_sad32x16_sse2;
867 const SadMxNFunc highbd_sad16x32_sse2 = vpx_highbd_sad16x32_sse2;
868 const SadMxNFunc highbd_sad16x16_sse2 = vpx_highbd_sad16x16_sse2;
869 const SadMxNFunc highbd_sad16x8_sse2 = vpx_highbd_sad16x8_sse2;
870 const SadMxNFunc highbd_sad8x16_sse2 = vpx_highbd_sad8x16_sse2;
871 const SadMxNFunc highbd_sad8x8_sse2 = vpx_highbd_sad8x8_sse2;
872 const SadMxNFunc highbd_sad8x4_sse2 = vpx_highbd_sad8x4_sse2;
873 #endif  // CONFIG_VP9_HIGHBITDEPTH
874 const SadMxNParam sse2_tests[] = {
875   make_tuple(64, 64, sad64x64_sse2, -1),
876   make_tuple(64, 32, sad64x32_sse2, -1),
877   make_tuple(32, 64, sad32x64_sse2, -1),
878   make_tuple(32, 32, sad32x32_sse2, -1),
879   make_tuple(32, 16, sad32x16_sse2, -1),
880   make_tuple(16, 32, sad16x32_sse2, -1),
881   make_tuple(16, 16, sad16x16_sse2, -1),
882   make_tuple(16, 8, sad16x8_sse2, -1),
883   make_tuple(8, 16, sad8x16_sse2, -1),
884   make_tuple(8, 8, sad8x8_sse2, -1),
885   make_tuple(8, 4, sad8x4_sse2, -1),
886 #if CONFIG_VP9_HIGHBITDEPTH
887   make_tuple(64, 64, highbd_sad64x64_sse2, 8),
888   make_tuple(64, 32, highbd_sad64x32_sse2, 8),
889   make_tuple(32, 64, highbd_sad32x64_sse2, 8),
890   make_tuple(32, 32, highbd_sad32x32_sse2, 8),
891   make_tuple(32, 16, highbd_sad32x16_sse2, 8),
892   make_tuple(16, 32, highbd_sad16x32_sse2, 8),
893   make_tuple(16, 16, highbd_sad16x16_sse2, 8),
894   make_tuple(16, 8, highbd_sad16x8_sse2, 8),
895   make_tuple(8, 16, highbd_sad8x16_sse2, 8),
896   make_tuple(8, 8, highbd_sad8x8_sse2, 8),
897   make_tuple(8, 4, highbd_sad8x4_sse2, 8),
898   make_tuple(64, 64, highbd_sad64x64_sse2, 10),
899   make_tuple(64, 32, highbd_sad64x32_sse2, 10),
900   make_tuple(32, 64, highbd_sad32x64_sse2, 10),
901   make_tuple(32, 32, highbd_sad32x32_sse2, 10),
902   make_tuple(32, 16, highbd_sad32x16_sse2, 10),
903   make_tuple(16, 32, highbd_sad16x32_sse2, 10),
904   make_tuple(16, 16, highbd_sad16x16_sse2, 10),
905   make_tuple(16, 8, highbd_sad16x8_sse2, 10),
906   make_tuple(8, 16, highbd_sad8x16_sse2, 10),
907   make_tuple(8, 8, highbd_sad8x8_sse2, 10),
908   make_tuple(8, 4, highbd_sad8x4_sse2, 10),
909   make_tuple(64, 64, highbd_sad64x64_sse2, 12),
910   make_tuple(64, 32, highbd_sad64x32_sse2, 12),
911   make_tuple(32, 64, highbd_sad32x64_sse2, 12),
912   make_tuple(32, 32, highbd_sad32x32_sse2, 12),
913   make_tuple(32, 16, highbd_sad32x16_sse2, 12),
914   make_tuple(16, 32, highbd_sad16x32_sse2, 12),
915   make_tuple(16, 16, highbd_sad16x16_sse2, 12),
916   make_tuple(16, 8, highbd_sad16x8_sse2, 12),
917   make_tuple(8, 16, highbd_sad8x16_sse2, 12),
918   make_tuple(8, 8, highbd_sad8x8_sse2, 12),
919   make_tuple(8, 4, highbd_sad8x4_sse2, 12),
920 #endif  // CONFIG_VP9_HIGHBITDEPTH
921 };
922 INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
923
924 const SadMxNAvgFunc sad64x64_avg_sse2 = vpx_sad64x64_avg_sse2;
925 const SadMxNAvgFunc sad64x32_avg_sse2 = vpx_sad64x32_avg_sse2;
926 const SadMxNAvgFunc sad32x64_avg_sse2 = vpx_sad32x64_avg_sse2;
927 const SadMxNAvgFunc sad32x32_avg_sse2 = vpx_sad32x32_avg_sse2;
928 const SadMxNAvgFunc sad32x16_avg_sse2 = vpx_sad32x16_avg_sse2;
929 const SadMxNAvgFunc sad16x32_avg_sse2 = vpx_sad16x32_avg_sse2;
930 const SadMxNAvgFunc sad16x16_avg_sse2 = vpx_sad16x16_avg_sse2;
931 const SadMxNAvgFunc sad16x8_avg_sse2 = vpx_sad16x8_avg_sse2;
932 const SadMxNAvgFunc sad8x16_avg_sse2 = vpx_sad8x16_avg_sse2;
933 const SadMxNAvgFunc sad8x8_avg_sse2 = vpx_sad8x8_avg_sse2;
934 const SadMxNAvgFunc sad8x4_avg_sse2 = vpx_sad8x4_avg_sse2;
935 #if CONFIG_VP9_HIGHBITDEPTH
936 const SadMxNAvgFunc highbd_sad64x64_avg_sse2 = vpx_highbd_sad64x64_avg_sse2;
937 const SadMxNAvgFunc highbd_sad64x32_avg_sse2 = vpx_highbd_sad64x32_avg_sse2;
938 const SadMxNAvgFunc highbd_sad32x64_avg_sse2 = vpx_highbd_sad32x64_avg_sse2;
939 const SadMxNAvgFunc highbd_sad32x32_avg_sse2 = vpx_highbd_sad32x32_avg_sse2;
940 const SadMxNAvgFunc highbd_sad32x16_avg_sse2 = vpx_highbd_sad32x16_avg_sse2;
941 const SadMxNAvgFunc highbd_sad16x32_avg_sse2 = vpx_highbd_sad16x32_avg_sse2;
942 const SadMxNAvgFunc highbd_sad16x16_avg_sse2 = vpx_highbd_sad16x16_avg_sse2;
943 const SadMxNAvgFunc highbd_sad16x8_avg_sse2 = vpx_highbd_sad16x8_avg_sse2;
944 const SadMxNAvgFunc highbd_sad8x16_avg_sse2 = vpx_highbd_sad8x16_avg_sse2;
945 const SadMxNAvgFunc highbd_sad8x8_avg_sse2 = vpx_highbd_sad8x8_avg_sse2;
946 const SadMxNAvgFunc highbd_sad8x4_avg_sse2 = vpx_highbd_sad8x4_avg_sse2;
947 #endif  // CONFIG_VP9_HIGHBITDEPTH
948 const SadMxNAvgParam avg_sse2_tests[] = {
949   make_tuple(64, 64, sad64x64_avg_sse2, -1),
950   make_tuple(64, 32, sad64x32_avg_sse2, -1),
951   make_tuple(32, 64, sad32x64_avg_sse2, -1),
952   make_tuple(32, 32, sad32x32_avg_sse2, -1),
953   make_tuple(32, 16, sad32x16_avg_sse2, -1),
954   make_tuple(16, 32, sad16x32_avg_sse2, -1),
955   make_tuple(16, 16, sad16x16_avg_sse2, -1),
956   make_tuple(16, 8, sad16x8_avg_sse2, -1),
957   make_tuple(8, 16, sad8x16_avg_sse2, -1),
958   make_tuple(8, 8, sad8x8_avg_sse2, -1),
959   make_tuple(8, 4, sad8x4_avg_sse2, -1),
960 #if CONFIG_VP9_HIGHBITDEPTH
961   make_tuple(64, 64, highbd_sad64x64_avg_sse2, 8),
962   make_tuple(64, 32, highbd_sad64x32_avg_sse2, 8),
963   make_tuple(32, 64, highbd_sad32x64_avg_sse2, 8),
964   make_tuple(32, 32, highbd_sad32x32_avg_sse2, 8),
965   make_tuple(32, 16, highbd_sad32x16_avg_sse2, 8),
966   make_tuple(16, 32, highbd_sad16x32_avg_sse2, 8),
967   make_tuple(16, 16, highbd_sad16x16_avg_sse2, 8),
968   make_tuple(16, 8, highbd_sad16x8_avg_sse2, 8),
969   make_tuple(8, 16, highbd_sad8x16_avg_sse2, 8),
970   make_tuple(8, 8, highbd_sad8x8_avg_sse2, 8),
971   make_tuple(8, 4, highbd_sad8x4_avg_sse2, 8),
972   make_tuple(64, 64, highbd_sad64x64_avg_sse2, 10),
973   make_tuple(64, 32, highbd_sad64x32_avg_sse2, 10),
974   make_tuple(32, 64, highbd_sad32x64_avg_sse2, 10),
975   make_tuple(32, 32, highbd_sad32x32_avg_sse2, 10),
976   make_tuple(32, 16, highbd_sad32x16_avg_sse2, 10),
977   make_tuple(16, 32, highbd_sad16x32_avg_sse2, 10),
978   make_tuple(16, 16, highbd_sad16x16_avg_sse2, 10),
979   make_tuple(16, 8, highbd_sad16x8_avg_sse2, 10),
980   make_tuple(8, 16, highbd_sad8x16_avg_sse2, 10),
981   make_tuple(8, 8, highbd_sad8x8_avg_sse2, 10),
982   make_tuple(8, 4, highbd_sad8x4_avg_sse2, 10),
983   make_tuple(64, 64, highbd_sad64x64_avg_sse2, 12),
984   make_tuple(64, 32, highbd_sad64x32_avg_sse2, 12),
985   make_tuple(32, 64, highbd_sad32x64_avg_sse2, 12),
986   make_tuple(32, 32, highbd_sad32x32_avg_sse2, 12),
987   make_tuple(32, 16, highbd_sad32x16_avg_sse2, 12),
988   make_tuple(16, 32, highbd_sad16x32_avg_sse2, 12),
989   make_tuple(16, 16, highbd_sad16x16_avg_sse2, 12),
990   make_tuple(16, 8, highbd_sad16x8_avg_sse2, 12),
991   make_tuple(8, 16, highbd_sad8x16_avg_sse2, 12),
992   make_tuple(8, 8, highbd_sad8x8_avg_sse2, 12),
993   make_tuple(8, 4, highbd_sad8x4_avg_sse2, 12),
994 #endif  // CONFIG_VP9_HIGHBITDEPTH
995 };
996 INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
997
998 const SadMxNx4Func sad64x64x4d_sse2 = vpx_sad64x64x4d_sse2;
999 const SadMxNx4Func sad64x32x4d_sse2 = vpx_sad64x32x4d_sse2;
1000 const SadMxNx4Func sad32x64x4d_sse2 = vpx_sad32x64x4d_sse2;
1001 const SadMxNx4Func sad32x32x4d_sse2 = vpx_sad32x32x4d_sse2;
1002 const SadMxNx4Func sad32x16x4d_sse2 = vpx_sad32x16x4d_sse2;
1003 const SadMxNx4Func sad16x32x4d_sse2 = vpx_sad16x32x4d_sse2;
1004 const SadMxNx4Func sad16x16x4d_sse2 = vpx_sad16x16x4d_sse2;
1005 const SadMxNx4Func sad16x8x4d_sse2 = vpx_sad16x8x4d_sse2;
1006 const SadMxNx4Func sad8x16x4d_sse2 = vpx_sad8x16x4d_sse2;
1007 const SadMxNx4Func sad8x8x4d_sse2 = vpx_sad8x8x4d_sse2;
1008 const SadMxNx4Func sad8x4x4d_sse2 = vpx_sad8x4x4d_sse2;
1009 #if CONFIG_VP9_HIGHBITDEPTH
1010 const SadMxNx4Func highbd_sad64x64x4d_sse2 = vpx_highbd_sad64x64x4d_sse2;
1011 const SadMxNx4Func highbd_sad64x32x4d_sse2 = vpx_highbd_sad64x32x4d_sse2;
1012 const SadMxNx4Func highbd_sad32x64x4d_sse2 = vpx_highbd_sad32x64x4d_sse2;
1013 const SadMxNx4Func highbd_sad32x32x4d_sse2 = vpx_highbd_sad32x32x4d_sse2;
1014 const SadMxNx4Func highbd_sad32x16x4d_sse2 = vpx_highbd_sad32x16x4d_sse2;
1015 const SadMxNx4Func highbd_sad16x32x4d_sse2 = vpx_highbd_sad16x32x4d_sse2;
1016 const SadMxNx4Func highbd_sad16x16x4d_sse2 = vpx_highbd_sad16x16x4d_sse2;
1017 const SadMxNx4Func highbd_sad16x8x4d_sse2 = vpx_highbd_sad16x8x4d_sse2;
1018 const SadMxNx4Func highbd_sad8x16x4d_sse2 = vpx_highbd_sad8x16x4d_sse2;
1019 const SadMxNx4Func highbd_sad8x8x4d_sse2 = vpx_highbd_sad8x8x4d_sse2;
1020 const SadMxNx4Func highbd_sad8x4x4d_sse2 = vpx_highbd_sad8x4x4d_sse2;
1021 const SadMxNx4Func highbd_sad4x8x4d_sse2 = vpx_highbd_sad4x8x4d_sse2;
1022 const SadMxNx4Func highbd_sad4x4x4d_sse2 = vpx_highbd_sad4x4x4d_sse2;
1023 #endif  // CONFIG_VP9_HIGHBITDEPTH
1024 const SadMxNx4Param x4d_sse2_tests[] = {
1025   make_tuple(64, 64, sad64x64x4d_sse2, -1),
1026   make_tuple(64, 32, sad64x32x4d_sse2, -1),
1027   make_tuple(32, 64, sad32x64x4d_sse2, -1),
1028   make_tuple(32, 32, sad32x32x4d_sse2, -1),
1029   make_tuple(32, 16, sad32x16x4d_sse2, -1),
1030   make_tuple(16, 32, sad16x32x4d_sse2, -1),
1031   make_tuple(16, 16, sad16x16x4d_sse2, -1),
1032   make_tuple(16, 8, sad16x8x4d_sse2, -1),
1033   make_tuple(8, 16, sad8x16x4d_sse2, -1),
1034   make_tuple(8, 8, sad8x8x4d_sse2, -1),
1035   make_tuple(8, 4, sad8x4x4d_sse2, -1),
1036 #if CONFIG_VP9_HIGHBITDEPTH
1037   make_tuple(64, 64, highbd_sad64x64x4d_sse2, 8),
1038   make_tuple(64, 32, highbd_sad64x32x4d_sse2, 8),
1039   make_tuple(32, 64, highbd_sad32x64x4d_sse2, 8),
1040   make_tuple(32, 32, highbd_sad32x32x4d_sse2, 8),
1041   make_tuple(32, 16, highbd_sad32x16x4d_sse2, 8),
1042   make_tuple(16, 32, highbd_sad16x32x4d_sse2, 8),
1043   make_tuple(16, 16, highbd_sad16x16x4d_sse2, 8),
1044   make_tuple(16, 8, highbd_sad16x8x4d_sse2, 8),
1045   make_tuple(8, 16, highbd_sad8x16x4d_sse2, 8),
1046   make_tuple(8, 8, highbd_sad8x8x4d_sse2, 8),
1047   make_tuple(8, 4, highbd_sad8x4x4d_sse2, 8),
1048   make_tuple(4, 8, highbd_sad4x8x4d_sse2, 8),
1049   make_tuple(4, 4, highbd_sad4x4x4d_sse2, 8),
1050   make_tuple(64, 64, highbd_sad64x64x4d_sse2, 10),
1051   make_tuple(64, 32, highbd_sad64x32x4d_sse2, 10),
1052   make_tuple(32, 64, highbd_sad32x64x4d_sse2, 10),
1053   make_tuple(32, 32, highbd_sad32x32x4d_sse2, 10),
1054   make_tuple(32, 16, highbd_sad32x16x4d_sse2, 10),
1055   make_tuple(16, 32, highbd_sad16x32x4d_sse2, 10),
1056   make_tuple(16, 16, highbd_sad16x16x4d_sse2, 10),
1057   make_tuple(16, 8, highbd_sad16x8x4d_sse2, 10),
1058   make_tuple(8, 16, highbd_sad8x16x4d_sse2, 10),
1059   make_tuple(8, 8, highbd_sad8x8x4d_sse2, 10),
1060   make_tuple(8, 4, highbd_sad8x4x4d_sse2, 10),
1061   make_tuple(4, 8, highbd_sad4x8x4d_sse2, 10),
1062   make_tuple(4, 4, highbd_sad4x4x4d_sse2, 10),
1063   make_tuple(64, 64, highbd_sad64x64x4d_sse2, 12),
1064   make_tuple(64, 32, highbd_sad64x32x4d_sse2, 12),
1065   make_tuple(32, 64, highbd_sad32x64x4d_sse2, 12),
1066   make_tuple(32, 32, highbd_sad32x32x4d_sse2, 12),
1067   make_tuple(32, 16, highbd_sad32x16x4d_sse2, 12),
1068   make_tuple(16, 32, highbd_sad16x32x4d_sse2, 12),
1069   make_tuple(16, 16, highbd_sad16x16x4d_sse2, 12),
1070   make_tuple(16, 8, highbd_sad16x8x4d_sse2, 12),
1071   make_tuple(8, 16, highbd_sad8x16x4d_sse2, 12),
1072   make_tuple(8, 8, highbd_sad8x8x4d_sse2, 12),
1073   make_tuple(8, 4, highbd_sad8x4x4d_sse2, 12),
1074   make_tuple(4, 8, highbd_sad4x8x4d_sse2, 12),
1075   make_tuple(4, 4, highbd_sad4x4x4d_sse2, 12),
1076 #endif  // CONFIG_VP9_HIGHBITDEPTH
1077 };
1078 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
1079 #endif  // CONFIG_USE_X86INC
1080 #endif  // HAVE_SSE2
1081
1082 #if HAVE_SSE3
1083 // Only functions are x3, which do not have tests.
1084 #endif  // HAVE_SSE3
1085
1086 #if HAVE_SSSE3
1087 // Only functions are x3, which do not have tests.
1088 #endif  // HAVE_SSSE3
1089
1090 #if HAVE_SSE4_1
1091 // Only functions are x8, which do not have tests.
1092 #endif  // HAVE_SSE4_1
1093
1094 #if HAVE_AVX2
1095 const SadMxNFunc sad64x64_avx2 = vpx_sad64x64_avx2;
1096 const SadMxNFunc sad64x32_avx2 = vpx_sad64x32_avx2;
1097 const SadMxNFunc sad32x64_avx2 = vpx_sad32x64_avx2;
1098 const SadMxNFunc sad32x32_avx2 = vpx_sad32x32_avx2;
1099 const SadMxNFunc sad32x16_avx2 = vpx_sad32x16_avx2;
1100 const SadMxNParam avx2_tests[] = {
1101   make_tuple(64, 64, sad64x64_avx2, -1),
1102   make_tuple(64, 32, sad64x32_avx2, -1),
1103   make_tuple(32, 64, sad32x64_avx2, -1),
1104   make_tuple(32, 32, sad32x32_avx2, -1),
1105   make_tuple(32, 16, sad32x16_avx2, -1),
1106 };
1107 INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
1108
1109 const SadMxNAvgFunc sad64x64_avg_avx2 = vpx_sad64x64_avg_avx2;
1110 const SadMxNAvgFunc sad64x32_avg_avx2 = vpx_sad64x32_avg_avx2;
1111 const SadMxNAvgFunc sad32x64_avg_avx2 = vpx_sad32x64_avg_avx2;
1112 const SadMxNAvgFunc sad32x32_avg_avx2 = vpx_sad32x32_avg_avx2;
1113 const SadMxNAvgFunc sad32x16_avg_avx2 = vpx_sad32x16_avg_avx2;
1114 const SadMxNAvgParam avg_avx2_tests[] = {
1115   make_tuple(64, 64, sad64x64_avg_avx2, -1),
1116   make_tuple(64, 32, sad64x32_avg_avx2, -1),
1117   make_tuple(32, 64, sad32x64_avg_avx2, -1),
1118   make_tuple(32, 32, sad32x32_avg_avx2, -1),
1119   make_tuple(32, 16, sad32x16_avg_avx2, -1),
1120 };
1121 INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
1122
1123 const SadMxNx4Func sad64x64x4d_avx2 = vpx_sad64x64x4d_avx2;
1124 const SadMxNx4Func sad32x32x4d_avx2 = vpx_sad32x32x4d_avx2;
1125 const SadMxNx4Param x4d_avx2_tests[] = {
1126   make_tuple(64, 64, sad64x64x4d_avx2, -1),
1127   make_tuple(32, 32, sad32x32x4d_avx2, -1),
1128 };
1129 INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
1130 #endif  // HAVE_AVX2
1131
1132 }  // namespace