blob: 1985e183b3bf13307dc5a38ab3739a840afbc4e8 [file] [log] [blame]
Johannfbea8972012-06-28 11:43:58 -07001/*
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
Jingning Han097d59c2015-07-29 14:51:36 -070016#include "third_party/googletest/src/include/gtest/gtest.h"
17
Johannfbea8972012-06-28 11:43:58 -070018#include "./vpx_config.h"
Johannd5d92892015-04-17 16:11:38 -040019#include "./vpx_dsp_rtcd.h"
Johannfbea8972012-06-28 11:43:58 -070020#include "test/acm_random.h"
James Zern5b756742013-06-17 22:58:40 -070021#include "test/clear_system_state.h"
James Zerneebb6482012-11-27 13:08:05 -080022#include "test/register_state_check.h"
Johannfbea8972012-06-28 11:43:58 -070023#include "test/util.h"
Peter de Rivaz7eee4872014-10-16 13:41:55 +010024#include "vpx/vpx_codec.h"
Jingning Han097d59c2015-07-29 14:51:36 -070025#include "vpx_mem/vpx_mem.h"
26#include "vpx_ports/mem.h"
Johannfbea8972012-06-28 11:43:58 -070027
Johannd5d92892015-04-17 16:11:38 -040028typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr,
29 int src_stride,
30 const uint8_t *ref_ptr,
31 int ref_stride);
Peter de Rivaz7eee4872014-10-16 13:41:55 +010032typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
Johannd5d92892015-04-17 16:11:38 -040033
34typedef uint32_t (*SadMxNAvgFunc)(const uint8_t *src_ptr,
35 int src_stride,
36 const uint8_t *ref_ptr,
37 int ref_stride,
38 const uint8_t *second_pred);
39typedef std::tr1::tuple<int, int, SadMxNAvgFunc, int> SadMxNAvgParam;
Johannfbea8972012-06-28 11:43:58 -070040
James Zern18e733b2014-07-16 18:59:28 -070041typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
42 int src_stride,
Peter de Rivaz7eee4872014-10-16 13:41:55 +010043 const uint8_t *const ref_ptr[],
James Zern18e733b2014-07-16 18:59:28 -070044 int ref_stride,
Peter de Rivaz7eee4872014-10-16 13:41:55 +010045 uint32_t *sad_array);
46typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
John Koleszar1cfc86e2013-03-01 12:43:41 -080047
Johannfbea8972012-06-28 11:43:58 -070048using libvpx_test::ACMRandom;
49
50namespace {
John Koleszar1cfc86e2013-03-01 12:43:41 -080051class SADTestBase : public ::testing::Test {
James Zern10f8b362012-08-27 17:13:09 -070052 public:
Peter de Rivaz7eee4872014-10-16 13:41:55 +010053 SADTestBase(int width, int height, int bit_depth) :
54 width_(width), height_(height), bd_(bit_depth) {}
John Koleszar1cfc86e2013-03-01 12:43:41 -080055
James Zern10f8b362012-08-27 17:13:09 -070056 static void SetUpTestCase() {
Peter de Rivaz7eee4872014-10-16 13:41:55 +010057 source_data8_ = reinterpret_cast<uint8_t*>(
58 vpx_memalign(kDataAlignment, kDataBlockSize));
59 reference_data8_ = reinterpret_cast<uint8_t*>(
60 vpx_memalign(kDataAlignment, kDataBufferSize));
61 second_pred8_ = reinterpret_cast<uint8_t*>(
Geza Lore697bf5b2016-03-02 11:12:52 +000062 vpx_memalign(kDataAlignment, 128*128));
Peter de Rivaz7eee4872014-10-16 13:41:55 +010063 source_data16_ = reinterpret_cast<uint16_t*>(
64 vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));
65 reference_data16_ = reinterpret_cast<uint16_t*>(
66 vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));
67 second_pred16_ = reinterpret_cast<uint16_t*>(
Geza Lore697bf5b2016-03-02 11:12:52 +000068 vpx_memalign(kDataAlignment, 128*128*sizeof(uint16_t)));
James Zern10f8b362012-08-27 17:13:09 -070069 }
70
71 static void TearDownTestCase() {
Peter de Rivaz7eee4872014-10-16 13:41:55 +010072 vpx_free(source_data8_);
73 source_data8_ = NULL;
74 vpx_free(reference_data8_);
75 reference_data8_ = NULL;
76 vpx_free(second_pred8_);
77 second_pred8_ = NULL;
78 vpx_free(source_data16_);
79 source_data16_ = NULL;
80 vpx_free(reference_data16_);
81 reference_data16_ = NULL;
82 vpx_free(second_pred16_);
83 second_pred16_ = NULL;
James Zern10f8b362012-08-27 17:13:09 -070084 }
85
James Zern5b756742013-06-17 22:58:40 -070086 virtual void TearDown() {
87 libvpx_test::ClearSystemState();
88 }
89
James Zern10f8b362012-08-27 17:13:09 -070090 protected:
Geza Lore697bf5b2016-03-02 11:12:52 +000091 // Handle up to 4 128x128 blocks, with stride up to 256
James Zern10f8b362012-08-27 17:13:09 -070092 static const int kDataAlignment = 16;
Geza Lore697bf5b2016-03-02 11:12:52 +000093 static const int kDataBlockSize = 128 * 256;
John Koleszar1cfc86e2013-03-01 12:43:41 -080094 static const int kDataBufferSize = 4 * kDataBlockSize;
James Zern10f8b362012-08-27 17:13:09 -070095
Johannfbea8972012-06-28 11:43:58 -070096 virtual void SetUp() {
Peter de Rivaz7eee4872014-10-16 13:41:55 +010097 if (bd_ == -1) {
98 use_high_bit_depth_ = false;
99 bit_depth_ = VPX_BITS_8;
100 source_data_ = source_data8_;
101 reference_data_ = reference_data8_;
102 second_pred_ = second_pred8_;
Johannd5d92892015-04-17 16:11:38 -0400103#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100104 } else {
105 use_high_bit_depth_ = true;
106 bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
107 source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
108 reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
109 second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
Johannd5d92892015-04-17 16:11:38 -0400110#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100111 }
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100112 mask_ = (1 << bit_depth_) - 1;
John Koleszar6b653cb2013-02-28 17:03:02 -0800113 source_stride_ = (width_ + 31) & ~31;
Johannfbea8972012-06-28 11:43:58 -0700114 reference_stride_ = width_ * 2;
115 rnd_.Reset(ACMRandom::DeterministicSeed());
116 }
117
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100118 virtual uint8_t *GetReference(int block_idx) {
119#if CONFIG_VP9_HIGHBITDEPTH
Johannd5d92892015-04-17 16:11:38 -0400120 if (use_high_bit_depth_)
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100121 return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
122 block_idx * kDataBlockSize);
Johannd5d92892015-04-17 16:11:38 -0400123#endif // CONFIG_VP9_HIGHBITDEPTH
John Koleszar1cfc86e2013-03-01 12:43:41 -0800124 return reference_data_ + block_idx * kDataBlockSize;
Johannfbea8972012-06-28 11:43:58 -0700125 }
126
127 // Sum of Absolute Differences. Given two blocks, calculate the absolute
128 // difference between two pixels in the same relative location; accumulate.
Johannd5d92892015-04-17 16:11:38 -0400129 unsigned int ReferenceSAD(int block_idx) {
Johannfbea8972012-06-28 11:43:58 -0700130 unsigned int sad = 0;
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100131 const uint8_t *const reference8 = GetReference(block_idx);
132 const uint8_t *const source8 = source_data_;
Johannd5d92892015-04-17 16:11:38 -0400133#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100134 const uint16_t *const reference16 =
135 CONVERT_TO_SHORTPTR(GetReference(block_idx));
136 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
Johannd5d92892015-04-17 16:11:38 -0400137#endif // CONFIG_VP9_HIGHBITDEPTH
Johannfbea8972012-06-28 11:43:58 -0700138 for (int h = 0; h < height_; ++h) {
139 for (int w = 0; w < width_; ++w) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100140 if (!use_high_bit_depth_) {
Johannd5d92892015-04-17 16:11:38 -0400141 sad += abs(source8[h * source_stride_ + w] -
142 reference8[h * reference_stride_ + w]);
143#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100144 } else {
Johannd5d92892015-04-17 16:11:38 -0400145 sad += abs(source16[h * source_stride_ + w] -
146 reference16[h * reference_stride_ + w]);
147#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100148 }
Jim Bankoskia16794d2014-05-15 08:31:20 -0700149 }
Johannfbea8972012-06-28 11:43:58 -0700150 }
151 return sad;
152 }
153
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100154 // Sum of Absolute Differences Average. Given two blocks, and a prediction
155 // calculate the absolute difference between one pixel and average of the
156 // corresponding and predicted pixels; accumulate.
Johannd5d92892015-04-17 16:11:38 -0400157 unsigned int ReferenceSADavg(int block_idx) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100158 unsigned int sad = 0;
Johannd5d92892015-04-17 16:11:38 -0400159 const uint8_t *const reference8 = GetReference(block_idx);
160 const uint8_t *const source8 = source_data_;
161 const uint8_t *const second_pred8 = second_pred_;
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100162#if CONFIG_VP9_HIGHBITDEPTH
Johannd5d92892015-04-17 16:11:38 -0400163 const uint16_t *const reference16 =
164 CONVERT_TO_SHORTPTR(GetReference(block_idx));
165 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
166 const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
167#endif // CONFIG_VP9_HIGHBITDEPTH
Johannfbea8972012-06-28 11:43:58 -0700168 for (int h = 0; h < height_; ++h) {
169 for (int w = 0; w < width_; ++w) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100170 if (!use_high_bit_depth_) {
171 const int tmp = second_pred8[h * width_ + w] +
172 reference8[h * reference_stride_ + w];
173 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
174 sad += abs(source8[h * source_stride_ + w] - comp_pred);
Johannd5d92892015-04-17 16:11:38 -0400175#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100176 } else {
177 const int tmp = second_pred16[h * width_ + w] +
178 reference16[h * reference_stride_ + w];
179 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
180 sad += abs(source16[h * source_stride_ + w] - comp_pred);
Johannd5d92892015-04-17 16:11:38 -0400181#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100182 }
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100183 }
184 }
185 return sad;
186 }
187
188 void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100189 uint8_t *data8 = data;
Johannd5d92892015-04-17 16:11:38 -0400190#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100191 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
Johannd5d92892015-04-17 16:11:38 -0400192#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100193 for (int h = 0; h < height_; ++h) {
194 for (int w = 0; w < width_; ++w) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100195 if (!use_high_bit_depth_) {
Deb Mukherjee00c385f2014-11-14 15:12:01 -0800196 data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
Johannd5d92892015-04-17 16:11:38 -0400197#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100198 } else {
199 data16[h * stride + w] = fill_constant;
Johannd5d92892015-04-17 16:11:38 -0400200#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100201 }
Johannfbea8972012-06-28 11:43:58 -0700202 }
203 }
204 }
205
206 void FillRandom(uint8_t *data, int stride) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100207 uint8_t *data8 = data;
Johannd5d92892015-04-17 16:11:38 -0400208#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100209 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
Johannd5d92892015-04-17 16:11:38 -0400210#endif // CONFIG_VP9_HIGHBITDEPTH
Johannfbea8972012-06-28 11:43:58 -0700211 for (int h = 0; h < height_; ++h) {
212 for (int w = 0; w < width_; ++w) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100213 if (!use_high_bit_depth_) {
214 data8[h * stride + w] = rnd_.Rand8();
Johannd5d92892015-04-17 16:11:38 -0400215#if CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100216 } else {
217 data16[h * stride + w] = rnd_.Rand16() & mask_;
Johannd5d92892015-04-17 16:11:38 -0400218#endif // CONFIG_VP9_HIGHBITDEPTH
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100219 }
Johannfbea8972012-06-28 11:43:58 -0700220 }
221 }
222 }
223
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100224 int width_, height_, mask_, bd_;
225 vpx_bit_depth_t bit_depth_;
226 static uint8_t *source_data_;
227 static uint8_t *reference_data_;
228 static uint8_t *second_pred_;
John Koleszar1cfc86e2013-03-01 12:43:41 -0800229 int source_stride_;
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100230 bool use_high_bit_depth_;
231 static uint8_t *source_data8_;
232 static uint8_t *reference_data8_;
233 static uint8_t *second_pred8_;
234 static uint16_t *source_data16_;
235 static uint16_t *reference_data16_;
236 static uint16_t *second_pred16_;
John Koleszar1cfc86e2013-03-01 12:43:41 -0800237 int reference_stride_;
238
239 ACMRandom rnd_;
240};
241
Deb Mukherjeefc882922014-05-13 10:11:42 -0700242class SADx4Test
243 : public SADTestBase,
James Zern18e733b2014-07-16 18:59:28 -0700244 public ::testing::WithParamInterface<SadMxNx4Param> {
John Koleszar1cfc86e2013-03-01 12:43:41 -0800245 public:
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100246 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
John Koleszar1cfc86e2013-03-01 12:43:41 -0800247
248 protected:
249 void SADs(unsigned int *results) {
Johannd5d92892015-04-17 16:11:38 -0400250 const uint8_t *references[] = {GetReference(0), GetReference(1),
251 GetReference(2), GetReference(3)};
John Koleszar1cfc86e2013-03-01 12:43:41 -0800252
James Zern29e1b1a2014-07-09 21:02:02 -0700253 ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
Johannd5d92892015-04-17 16:11:38 -0400254 references, reference_stride_,
James Zern29e1b1a2014-07-09 21:02:02 -0700255 results));
John Koleszar1cfc86e2013-03-01 12:43:41 -0800256 }
257
258 void CheckSADs() {
259 unsigned int reference_sad, exp_sad[4];
260
261 SADs(exp_sad);
Deb Mukherjeefc882922014-05-13 10:11:42 -0700262 for (int block = 0; block < 4; ++block) {
Johannd5d92892015-04-17 16:11:38 -0400263 reference_sad = ReferenceSAD(block);
John Koleszar1cfc86e2013-03-01 12:43:41 -0800264
Deb Mukherjeefc882922014-05-13 10:11:42 -0700265 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
John Koleszar1cfc86e2013-03-01 12:43:41 -0800266 }
267 }
268};
269
Deb Mukherjeefc882922014-05-13 10:11:42 -0700270class SADTest
271 : public SADTestBase,
James Zern18e733b2014-07-16 18:59:28 -0700272 public ::testing::WithParamInterface<SadMxNParam> {
Deb Mukherjeefc882922014-05-13 10:11:42 -0700273 public:
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100274 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
Deb Mukherjeefc882922014-05-13 10:11:42 -0700275
276 protected:
Deb Mukherjeefc882922014-05-13 10:11:42 -0700277 unsigned int SAD(int block_idx) {
278 unsigned int ret;
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100279 const uint8_t *const reference = GetReference(block_idx);
Deb Mukherjeefc882922014-05-13 10:11:42 -0700280
James Zern29e1b1a2014-07-09 21:02:02 -0700281 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
282 reference, reference_stride_));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700283 return ret;
284 }
285
286 void CheckSAD() {
Johannd5d92892015-04-17 16:11:38 -0400287 const unsigned int reference_sad = ReferenceSAD(0);
Deb Mukherjeefc882922014-05-13 10:11:42 -0700288 const unsigned int exp_sad = SAD(0);
289
290 ASSERT_EQ(reference_sad, exp_sad);
291 }
292};
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100293
Johannd5d92892015-04-17 16:11:38 -0400294class SADavgTest
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100295 : public SADTestBase,
Johannd5d92892015-04-17 16:11:38 -0400296 public ::testing::WithParamInterface<SadMxNAvgParam> {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100297 public:
Johannd5d92892015-04-17 16:11:38 -0400298 SADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100299
300 protected:
301 unsigned int SAD_avg(int block_idx) {
302 unsigned int ret;
303 const uint8_t *const reference = GetReference(block_idx);
304
305 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
306 reference, reference_stride_,
307 second_pred_));
308 return ret;
309 }
310
311 void CheckSAD() {
Johannd5d92892015-04-17 16:11:38 -0400312 const unsigned int reference_sad = ReferenceSADavg(0);
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100313 const unsigned int exp_sad = SAD_avg(0);
314
315 ASSERT_EQ(reference_sad, exp_sad);
316 }
317};
Deb Mukherjeefc882922014-05-13 10:11:42 -0700318
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100319uint8_t *SADTestBase::source_data_ = NULL;
320uint8_t *SADTestBase::reference_data_ = NULL;
321uint8_t *SADTestBase::second_pred_ = NULL;
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100322uint8_t *SADTestBase::source_data8_ = NULL;
323uint8_t *SADTestBase::reference_data8_ = NULL;
324uint8_t *SADTestBase::second_pred8_ = NULL;
325uint16_t *SADTestBase::source_data16_ = NULL;
326uint16_t *SADTestBase::reference_data16_ = NULL;
327uint16_t *SADTestBase::second_pred16_ = NULL;
James Zern10f8b362012-08-27 17:13:09 -0700328
Johannfbea8972012-06-28 11:43:58 -0700329TEST_P(SADTest, MaxRef) {
330 FillConstant(source_data_, source_stride_, 0);
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100331 FillConstant(reference_data_, reference_stride_, mask_);
Johannd5d92892015-04-17 16:11:38 -0400332 CheckSAD();
Johannfbea8972012-06-28 11:43:58 -0700333}
334
Deb Mukherjeefc882922014-05-13 10:11:42 -0700335TEST_P(SADTest, MaxSrc) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100336 FillConstant(source_data_, source_stride_, mask_);
Deb Mukherjeefc882922014-05-13 10:11:42 -0700337 FillConstant(reference_data_, reference_stride_, 0);
Johannd5d92892015-04-17 16:11:38 -0400338 CheckSAD();
Deb Mukherjeefc882922014-05-13 10:11:42 -0700339}
340
341TEST_P(SADTest, ShortRef) {
Johannd5d92892015-04-17 16:11:38 -0400342 const int tmp_stride = reference_stride_;
Deb Mukherjeefc882922014-05-13 10:11:42 -0700343 reference_stride_ >>= 1;
344 FillRandom(source_data_, source_stride_);
345 FillRandom(reference_data_, reference_stride_);
Johannd5d92892015-04-17 16:11:38 -0400346 CheckSAD();
Deb Mukherjeefc882922014-05-13 10:11:42 -0700347 reference_stride_ = tmp_stride;
348}
349
350TEST_P(SADTest, UnalignedRef) {
351 // The reference frame, but not the source frame, may be unaligned for
352 // certain types of searches.
353 const int tmp_stride = reference_stride_;
354 reference_stride_ -= 1;
355 FillRandom(source_data_, source_stride_);
356 FillRandom(reference_data_, reference_stride_);
Johannd5d92892015-04-17 16:11:38 -0400357 CheckSAD();
Deb Mukherjeefc882922014-05-13 10:11:42 -0700358 reference_stride_ = tmp_stride;
359}
360
361TEST_P(SADTest, ShortSrc) {
362 const int tmp_stride = source_stride_;
363 source_stride_ >>= 1;
364 FillRandom(source_data_, source_stride_);
365 FillRandom(reference_data_, reference_stride_);
Deb Mukherjeefc882922014-05-13 10:11:42 -0700366 CheckSAD();
367 source_stride_ = tmp_stride;
368}
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100369
Johannd5d92892015-04-17 16:11:38 -0400370TEST_P(SADavgTest, MaxRef) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100371 FillConstant(source_data_, source_stride_, 0);
372 FillConstant(reference_data_, reference_stride_, mask_);
373 FillConstant(second_pred_, width_, 0);
374 CheckSAD();
375}
Johannd5d92892015-04-17 16:11:38 -0400376TEST_P(SADavgTest, MaxSrc) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100377 FillConstant(source_data_, source_stride_, mask_);
378 FillConstant(reference_data_, reference_stride_, 0);
379 FillConstant(second_pred_, width_, 0);
380 CheckSAD();
381}
382
Johannd5d92892015-04-17 16:11:38 -0400383TEST_P(SADavgTest, ShortRef) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100384 const int tmp_stride = reference_stride_;
385 reference_stride_ >>= 1;
386 FillRandom(source_data_, source_stride_);
387 FillRandom(reference_data_, reference_stride_);
388 FillRandom(second_pred_, width_);
389 CheckSAD();
390 reference_stride_ = tmp_stride;
391}
392
Johannd5d92892015-04-17 16:11:38 -0400393TEST_P(SADavgTest, UnalignedRef) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100394 // The reference frame, but not the source frame, may be unaligned for
395 // certain types of searches.
396 const int tmp_stride = reference_stride_;
397 reference_stride_ -= 1;
398 FillRandom(source_data_, source_stride_);
399 FillRandom(reference_data_, reference_stride_);
400 FillRandom(second_pred_, width_);
401 CheckSAD();
402 reference_stride_ = tmp_stride;
403}
404
Johannd5d92892015-04-17 16:11:38 -0400405TEST_P(SADavgTest, ShortSrc) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100406 const int tmp_stride = source_stride_;
407 source_stride_ >>= 1;
408 FillRandom(source_data_, source_stride_);
409 FillRandom(reference_data_, reference_stride_);
410 FillRandom(second_pred_, width_);
411 CheckSAD();
412 source_stride_ = tmp_stride;
413}
Deb Mukherjeefc882922014-05-13 10:11:42 -0700414
John Koleszar1cfc86e2013-03-01 12:43:41 -0800415TEST_P(SADx4Test, MaxRef) {
416 FillConstant(source_data_, source_stride_, 0);
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100417 FillConstant(GetReference(0), reference_stride_, mask_);
418 FillConstant(GetReference(1), reference_stride_, mask_);
419 FillConstant(GetReference(2), reference_stride_, mask_);
420 FillConstant(GetReference(3), reference_stride_, mask_);
John Koleszar1cfc86e2013-03-01 12:43:41 -0800421 CheckSADs();
422}
423
John Koleszar1cfc86e2013-03-01 12:43:41 -0800424TEST_P(SADx4Test, MaxSrc) {
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100425 FillConstant(source_data_, source_stride_, mask_);
John Koleszar1cfc86e2013-03-01 12:43:41 -0800426 FillConstant(GetReference(0), reference_stride_, 0);
427 FillConstant(GetReference(1), reference_stride_, 0);
428 FillConstant(GetReference(2), reference_stride_, 0);
429 FillConstant(GetReference(3), reference_stride_, 0);
430 CheckSADs();
431}
432
John Koleszar1cfc86e2013-03-01 12:43:41 -0800433TEST_P(SADx4Test, ShortRef) {
434 int tmp_stride = reference_stride_;
435 reference_stride_ >>= 1;
436 FillRandom(source_data_, source_stride_);
437 FillRandom(GetReference(0), reference_stride_);
438 FillRandom(GetReference(1), reference_stride_);
439 FillRandom(GetReference(2), reference_stride_);
440 FillRandom(GetReference(3), reference_stride_);
441 CheckSADs();
442 reference_stride_ = tmp_stride;
443}
444
John Koleszar1cfc86e2013-03-01 12:43:41 -0800445TEST_P(SADx4Test, UnalignedRef) {
446 // The reference frame, but not the source frame, may be unaligned for
447 // certain types of searches.
448 int tmp_stride = reference_stride_;
449 reference_stride_ -= 1;
450 FillRandom(source_data_, source_stride_);
451 FillRandom(GetReference(0), reference_stride_);
452 FillRandom(GetReference(1), reference_stride_);
453 FillRandom(GetReference(2), reference_stride_);
454 FillRandom(GetReference(3), reference_stride_);
455 CheckSADs();
456 reference_stride_ = tmp_stride;
457}
458
John Koleszar1cfc86e2013-03-01 12:43:41 -0800459TEST_P(SADx4Test, ShortSrc) {
460 int tmp_stride = source_stride_;
461 source_stride_ >>= 1;
462 FillRandom(source_data_, source_stride_);
463 FillRandom(GetReference(0), reference_stride_);
464 FillRandom(GetReference(1), reference_stride_);
465 FillRandom(GetReference(2), reference_stride_);
466 FillRandom(GetReference(3), reference_stride_);
467 CheckSADs();
468 source_stride_ = tmp_stride;
469}
470
Peter de Rivaz7eee4872014-10-16 13:41:55 +0100471TEST_P(SADx4Test, SrcAlignedByWidth) {
472 uint8_t * tmp_source_data = source_data_;
473 source_data_ += width_;
474 FillRandom(source_data_, source_stride_);
475 FillRandom(GetReference(0), reference_stride_);
476 FillRandom(GetReference(1), reference_stride_);
477 FillRandom(GetReference(2), reference_stride_);
478 FillRandom(GetReference(3), reference_stride_);
479 CheckSADs();
480 source_data_ = tmp_source_data;
481}
482
James Zern12ddb752012-08-15 11:54:41 -0700483using std::tr1::make_tuple;
484
James Zernd7cff282014-02-27 12:49:02 -0800485//------------------------------------------------------------------------------
486// C functions
James Zern18e733b2014-07-16 18:59:28 -0700487const SadMxNParam c_tests[] = {
Geza Lore697bf5b2016-03-02 11:12:52 +0000488#if CONFIG_VP10 && CONFIG_EXT_PARTITION
489 make_tuple(128, 128, &vpx_sad128x128_c, -1),
490 make_tuple(128, 64, &vpx_sad128x64_c, -1),
491 make_tuple(64, 128, &vpx_sad64x128_c, -1),
492#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800493 make_tuple(64, 64, &vpx_sad64x64_c, -1),
494 make_tuple(64, 32, &vpx_sad64x32_c, -1),
495 make_tuple(32, 64, &vpx_sad32x64_c, -1),
496 make_tuple(32, 32, &vpx_sad32x32_c, -1),
497 make_tuple(32, 16, &vpx_sad32x16_c, -1),
498 make_tuple(16, 32, &vpx_sad16x32_c, -1),
499 make_tuple(16, 16, &vpx_sad16x16_c, -1),
500 make_tuple(16, 8, &vpx_sad16x8_c, -1),
501 make_tuple(8, 16, &vpx_sad8x16_c, -1),
502 make_tuple(8, 8, &vpx_sad8x8_c, -1),
503 make_tuple(8, 4, &vpx_sad8x4_c, -1),
504 make_tuple(4, 8, &vpx_sad4x8_c, -1),
505 make_tuple(4, 4, &vpx_sad4x4_c, -1),
Johannd5d92892015-04-17 16:11:38 -0400506#if CONFIG_VP9_HIGHBITDEPTH
Geza Lore697bf5b2016-03-02 11:12:52 +0000507#if CONFIG_VP10 && CONFIG_EXT_PARTITION
508 make_tuple(128, 128, &vpx_highbd_sad128x128_c, 8),
509 make_tuple(128, 64, &vpx_highbd_sad128x64_c, 8),
510 make_tuple(64, 128, &vpx_highbd_sad64x128_c, 8),
511#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800512 make_tuple(64, 64, &vpx_highbd_sad64x64_c, 8),
513 make_tuple(64, 32, &vpx_highbd_sad64x32_c, 8),
514 make_tuple(32, 64, &vpx_highbd_sad32x64_c, 8),
515 make_tuple(32, 32, &vpx_highbd_sad32x32_c, 8),
516 make_tuple(32, 16, &vpx_highbd_sad32x16_c, 8),
517 make_tuple(16, 32, &vpx_highbd_sad16x32_c, 8),
518 make_tuple(16, 16, &vpx_highbd_sad16x16_c, 8),
519 make_tuple(16, 8, &vpx_highbd_sad16x8_c, 8),
520 make_tuple(8, 16, &vpx_highbd_sad8x16_c, 8),
521 make_tuple(8, 8, &vpx_highbd_sad8x8_c, 8),
522 make_tuple(8, 4, &vpx_highbd_sad8x4_c, 8),
523 make_tuple(4, 8, &vpx_highbd_sad4x8_c, 8),
524 make_tuple(4, 4, &vpx_highbd_sad4x4_c, 8),
Geza Lore697bf5b2016-03-02 11:12:52 +0000525#if CONFIG_VP10 && CONFIG_EXT_PARTITION
526 make_tuple(128, 128, &vpx_highbd_sad128x128_c, 10),
527 make_tuple(128, 64, &vpx_highbd_sad128x64_c, 10),
528 make_tuple(64, 128, &vpx_highbd_sad64x128_c, 10),
529#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800530 make_tuple(64, 64, &vpx_highbd_sad64x64_c, 10),
531 make_tuple(64, 32, &vpx_highbd_sad64x32_c, 10),
532 make_tuple(32, 64, &vpx_highbd_sad32x64_c, 10),
533 make_tuple(32, 32, &vpx_highbd_sad32x32_c, 10),
534 make_tuple(32, 16, &vpx_highbd_sad32x16_c, 10),
535 make_tuple(16, 32, &vpx_highbd_sad16x32_c, 10),
536 make_tuple(16, 16, &vpx_highbd_sad16x16_c, 10),
537 make_tuple(16, 8, &vpx_highbd_sad16x8_c, 10),
538 make_tuple(8, 16, &vpx_highbd_sad8x16_c, 10),
539 make_tuple(8, 8, &vpx_highbd_sad8x8_c, 10),
540 make_tuple(8, 4, &vpx_highbd_sad8x4_c, 10),
541 make_tuple(4, 8, &vpx_highbd_sad4x8_c, 10),
542 make_tuple(4, 4, &vpx_highbd_sad4x4_c, 10),
Geza Lore697bf5b2016-03-02 11:12:52 +0000543#if CONFIG_VP10 && CONFIG_EXT_PARTITION
544 make_tuple(128, 128, &vpx_highbd_sad128x128_c, 12),
545 make_tuple(128, 64, &vpx_highbd_sad128x64_c, 12),
546 make_tuple(64, 128, &vpx_highbd_sad64x128_c, 12),
547#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800548 make_tuple(64, 64, &vpx_highbd_sad64x64_c, 12),
549 make_tuple(64, 32, &vpx_highbd_sad64x32_c, 12),
550 make_tuple(32, 64, &vpx_highbd_sad32x64_c, 12),
551 make_tuple(32, 32, &vpx_highbd_sad32x32_c, 12),
552 make_tuple(32, 16, &vpx_highbd_sad32x16_c, 12),
553 make_tuple(16, 32, &vpx_highbd_sad16x32_c, 12),
554 make_tuple(16, 16, &vpx_highbd_sad16x16_c, 12),
555 make_tuple(16, 8, &vpx_highbd_sad16x8_c, 12),
556 make_tuple(8, 16, &vpx_highbd_sad8x16_c, 12),
557 make_tuple(8, 8, &vpx_highbd_sad8x8_c, 12),
558 make_tuple(8, 4, &vpx_highbd_sad8x4_c, 12),
559 make_tuple(4, 8, &vpx_highbd_sad4x8_c, 12),
560 make_tuple(4, 4, &vpx_highbd_sad4x4_c, 12),
Johannd5d92892015-04-17 16:11:38 -0400561#endif // CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjeefc882922014-05-13 10:11:42 -0700562};
563INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700564
Johannd5d92892015-04-17 16:11:38 -0400565const SadMxNAvgParam avg_c_tests[] = {
Geza Lore697bf5b2016-03-02 11:12:52 +0000566#if CONFIG_VP10 && CONFIG_EXT_PARTITION
567 make_tuple(128, 128, &vpx_sad128x128_avg_c, -1),
568 make_tuple(128, 64, &vpx_sad128x64_avg_c, -1),
569 make_tuple(64, 128, &vpx_sad64x128_avg_c, -1),
570#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800571 make_tuple(64, 64, &vpx_sad64x64_avg_c, -1),
572 make_tuple(64, 32, &vpx_sad64x32_avg_c, -1),
573 make_tuple(32, 64, &vpx_sad32x64_avg_c, -1),
574 make_tuple(32, 32, &vpx_sad32x32_avg_c, -1),
575 make_tuple(32, 16, &vpx_sad32x16_avg_c, -1),
576 make_tuple(16, 32, &vpx_sad16x32_avg_c, -1),
577 make_tuple(16, 16, &vpx_sad16x16_avg_c, -1),
578 make_tuple(16, 8, &vpx_sad16x8_avg_c, -1),
579 make_tuple(8, 16, &vpx_sad8x16_avg_c, -1),
580 make_tuple(8, 8, &vpx_sad8x8_avg_c, -1),
581 make_tuple(8, 4, &vpx_sad8x4_avg_c, -1),
582 make_tuple(4, 8, &vpx_sad4x8_avg_c, -1),
583 make_tuple(4, 4, &vpx_sad4x4_avg_c, -1),
Johannd5d92892015-04-17 16:11:38 -0400584#if CONFIG_VP9_HIGHBITDEPTH
Geza Lore697bf5b2016-03-02 11:12:52 +0000585#if CONFIG_VP10 && CONFIG_EXT_PARTITION
586 make_tuple(128, 128, &vpx_highbd_sad128x128_avg_c, 8),
587 make_tuple(128, 64, &vpx_highbd_sad128x64_avg_c, 8),
588 make_tuple(64, 128, &vpx_highbd_sad64x128_avg_c, 8),
589#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800590 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_c, 8),
591 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_c, 8),
592 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_c, 8),
593 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_c, 8),
594 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_c, 8),
595 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_c, 8),
596 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_c, 8),
597 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_c, 8),
598 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_c, 8),
599 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_c, 8),
600 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_c, 8),
601 make_tuple(4, 8, &vpx_highbd_sad4x8_avg_c, 8),
602 make_tuple(4, 4, &vpx_highbd_sad4x4_avg_c, 8),
Geza Lore697bf5b2016-03-02 11:12:52 +0000603#if CONFIG_VP10 && CONFIG_EXT_PARTITION
604 make_tuple(128, 128, &vpx_highbd_sad128x128_avg_c, 10),
605 make_tuple(128, 64, &vpx_highbd_sad128x64_avg_c, 10),
606 make_tuple(64, 128, &vpx_highbd_sad64x128_avg_c, 10),
607#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800608 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_c, 10),
609 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_c, 10),
610 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_c, 10),
611 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_c, 10),
612 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_c, 10),
613 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_c, 10),
614 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_c, 10),
615 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_c, 10),
616 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_c, 10),
617 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_c, 10),
618 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_c, 10),
619 make_tuple(4, 8, &vpx_highbd_sad4x8_avg_c, 10),
620 make_tuple(4, 4, &vpx_highbd_sad4x4_avg_c, 10),
Geza Lore697bf5b2016-03-02 11:12:52 +0000621#if CONFIG_VP10 && CONFIG_EXT_PARTITION
622 make_tuple(128, 128, &vpx_highbd_sad128x128_avg_c, 12),
623 make_tuple(128, 64, &vpx_highbd_sad128x64_avg_c, 12),
624 make_tuple(64, 128, &vpx_highbd_sad64x128_avg_c, 12),
625#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800626 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_c, 12),
627 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_c, 12),
628 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_c, 12),
629 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_c, 12),
630 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_c, 12),
631 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_c, 12),
632 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_c, 12),
633 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_c, 12),
634 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_c, 12),
635 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_c, 12),
636 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_c, 12),
637 make_tuple(4, 8, &vpx_highbd_sad4x8_avg_c, 12),
638 make_tuple(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
Johannd5d92892015-04-17 16:11:38 -0400639#endif // CONFIG_VP9_HIGHBITDEPTH
640};
641INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
642
Johannd5d92892015-04-17 16:11:38 -0400643const SadMxNx4Param x4d_c_tests[] = {
Geza Lore697bf5b2016-03-02 11:12:52 +0000644#if CONFIG_VP10 && CONFIG_EXT_PARTITION
645 make_tuple(128, 128, &vpx_sad128x128x4d_c, -1),
646 make_tuple(128, 64, &vpx_sad128x64x4d_c, -1),
647 make_tuple(64, 128, &vpx_sad64x128x4d_c, -1),
648#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800649 make_tuple(64, 64, &vpx_sad64x64x4d_c, -1),
650 make_tuple(64, 32, &vpx_sad64x32x4d_c, -1),
651 make_tuple(32, 64, &vpx_sad32x64x4d_c, -1),
652 make_tuple(32, 32, &vpx_sad32x32x4d_c, -1),
653 make_tuple(32, 16, &vpx_sad32x16x4d_c, -1),
654 make_tuple(16, 32, &vpx_sad16x32x4d_c, -1),
655 make_tuple(16, 16, &vpx_sad16x16x4d_c, -1),
656 make_tuple(16, 8, &vpx_sad16x8x4d_c, -1),
657 make_tuple(8, 16, &vpx_sad8x16x4d_c, -1),
658 make_tuple(8, 8, &vpx_sad8x8x4d_c, -1),
659 make_tuple(8, 4, &vpx_sad8x4x4d_c, -1),
660 make_tuple(4, 8, &vpx_sad4x8x4d_c, -1),
661 make_tuple(4, 4, &vpx_sad4x4x4d_c, -1),
Johannd5d92892015-04-17 16:11:38 -0400662#if CONFIG_VP9_HIGHBITDEPTH
Geza Lore697bf5b2016-03-02 11:12:52 +0000663#if CONFIG_VP10 && CONFIG_EXT_PARTITION
664 make_tuple(128, 128, &vpx_highbd_sad128x128x4d_c, 8),
665 make_tuple(128, 64, &vpx_highbd_sad128x64x4d_c, 8),
666 make_tuple(64, 128, &vpx_highbd_sad64x128x4d_c, 8),
667#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800668 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_c, 8),
669 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_c, 8),
670 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_c, 8),
671 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_c, 8),
672 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_c, 8),
673 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_c, 8),
674 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_c, 8),
675 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_c, 8),
676 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_c, 8),
677 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_c, 8),
678 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_c, 8),
679 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_c, 8),
680 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_c, 8),
Geza Lore697bf5b2016-03-02 11:12:52 +0000681#if CONFIG_VP10 && CONFIG_EXT_PARTITION
682 make_tuple(128, 128, &vpx_highbd_sad128x128x4d_c, 10),
683 make_tuple(128, 64, &vpx_highbd_sad128x64x4d_c, 10),
684 make_tuple(64, 128, &vpx_highbd_sad64x128x4d_c, 10),
685#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800686 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_c, 10),
687 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_c, 10),
688 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_c, 10),
689 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_c, 10),
690 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_c, 10),
691 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_c, 10),
692 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_c, 10),
693 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_c, 10),
694 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_c, 10),
695 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_c, 10),
696 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_c, 10),
697 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_c, 10),
698 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_c, 10),
Geza Lore697bf5b2016-03-02 11:12:52 +0000699#if CONFIG_VP10 && CONFIG_EXT_PARTITION
700 make_tuple(128, 128, &vpx_highbd_sad128x128x4d_c, 12),
701 make_tuple(128, 64, &vpx_highbd_sad128x64x4d_c, 12),
702 make_tuple(64, 128, &vpx_highbd_sad64x128x4d_c, 12),
703#endif // CONFIG_VP10 && CONFIG_EXT_PARTITION
James Zern91606bb2015-11-05 19:00:45 -0800704 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_c, 12),
705 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_c, 12),
706 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_c, 12),
707 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_c, 12),
708 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_c, 12),
709 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_c, 12),
710 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_c, 12),
711 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_c, 12),
712 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_c, 12),
713 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_c, 12),
714 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_c, 12),
715 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_c, 12),
716 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
Johannd5d92892015-04-17 16:11:38 -0400717#endif // CONFIG_VP9_HIGHBITDEPTH
718};
719INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
John Koleszar1cfc86e2013-03-01 12:43:41 -0800720
James Zernd7cff282014-02-27 12:49:02 -0800721//------------------------------------------------------------------------------
722// ARM functions
Johannfbea8972012-06-28 11:43:58 -0700723#if HAVE_MEDIA
Johannd5d92892015-04-17 16:11:38 -0400724const SadMxNParam media_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800725 make_tuple(16, 16, &vpx_sad16x16_media, -1),
Johannd5d92892015-04-17 16:11:38 -0400726};
727INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::ValuesIn(media_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700728#endif // HAVE_MEDIA
James Zern5f1486f2014-02-27 14:03:21 -0800729
Johannfbea8972012-06-28 11:43:58 -0700730#if HAVE_NEON
Johannd5d92892015-04-17 16:11:38 -0400731const SadMxNParam neon_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800732 make_tuple(64, 64, &vpx_sad64x64_neon, -1),
733 make_tuple(32, 32, &vpx_sad32x32_neon, -1),
734 make_tuple(16, 16, &vpx_sad16x16_neon, -1),
735 make_tuple(16, 8, &vpx_sad16x8_neon, -1),
736 make_tuple(8, 16, &vpx_sad8x16_neon, -1),
737 make_tuple(8, 8, &vpx_sad8x8_neon, -1),
738 make_tuple(4, 4, &vpx_sad4x4_neon, -1),
Scott LaVarnway696fa522014-07-16 12:54:46 -0700739};
Johannd5d92892015-04-17 16:11:38 -0400740INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
741
Johannd5d92892015-04-17 16:11:38 -0400742const SadMxNx4Param x4d_neon_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800743 make_tuple(64, 64, &vpx_sad64x64x4d_neon, -1),
744 make_tuple(32, 32, &vpx_sad32x32x4d_neon, -1),
745 make_tuple(16, 16, &vpx_sad16x16x4d_neon, -1),
Johannd5d92892015-04-17 16:11:38 -0400746};
747INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700748#endif // HAVE_NEON
Johannfbea8972012-06-28 11:43:58 -0700749
James Zernd7cff282014-02-27 12:49:02 -0800750//------------------------------------------------------------------------------
751// x86 functions
Johannfbea8972012-06-28 11:43:58 -0700752#if HAVE_MMX
James Zern18e733b2014-07-16 18:59:28 -0700753const SadMxNParam mmx_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800754 make_tuple(16, 16, &vpx_sad16x16_mmx, -1),
755 make_tuple(16, 8, &vpx_sad16x8_mmx, -1),
756 make_tuple(8, 16, &vpx_sad8x16_mmx, -1),
757 make_tuple(8, 8, &vpx_sad8x8_mmx, -1),
758 make_tuple(4, 4, &vpx_sad4x4_mmx, -1),
Deb Mukherjeefc882922014-05-13 10:11:42 -0700759};
760INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700761#endif // HAVE_MMX
John Koleszar6b653cb2013-02-28 17:03:02 -0800762
Johannfbea8972012-06-28 11:43:58 -0700763#if HAVE_SSE2
Johannd5d92892015-04-17 16:11:38 -0400764#if CONFIG_USE_X86INC
James Zern18e733b2014-07-16 18:59:28 -0700765const SadMxNParam sse2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800766 make_tuple(64, 64, &vpx_sad64x64_sse2, -1),
767 make_tuple(64, 32, &vpx_sad64x32_sse2, -1),
768 make_tuple(32, 64, &vpx_sad32x64_sse2, -1),
769 make_tuple(32, 32, &vpx_sad32x32_sse2, -1),
770 make_tuple(32, 16, &vpx_sad32x16_sse2, -1),
771 make_tuple(16, 32, &vpx_sad16x32_sse2, -1),
772 make_tuple(16, 16, &vpx_sad16x16_sse2, -1),
773 make_tuple(16, 8, &vpx_sad16x8_sse2, -1),
774 make_tuple(8, 16, &vpx_sad8x16_sse2, -1),
775 make_tuple(8, 8, &vpx_sad8x8_sse2, -1),
776 make_tuple(8, 4, &vpx_sad8x4_sse2, -1),
Jian Zhoub158d9a2015-12-16 15:52:02 -0800777 make_tuple(4, 8, &vpx_sad4x8_sse2, -1),
778 make_tuple(4, 4, &vpx_sad4x4_sse2, -1),
Johannd5d92892015-04-17 16:11:38 -0400779#if CONFIG_VP9_HIGHBITDEPTH
James Zern91606bb2015-11-05 19:00:45 -0800780 make_tuple(64, 64, &vpx_highbd_sad64x64_sse2, 8),
781 make_tuple(64, 32, &vpx_highbd_sad64x32_sse2, 8),
782 make_tuple(32, 64, &vpx_highbd_sad32x64_sse2, 8),
783 make_tuple(32, 32, &vpx_highbd_sad32x32_sse2, 8),
784 make_tuple(32, 16, &vpx_highbd_sad32x16_sse2, 8),
785 make_tuple(16, 32, &vpx_highbd_sad16x32_sse2, 8),
786 make_tuple(16, 16, &vpx_highbd_sad16x16_sse2, 8),
787 make_tuple(16, 8, &vpx_highbd_sad16x8_sse2, 8),
788 make_tuple(8, 16, &vpx_highbd_sad8x16_sse2, 8),
789 make_tuple(8, 8, &vpx_highbd_sad8x8_sse2, 8),
790 make_tuple(8, 4, &vpx_highbd_sad8x4_sse2, 8),
791 make_tuple(64, 64, &vpx_highbd_sad64x64_sse2, 10),
792 make_tuple(64, 32, &vpx_highbd_sad64x32_sse2, 10),
793 make_tuple(32, 64, &vpx_highbd_sad32x64_sse2, 10),
794 make_tuple(32, 32, &vpx_highbd_sad32x32_sse2, 10),
795 make_tuple(32, 16, &vpx_highbd_sad32x16_sse2, 10),
796 make_tuple(16, 32, &vpx_highbd_sad16x32_sse2, 10),
797 make_tuple(16, 16, &vpx_highbd_sad16x16_sse2, 10),
798 make_tuple(16, 8, &vpx_highbd_sad16x8_sse2, 10),
799 make_tuple(8, 16, &vpx_highbd_sad8x16_sse2, 10),
800 make_tuple(8, 8, &vpx_highbd_sad8x8_sse2, 10),
801 make_tuple(8, 4, &vpx_highbd_sad8x4_sse2, 10),
802 make_tuple(64, 64, &vpx_highbd_sad64x64_sse2, 12),
803 make_tuple(64, 32, &vpx_highbd_sad64x32_sse2, 12),
804 make_tuple(32, 64, &vpx_highbd_sad32x64_sse2, 12),
805 make_tuple(32, 32, &vpx_highbd_sad32x32_sse2, 12),
806 make_tuple(32, 16, &vpx_highbd_sad32x16_sse2, 12),
807 make_tuple(16, 32, &vpx_highbd_sad16x32_sse2, 12),
808 make_tuple(16, 16, &vpx_highbd_sad16x16_sse2, 12),
809 make_tuple(16, 8, &vpx_highbd_sad16x8_sse2, 12),
810 make_tuple(8, 16, &vpx_highbd_sad8x16_sse2, 12),
811 make_tuple(8, 8, &vpx_highbd_sad8x8_sse2, 12),
812 make_tuple(8, 4, &vpx_highbd_sad8x4_sse2, 12),
Johannd5d92892015-04-17 16:11:38 -0400813#endif // CONFIG_VP9_HIGHBITDEPTH
Deb Mukherjeefc882922014-05-13 10:11:42 -0700814};
815INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700816
Johannd5d92892015-04-17 16:11:38 -0400817const SadMxNAvgParam avg_sse2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800818 make_tuple(64, 64, &vpx_sad64x64_avg_sse2, -1),
819 make_tuple(64, 32, &vpx_sad64x32_avg_sse2, -1),
820 make_tuple(32, 64, &vpx_sad32x64_avg_sse2, -1),
821 make_tuple(32, 32, &vpx_sad32x32_avg_sse2, -1),
822 make_tuple(32, 16, &vpx_sad32x16_avg_sse2, -1),
823 make_tuple(16, 32, &vpx_sad16x32_avg_sse2, -1),
824 make_tuple(16, 16, &vpx_sad16x16_avg_sse2, -1),
825 make_tuple(16, 8, &vpx_sad16x8_avg_sse2, -1),
826 make_tuple(8, 16, &vpx_sad8x16_avg_sse2, -1),
827 make_tuple(8, 8, &vpx_sad8x8_avg_sse2, -1),
828 make_tuple(8, 4, &vpx_sad8x4_avg_sse2, -1),
Jian Zhoub158d9a2015-12-16 15:52:02 -0800829 make_tuple(4, 8, &vpx_sad4x8_avg_sse2, -1),
830 make_tuple(4, 4, &vpx_sad4x4_avg_sse2, -1),
Johannd5d92892015-04-17 16:11:38 -0400831#if CONFIG_VP9_HIGHBITDEPTH
James Zern91606bb2015-11-05 19:00:45 -0800832 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_sse2, 8),
833 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_sse2, 8),
834 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_sse2, 8),
835 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_sse2, 8),
836 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_sse2, 8),
837 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_sse2, 8),
838 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_sse2, 8),
839 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_sse2, 8),
840 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_sse2, 8),
841 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_sse2, 8),
842 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_sse2, 8),
843 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_sse2, 10),
844 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_sse2, 10),
845 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_sse2, 10),
846 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_sse2, 10),
847 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_sse2, 10),
848 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_sse2, 10),
849 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_sse2, 10),
850 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_sse2, 10),
851 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_sse2, 10),
852 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_sse2, 10),
853 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_sse2, 10),
854 make_tuple(64, 64, &vpx_highbd_sad64x64_avg_sse2, 12),
855 make_tuple(64, 32, &vpx_highbd_sad64x32_avg_sse2, 12),
856 make_tuple(32, 64, &vpx_highbd_sad32x64_avg_sse2, 12),
857 make_tuple(32, 32, &vpx_highbd_sad32x32_avg_sse2, 12),
858 make_tuple(32, 16, &vpx_highbd_sad32x16_avg_sse2, 12),
859 make_tuple(16, 32, &vpx_highbd_sad16x32_avg_sse2, 12),
860 make_tuple(16, 16, &vpx_highbd_sad16x16_avg_sse2, 12),
861 make_tuple(16, 8, &vpx_highbd_sad16x8_avg_sse2, 12),
862 make_tuple(8, 16, &vpx_highbd_sad8x16_avg_sse2, 12),
863 make_tuple(8, 8, &vpx_highbd_sad8x8_avg_sse2, 12),
864 make_tuple(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
Johannd5d92892015-04-17 16:11:38 -0400865#endif // CONFIG_VP9_HIGHBITDEPTH
866};
867INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
868
Johannd5d92892015-04-17 16:11:38 -0400869const SadMxNx4Param x4d_sse2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800870 make_tuple(64, 64, &vpx_sad64x64x4d_sse2, -1),
871 make_tuple(64, 32, &vpx_sad64x32x4d_sse2, -1),
872 make_tuple(32, 64, &vpx_sad32x64x4d_sse2, -1),
873 make_tuple(32, 32, &vpx_sad32x32x4d_sse2, -1),
874 make_tuple(32, 16, &vpx_sad32x16x4d_sse2, -1),
875 make_tuple(16, 32, &vpx_sad16x32x4d_sse2, -1),
876 make_tuple(16, 16, &vpx_sad16x16x4d_sse2, -1),
877 make_tuple(16, 8, &vpx_sad16x8x4d_sse2, -1),
878 make_tuple(8, 16, &vpx_sad8x16x4d_sse2, -1),
879 make_tuple(8, 8, &vpx_sad8x8x4d_sse2, -1),
880 make_tuple(8, 4, &vpx_sad8x4x4d_sse2, -1),
Jian Zhou789dbb32015-12-17 11:08:17 -0800881 make_tuple(4, 8, &vpx_sad4x8x4d_sse2, -1),
882 make_tuple(4, 4, &vpx_sad4x4x4d_sse2, -1),
Johannd5d92892015-04-17 16:11:38 -0400883#if CONFIG_VP9_HIGHBITDEPTH
James Zern91606bb2015-11-05 19:00:45 -0800884 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_sse2, 8),
885 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_sse2, 8),
886 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_sse2, 8),
887 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_sse2, 8),
888 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_sse2, 8),
889 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_sse2, 8),
890 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_sse2, 8),
891 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_sse2, 8),
892 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_sse2, 8),
893 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_sse2, 8),
894 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_sse2, 8),
895 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_sse2, 8),
896 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_sse2, 8),
897 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_sse2, 10),
898 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_sse2, 10),
899 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_sse2, 10),
900 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_sse2, 10),
901 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_sse2, 10),
902 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_sse2, 10),
903 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_sse2, 10),
904 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_sse2, 10),
905 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_sse2, 10),
906 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_sse2, 10),
907 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_sse2, 10),
908 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_sse2, 10),
909 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_sse2, 10),
910 make_tuple(64, 64, &vpx_highbd_sad64x64x4d_sse2, 12),
911 make_tuple(64, 32, &vpx_highbd_sad64x32x4d_sse2, 12),
912 make_tuple(32, 64, &vpx_highbd_sad32x64x4d_sse2, 12),
913 make_tuple(32, 32, &vpx_highbd_sad32x32x4d_sse2, 12),
914 make_tuple(32, 16, &vpx_highbd_sad32x16x4d_sse2, 12),
915 make_tuple(16, 32, &vpx_highbd_sad16x32x4d_sse2, 12),
916 make_tuple(16, 16, &vpx_highbd_sad16x16x4d_sse2, 12),
917 make_tuple(16, 8, &vpx_highbd_sad16x8x4d_sse2, 12),
918 make_tuple(8, 16, &vpx_highbd_sad8x16x4d_sse2, 12),
919 make_tuple(8, 8, &vpx_highbd_sad8x8x4d_sse2, 12),
920 make_tuple(8, 4, &vpx_highbd_sad8x4x4d_sse2, 12),
921 make_tuple(4, 8, &vpx_highbd_sad4x8x4d_sse2, 12),
922 make_tuple(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
Johannd5d92892015-04-17 16:11:38 -0400923#endif // CONFIG_VP9_HIGHBITDEPTH
924};
925INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
Deb Mukherjeefc882922014-05-13 10:11:42 -0700926#endif // CONFIG_USE_X86INC
Deb Mukherjeefc882922014-05-13 10:11:42 -0700927#endif // HAVE_SSE2
John Koleszar1cfc86e2013-03-01 12:43:41 -0800928
929#if HAVE_SSE3
Johannd5d92892015-04-17 16:11:38 -0400930// Only functions are x3, which do not have tests.
Deb Mukherjeefc882922014-05-13 10:11:42 -0700931#endif // HAVE_SSE3
John Koleszar6b653cb2013-02-28 17:03:02 -0800932
Johannfbea8972012-06-28 11:43:58 -0700933#if HAVE_SSSE3
Johannd5d92892015-04-17 16:11:38 -0400934// Only functions are x3, which do not have tests.
Deb Mukherjeefc882922014-05-13 10:11:42 -0700935#endif // HAVE_SSSE3
Johannfbea8972012-06-28 11:43:58 -0700936
Johannd5d92892015-04-17 16:11:38 -0400937#if HAVE_SSE4_1
938// Only functions are x8, which do not have tests.
939#endif // HAVE_SSE4_1
James Zernd3ff0092014-06-08 18:25:37 -0700940
Johannd5d92892015-04-17 16:11:38 -0400941#if HAVE_AVX2
Johannd5d92892015-04-17 16:11:38 -0400942const SadMxNParam avx2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800943 make_tuple(64, 64, &vpx_sad64x64_avx2, -1),
944 make_tuple(64, 32, &vpx_sad64x32_avx2, -1),
945 make_tuple(32, 64, &vpx_sad32x64_avx2, -1),
946 make_tuple(32, 32, &vpx_sad32x32_avx2, -1),
947 make_tuple(32, 16, &vpx_sad32x16_avx2, -1),
Johannd5d92892015-04-17 16:11:38 -0400948};
949INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
950
Johannd5d92892015-04-17 16:11:38 -0400951const SadMxNAvgParam avg_avx2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800952 make_tuple(64, 64, &vpx_sad64x64_avg_avx2, -1),
953 make_tuple(64, 32, &vpx_sad64x32_avg_avx2, -1),
954 make_tuple(32, 64, &vpx_sad32x64_avg_avx2, -1),
955 make_tuple(32, 32, &vpx_sad32x32_avg_avx2, -1),
956 make_tuple(32, 16, &vpx_sad32x16_avg_avx2, -1),
Johannd5d92892015-04-17 16:11:38 -0400957};
958INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
959
Johannd5d92892015-04-17 16:11:38 -0400960const SadMxNx4Param x4d_avx2_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800961 make_tuple(64, 64, &vpx_sad64x64x4d_avx2, -1),
962 make_tuple(32, 32, &vpx_sad32x32x4d_avx2, -1),
Johannd5d92892015-04-17 16:11:38 -0400963};
964INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
965#endif // HAVE_AVX2
Frank Galligan54fa9562015-01-24 12:11:16 -0800966
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +0530967//------------------------------------------------------------------------------
968// MIPS functions
969#if HAVE_MSA
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +0530970const SadMxNParam msa_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800971 make_tuple(64, 64, &vpx_sad64x64_msa, -1),
972 make_tuple(64, 32, &vpx_sad64x32_msa, -1),
973 make_tuple(32, 64, &vpx_sad32x64_msa, -1),
974 make_tuple(32, 32, &vpx_sad32x32_msa, -1),
975 make_tuple(32, 16, &vpx_sad32x16_msa, -1),
976 make_tuple(16, 32, &vpx_sad16x32_msa, -1),
977 make_tuple(16, 16, &vpx_sad16x16_msa, -1),
978 make_tuple(16, 8, &vpx_sad16x8_msa, -1),
979 make_tuple(8, 16, &vpx_sad8x16_msa, -1),
980 make_tuple(8, 8, &vpx_sad8x8_msa, -1),
981 make_tuple(8, 4, &vpx_sad8x4_msa, -1),
982 make_tuple(4, 8, &vpx_sad4x8_msa, -1),
983 make_tuple(4, 4, &vpx_sad4x4_msa, -1),
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +0530984};
985INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
986
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +0530987const SadMxNAvgParam avg_msa_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -0800988 make_tuple(64, 64, &vpx_sad64x64_avg_msa, -1),
989 make_tuple(64, 32, &vpx_sad64x32_avg_msa, -1),
990 make_tuple(32, 64, &vpx_sad32x64_avg_msa, -1),
991 make_tuple(32, 32, &vpx_sad32x32_avg_msa, -1),
992 make_tuple(32, 16, &vpx_sad32x16_avg_msa, -1),
993 make_tuple(16, 32, &vpx_sad16x32_avg_msa, -1),
994 make_tuple(16, 16, &vpx_sad16x16_avg_msa, -1),
995 make_tuple(16, 8, &vpx_sad16x8_avg_msa, -1),
996 make_tuple(8, 16, &vpx_sad8x16_avg_msa, -1),
997 make_tuple(8, 8, &vpx_sad8x8_avg_msa, -1),
998 make_tuple(8, 4, &vpx_sad8x4_avg_msa, -1),
999 make_tuple(4, 8, &vpx_sad4x8_avg_msa, -1),
1000 make_tuple(4, 4, &vpx_sad4x4_avg_msa, -1),
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +05301001};
1002INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
1003
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +05301004const SadMxNx4Param x4d_msa_tests[] = {
James Zern91606bb2015-11-05 19:00:45 -08001005 make_tuple(64, 64, &vpx_sad64x64x4d_msa, -1),
1006 make_tuple(64, 32, &vpx_sad64x32x4d_msa, -1),
1007 make_tuple(32, 64, &vpx_sad32x64x4d_msa, -1),
1008 make_tuple(32, 32, &vpx_sad32x32x4d_msa, -1),
1009 make_tuple(32, 16, &vpx_sad32x16x4d_msa, -1),
1010 make_tuple(16, 32, &vpx_sad16x32x4d_msa, -1),
1011 make_tuple(16, 16, &vpx_sad16x16x4d_msa, -1),
1012 make_tuple(16, 8, &vpx_sad16x8x4d_msa, -1),
1013 make_tuple(8, 16, &vpx_sad8x16x4d_msa, -1),
1014 make_tuple(8, 8, &vpx_sad8x8x4d_msa, -1),
1015 make_tuple(8, 4, &vpx_sad8x4x4d_msa, -1),
1016 make_tuple(4, 8, &vpx_sad4x8x4d_msa, -1),
1017 make_tuple(4, 4, &vpx_sad4x4x4d_msa, -1),
Parag Salasakarbc3ec8e2015-07-01 11:19:42 +05301018};
1019INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
1020#endif // HAVE_MSA
1021
Johannfbea8972012-06-28 11:43:58 -07001022} // namespace