1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include <string.h>
12 #include <limits.h>
13 #include <stdio.h>
14
15 #include "third_party/googletest/src/include/gtest/gtest.h"
16
17 #include "./vpx_config.h"
18 #include "./vpx_dsp_rtcd.h"
19 #include "test/acm_random.h"
20 #include "test/clear_system_state.h"
21 #include "test/register_state_check.h"
22 #include "test/util.h"
23 #include "vpx/vpx_codec.h"
24 #include "vpx_mem/vpx_mem.h"
25 #include "vpx_ports/mem.h"
26
27 template <typename Function>
28 struct TestParams {
TestParamsTestParams29 TestParams(int w, int h, Function f, int bd = -1)
30 : width(w), height(h), bit_depth(bd), func(f) {}
31 int width, height, bit_depth;
32 Function func;
33 };
34
35 typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr, int src_stride,
36 const uint8_t *ref_ptr, int ref_stride);
37 typedef TestParams<SadMxNFunc> SadMxNParam;
38
39 typedef unsigned int (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
40 const uint8_t *ref_ptr, int ref_stride,
41 const uint8_t *second_pred);
42 typedef TestParams<SadMxNAvgFunc> SadMxNAvgParam;
43
44 typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
45 const uint8_t *const ref_ptr[], int ref_stride,
46 unsigned int *sad_array);
47 typedef TestParams<SadMxNx4Func> SadMxNx4Param;
48
49 using libvpx_test::ACMRandom;
50
51 namespace {
52 template <typename ParamType>
53 class SADTestBase : public ::testing::TestWithParam<ParamType> {
54 public:
SADTestBase(const ParamType & params)55 explicit SADTestBase(const ParamType ¶ms) : params_(params) {}
56
SetUp()57 virtual void SetUp() {
58 source_data8_ = reinterpret_cast<uint8_t *>(
59 vpx_memalign(kDataAlignment, kDataBlockSize));
60 reference_data8_ = reinterpret_cast<uint8_t *>(
61 vpx_memalign(kDataAlignment, kDataBufferSize));
62 second_pred8_ =
63 reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
64 source_data16_ = reinterpret_cast<uint16_t *>(
65 vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
66 reference_data16_ = reinterpret_cast<uint16_t *>(
67 vpx_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
68 second_pred16_ = reinterpret_cast<uint16_t *>(
69 vpx_memalign(kDataAlignment, 64 * 64 * sizeof(uint16_t)));
70
71 if (params_.bit_depth == -1) {
72 use_high_bit_depth_ = false;
73 bit_depth_ = VPX_BITS_8;
74 source_data_ = source_data8_;
75 reference_data_ = reference_data8_;
76 second_pred_ = second_pred8_;
77 #if CONFIG_VP9_HIGHBITDEPTH
78 } else {
79 use_high_bit_depth_ = true;
80 bit_depth_ = static_cast<vpx_bit_depth_t>(params_.bit_depth);
81 source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
82 reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
83 second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
84 #endif // CONFIG_VP9_HIGHBITDEPTH
85 }
86 mask_ = (1 << bit_depth_) - 1;
87 source_stride_ = (params_.width + 31) & ~31;
88 reference_stride_ = params_.width * 2;
89 rnd_.Reset(ACMRandom::DeterministicSeed());
90 }
91
TearDown()92 virtual void TearDown() {
93 vpx_free(source_data8_);
94 source_data8_ = NULL;
95 vpx_free(reference_data8_);
96 reference_data8_ = NULL;
97 vpx_free(second_pred8_);
98 second_pred8_ = NULL;
99 vpx_free(source_data16_);
100 source_data16_ = NULL;
101 vpx_free(reference_data16_);
102 reference_data16_ = NULL;
103 vpx_free(second_pred16_);
104 second_pred16_ = NULL;
105
106 libvpx_test::ClearSystemState();
107 }
108
109 protected:
110 // Handle blocks up to 4 blocks 64x64 with stride up to 128
111 static const int kDataAlignment = 16;
112 static const int kDataBlockSize = 64 * 128;
113 static const int kDataBufferSize = 4 * kDataBlockSize;
114
GetReference(int block_idx) const115 uint8_t *GetReference(int block_idx) const {
116 #if CONFIG_VP9_HIGHBITDEPTH
117 if (use_high_bit_depth_) {
118 return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
119 block_idx * kDataBlockSize);
120 }
121 #endif // CONFIG_VP9_HIGHBITDEPTH
122 return reference_data_ + block_idx * kDataBlockSize;
123 }
124
125 // Sum of Absolute Differences. Given two blocks, calculate the absolute
126 // difference between two pixels in the same relative location; accumulate.
ReferenceSAD(int block_idx) const127 uint32_t ReferenceSAD(int block_idx) const {
128 uint32_t sad = 0;
129 const uint8_t *const reference8 = GetReference(block_idx);
130 const uint8_t *const source8 = source_data_;
131 #if CONFIG_VP9_HIGHBITDEPTH
132 const uint16_t *const reference16 =
133 CONVERT_TO_SHORTPTR(GetReference(block_idx));
134 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
135 #endif // CONFIG_VP9_HIGHBITDEPTH
136 for (int h = 0; h < params_.height; ++h) {
137 for (int w = 0; w < params_.width; ++w) {
138 if (!use_high_bit_depth_) {
139 sad += abs(source8[h * source_stride_ + w] -
140 reference8[h * reference_stride_ + w]);
141 #if CONFIG_VP9_HIGHBITDEPTH
142 } else {
143 sad += abs(source16[h * source_stride_ + w] -
144 reference16[h * reference_stride_ + w]);
145 #endif // CONFIG_VP9_HIGHBITDEPTH
146 }
147 }
148 }
149 return sad;
150 }
151
152 // Sum of Absolute Differences Average. Given two blocks, and a prediction
153 // calculate the absolute difference between one pixel and average of the
154 // corresponding and predicted pixels; accumulate.
ReferenceSADavg(int block_idx) const155 unsigned int ReferenceSADavg(int block_idx) const {
156 unsigned int sad = 0;
157 const uint8_t *const reference8 = GetReference(block_idx);
158 const uint8_t *const source8 = source_data_;
159 const uint8_t *const second_pred8 = second_pred_;
160 #if CONFIG_VP9_HIGHBITDEPTH
161 const uint16_t *const reference16 =
162 CONVERT_TO_SHORTPTR(GetReference(block_idx));
163 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
164 const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
165 #endif // CONFIG_VP9_HIGHBITDEPTH
166 for (int h = 0; h < params_.height; ++h) {
167 for (int w = 0; w < params_.width; ++w) {
168 if (!use_high_bit_depth_) {
169 const int tmp = second_pred8[h * params_.width + w] +
170 reference8[h * reference_stride_ + w];
171 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
172 sad += abs(source8[h * source_stride_ + w] - comp_pred);
173 #if CONFIG_VP9_HIGHBITDEPTH
174 } else {
175 const int tmp = second_pred16[h * params_.width + w] +
176 reference16[h * reference_stride_ + w];
177 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
178 sad += abs(source16[h * source_stride_ + w] - comp_pred);
179 #endif // CONFIG_VP9_HIGHBITDEPTH
180 }
181 }
182 }
183 return sad;
184 }
185
FillConstant(uint8_t * data,int stride,uint16_t fill_constant) const186 void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) const {
187 uint8_t *data8 = data;
188 #if CONFIG_VP9_HIGHBITDEPTH
189 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
190 #endif // CONFIG_VP9_HIGHBITDEPTH
191 for (int h = 0; h < params_.height; ++h) {
192 for (int w = 0; w < params_.width; ++w) {
193 if (!use_high_bit_depth_) {
194 data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
195 #if CONFIG_VP9_HIGHBITDEPTH
196 } else {
197 data16[h * stride + w] = fill_constant;
198 #endif // CONFIG_VP9_HIGHBITDEPTH
199 }
200 }
201 }
202 }
203
FillRandom(uint8_t * data,int stride)204 void FillRandom(uint8_t *data, int stride) {
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 < params_.height; ++h) {
210 for (int w = 0; w < params_.width; ++w) {
211 if (!use_high_bit_depth_) {
212 data8[h * stride + w] = rnd_.Rand8();
213 #if CONFIG_VP9_HIGHBITDEPTH
214 } else {
215 data16[h * stride + w] = rnd_.Rand16() & mask_;
216 #endif // CONFIG_VP9_HIGHBITDEPTH
217 }
218 }
219 }
220 }
221
222 uint32_t mask_;
223 vpx_bit_depth_t bit_depth_;
224 int source_stride_;
225 int reference_stride_;
226 bool use_high_bit_depth_;
227
228 uint8_t *source_data_;
229 uint8_t *reference_data_;
230 uint8_t *second_pred_;
231 uint8_t *source_data8_;
232 uint8_t *reference_data8_;
233 uint8_t *second_pred8_;
234 uint16_t *source_data16_;
235 uint16_t *reference_data16_;
236 uint16_t *second_pred16_;
237
238 ACMRandom rnd_;
239 ParamType params_;
240 };
241
242 class SADx4Test : public SADTestBase<SadMxNx4Param> {
243 public:
SADx4Test()244 SADx4Test() : SADTestBase(GetParam()) {}
245
246 protected:
SADs(unsigned int * results) const247 void SADs(unsigned int *results) const {
248 const uint8_t *references[] = { GetReference(0), GetReference(1),
249 GetReference(2), GetReference(3) };
250
251 ASM_REGISTER_STATE_CHECK(params_.func(
252 source_data_, source_stride_, references, reference_stride_, results));
253 }
254
CheckSADs() const255 void CheckSADs() const {
256 uint32_t reference_sad, exp_sad[4];
257
258 SADs(exp_sad);
259 for (int block = 0; block < 4; ++block) {
260 reference_sad = ReferenceSAD(block);
261
262 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
263 }
264 }
265 };
266
267 class SADTest : public SADTestBase<SadMxNParam> {
268 public:
SADTest()269 SADTest() : SADTestBase(GetParam()) {}
270
271 protected:
SAD(int block_idx) const272 unsigned int SAD(int block_idx) const {
273 unsigned int ret;
274 const uint8_t *const reference = GetReference(block_idx);
275
276 ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
277 reference, reference_stride_));
278 return ret;
279 }
280
CheckSAD() const281 void CheckSAD() const {
282 const unsigned int reference_sad = ReferenceSAD(0);
283 const unsigned int exp_sad = SAD(0);
284
285 ASSERT_EQ(reference_sad, exp_sad);
286 }
287 };
288
289 class SADavgTest : public SADTestBase<SadMxNAvgParam> {
290 public:
SADavgTest()291 SADavgTest() : SADTestBase(GetParam()) {}
292
293 protected:
SAD_avg(int block_idx) const294 unsigned int SAD_avg(int block_idx) const {
295 unsigned int ret;
296 const uint8_t *const reference = GetReference(block_idx);
297
298 ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
299 reference, reference_stride_,
300 second_pred_));
301 return ret;
302 }
303
CheckSAD() const304 void CheckSAD() const {
305 const unsigned int reference_sad = ReferenceSADavg(0);
306 const unsigned int exp_sad = SAD_avg(0);
307
308 ASSERT_EQ(reference_sad, exp_sad);
309 }
310 };
311
TEST_P(SADTest,MaxRef)312 TEST_P(SADTest, MaxRef) {
313 FillConstant(source_data_, source_stride_, 0);
314 FillConstant(reference_data_, reference_stride_, mask_);
315 CheckSAD();
316 }
317
TEST_P(SADTest,MaxSrc)318 TEST_P(SADTest, MaxSrc) {
319 FillConstant(source_data_, source_stride_, mask_);
320 FillConstant(reference_data_, reference_stride_, 0);
321 CheckSAD();
322 }
323
TEST_P(SADTest,ShortRef)324 TEST_P(SADTest, ShortRef) {
325 const int tmp_stride = reference_stride_;
326 reference_stride_ >>= 1;
327 FillRandom(source_data_, source_stride_);
328 FillRandom(reference_data_, reference_stride_);
329 CheckSAD();
330 reference_stride_ = tmp_stride;
331 }
332
TEST_P(SADTest,UnalignedRef)333 TEST_P(SADTest, UnalignedRef) {
334 // The reference frame, but not the source frame, may be unaligned for
335 // certain types of searches.
336 const int tmp_stride = reference_stride_;
337 reference_stride_ -= 1;
338 FillRandom(source_data_, source_stride_);
339 FillRandom(reference_data_, reference_stride_);
340 CheckSAD();
341 reference_stride_ = tmp_stride;
342 }
343
TEST_P(SADTest,ShortSrc)344 TEST_P(SADTest, ShortSrc) {
345 const int tmp_stride = source_stride_;
346 source_stride_ >>= 1;
347 FillRandom(source_data_, source_stride_);
348 FillRandom(reference_data_, reference_stride_);
349 CheckSAD();
350 source_stride_ = tmp_stride;
351 }
352
TEST_P(SADavgTest,MaxRef)353 TEST_P(SADavgTest, MaxRef) {
354 FillConstant(source_data_, source_stride_, 0);
355 FillConstant(reference_data_, reference_stride_, mask_);
356 FillConstant(second_pred_, params_.width, 0);
357 CheckSAD();
358 }
TEST_P(SADavgTest,MaxSrc)359 TEST_P(SADavgTest, MaxSrc) {
360 FillConstant(source_data_, source_stride_, mask_);
361 FillConstant(reference_data_, reference_stride_, 0);
362 FillConstant(second_pred_, params_.width, 0);
363 CheckSAD();
364 }
365
TEST_P(SADavgTest,ShortRef)366 TEST_P(SADavgTest, ShortRef) {
367 const int tmp_stride = reference_stride_;
368 reference_stride_ >>= 1;
369 FillRandom(source_data_, source_stride_);
370 FillRandom(reference_data_, reference_stride_);
371 FillRandom(second_pred_, params_.width);
372 CheckSAD();
373 reference_stride_ = tmp_stride;
374 }
375
TEST_P(SADavgTest,UnalignedRef)376 TEST_P(SADavgTest, UnalignedRef) {
377 // The reference frame, but not the source frame, may be unaligned for
378 // certain types of searches.
379 const int tmp_stride = reference_stride_;
380 reference_stride_ -= 1;
381 FillRandom(source_data_, source_stride_);
382 FillRandom(reference_data_, reference_stride_);
383 FillRandom(second_pred_, params_.width);
384 CheckSAD();
385 reference_stride_ = tmp_stride;
386 }
387
TEST_P(SADavgTest,ShortSrc)388 TEST_P(SADavgTest, ShortSrc) {
389 const int tmp_stride = source_stride_;
390 source_stride_ >>= 1;
391 FillRandom(source_data_, source_stride_);
392 FillRandom(reference_data_, reference_stride_);
393 FillRandom(second_pred_, params_.width);
394 CheckSAD();
395 source_stride_ = tmp_stride;
396 }
397
TEST_P(SADx4Test,MaxRef)398 TEST_P(SADx4Test, MaxRef) {
399 FillConstant(source_data_, source_stride_, 0);
400 FillConstant(GetReference(0), reference_stride_, mask_);
401 FillConstant(GetReference(1), reference_stride_, mask_);
402 FillConstant(GetReference(2), reference_stride_, mask_);
403 FillConstant(GetReference(3), reference_stride_, mask_);
404 CheckSADs();
405 }
406
TEST_P(SADx4Test,MaxSrc)407 TEST_P(SADx4Test, MaxSrc) {
408 FillConstant(source_data_, source_stride_, mask_);
409 FillConstant(GetReference(0), reference_stride_, 0);
410 FillConstant(GetReference(1), reference_stride_, 0);
411 FillConstant(GetReference(2), reference_stride_, 0);
412 FillConstant(GetReference(3), reference_stride_, 0);
413 CheckSADs();
414 }
415
TEST_P(SADx4Test,ShortRef)416 TEST_P(SADx4Test, ShortRef) {
417 int tmp_stride = reference_stride_;
418 reference_stride_ >>= 1;
419 FillRandom(source_data_, source_stride_);
420 FillRandom(GetReference(0), reference_stride_);
421 FillRandom(GetReference(1), reference_stride_);
422 FillRandom(GetReference(2), reference_stride_);
423 FillRandom(GetReference(3), reference_stride_);
424 CheckSADs();
425 reference_stride_ = tmp_stride;
426 }
427
TEST_P(SADx4Test,UnalignedRef)428 TEST_P(SADx4Test, UnalignedRef) {
429 // The reference frame, but not the source frame, may be unaligned for
430 // certain types of searches.
431 int tmp_stride = reference_stride_;
432 reference_stride_ -= 1;
433 FillRandom(source_data_, source_stride_);
434 FillRandom(GetReference(0), reference_stride_);
435 FillRandom(GetReference(1), reference_stride_);
436 FillRandom(GetReference(2), reference_stride_);
437 FillRandom(GetReference(3), reference_stride_);
438 CheckSADs();
439 reference_stride_ = tmp_stride;
440 }
441
TEST_P(SADx4Test,ShortSrc)442 TEST_P(SADx4Test, ShortSrc) {
443 int tmp_stride = source_stride_;
444 source_stride_ >>= 1;
445 FillRandom(source_data_, source_stride_);
446 FillRandom(GetReference(0), reference_stride_);
447 FillRandom(GetReference(1), reference_stride_);
448 FillRandom(GetReference(2), reference_stride_);
449 FillRandom(GetReference(3), reference_stride_);
450 CheckSADs();
451 source_stride_ = tmp_stride;
452 }
453
TEST_P(SADx4Test,SrcAlignedByWidth)454 TEST_P(SADx4Test, SrcAlignedByWidth) {
455 uint8_t *tmp_source_data = source_data_;
456 source_data_ += params_.width;
457 FillRandom(source_data_, source_stride_);
458 FillRandom(GetReference(0), reference_stride_);
459 FillRandom(GetReference(1), reference_stride_);
460 FillRandom(GetReference(2), reference_stride_);
461 FillRandom(GetReference(3), reference_stride_);
462 CheckSADs();
463 source_data_ = tmp_source_data;
464 }
465
466 //------------------------------------------------------------------------------
467 // C functions
468 const SadMxNParam c_tests[] = {
469 SadMxNParam(64, 64, &vpx_sad64x64_c),
470 SadMxNParam(64, 32, &vpx_sad64x32_c),
471 SadMxNParam(32, 64, &vpx_sad32x64_c),
472 SadMxNParam(32, 32, &vpx_sad32x32_c),
473 SadMxNParam(32, 16, &vpx_sad32x16_c),
474 SadMxNParam(16, 32, &vpx_sad16x32_c),
475 SadMxNParam(16, 16, &vpx_sad16x16_c),
476 SadMxNParam(16, 8, &vpx_sad16x8_c),
477 SadMxNParam(8, 16, &vpx_sad8x16_c),
478 SadMxNParam(8, 8, &vpx_sad8x8_c),
479 SadMxNParam(8, 4, &vpx_sad8x4_c),
480 SadMxNParam(4, 8, &vpx_sad4x8_c),
481 SadMxNParam(4, 4, &vpx_sad4x4_c),
482 #if CONFIG_VP9_HIGHBITDEPTH
483 SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 8),
484 SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 8),
485 SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 8),
486 SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 8),
487 SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 8),
488 SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 8),
489 SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 8),
490 SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 8),
491 SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 8),
492 SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 8),
493 SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 8),
494 SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 8),
495 SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 8),
496 SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 10),
497 SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 10),
498 SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 10),
499 SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 10),
500 SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 10),
501 SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 10),
502 SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 10),
503 SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 10),
504 SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 10),
505 SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 10),
506 SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 10),
507 SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 10),
508 SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 10),
509 SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 12),
510 SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 12),
511 SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 12),
512 SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 12),
513 SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 12),
514 SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 12),
515 SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 12),
516 SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 12),
517 SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 12),
518 SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 12),
519 SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 12),
520 SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 12),
521 SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 12),
522 #endif // CONFIG_VP9_HIGHBITDEPTH
523 };
524 INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
525
526 const SadMxNAvgParam avg_c_tests[] = {
527 SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_c),
528 SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_c),
529 SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_c),
530 SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_c),
531 SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_c),
532 SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_c),
533 SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_c),
534 SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_c),
535 SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_c),
536 SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_c),
537 SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_c),
538 SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_c),
539 SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_c),
540 #if CONFIG_VP9_HIGHBITDEPTH
541 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 8),
542 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 8),
543 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 8),
544 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 8),
545 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 8),
546 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 8),
547 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 8),
548 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 8),
549 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 8),
550 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 8),
551 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 8),
552 SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 8),
553 SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 8),
554 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 10),
555 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 10),
556 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 10),
557 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 10),
558 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 10),
559 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 10),
560 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 10),
561 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 10),
562 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 10),
563 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 10),
564 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 10),
565 SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 10),
566 SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 10),
567 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 12),
568 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 12),
569 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 12),
570 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 12),
571 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 12),
572 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 12),
573 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 12),
574 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 12),
575 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 12),
576 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 12),
577 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 12),
578 SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 12),
579 SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
580 #endif // CONFIG_VP9_HIGHBITDEPTH
581 };
582 INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
583
584 const SadMxNx4Param x4d_c_tests[] = {
585 SadMxNx4Param(64, 64, &vpx_sad64x64x4d_c),
586 SadMxNx4Param(64, 32, &vpx_sad64x32x4d_c),
587 SadMxNx4Param(32, 64, &vpx_sad32x64x4d_c),
588 SadMxNx4Param(32, 32, &vpx_sad32x32x4d_c),
589 SadMxNx4Param(32, 16, &vpx_sad32x16x4d_c),
590 SadMxNx4Param(16, 32, &vpx_sad16x32x4d_c),
591 SadMxNx4Param(16, 16, &vpx_sad16x16x4d_c),
592 SadMxNx4Param(16, 8, &vpx_sad16x8x4d_c),
593 SadMxNx4Param(8, 16, &vpx_sad8x16x4d_c),
594 SadMxNx4Param(8, 8, &vpx_sad8x8x4d_c),
595 SadMxNx4Param(8, 4, &vpx_sad8x4x4d_c),
596 SadMxNx4Param(4, 8, &vpx_sad4x8x4d_c),
597 SadMxNx4Param(4, 4, &vpx_sad4x4x4d_c),
598 #if CONFIG_VP9_HIGHBITDEPTH
599 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 8),
600 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 8),
601 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 8),
602 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 8),
603 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 8),
604 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 8),
605 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 8),
606 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 8),
607 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 8),
608 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 8),
609 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 8),
610 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 8),
611 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 8),
612 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 10),
613 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 10),
614 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 10),
615 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 10),
616 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 10),
617 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 10),
618 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 10),
619 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 10),
620 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 10),
621 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 10),
622 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 10),
623 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 10),
624 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 10),
625 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 12),
626 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 12),
627 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 12),
628 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 12),
629 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 12),
630 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 12),
631 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 12),
632 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 12),
633 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 12),
634 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 12),
635 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 12),
636 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 12),
637 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
638 #endif // CONFIG_VP9_HIGHBITDEPTH
639 };
640 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
641
642 //------------------------------------------------------------------------------
643 // ARM functions
644 #if HAVE_NEON
645 const SadMxNParam neon_tests[] = {
646 SadMxNParam(64, 64, &vpx_sad64x64_neon),
647 SadMxNParam(32, 32, &vpx_sad32x32_neon),
648 SadMxNParam(16, 16, &vpx_sad16x16_neon),
649 SadMxNParam(16, 8, &vpx_sad16x8_neon),
650 SadMxNParam(8, 16, &vpx_sad8x16_neon),
651 SadMxNParam(8, 8, &vpx_sad8x8_neon),
652 SadMxNParam(4, 4, &vpx_sad4x4_neon),
653 };
654 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
655
656 const SadMxNx4Param x4d_neon_tests[] = {
657 SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon),
658 SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon),
659 SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon),
660 };
661 INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
662 #endif // HAVE_NEON
663
664 //------------------------------------------------------------------------------
665 // x86 functions
666 #if HAVE_SSE2
667 const SadMxNParam sse2_tests[] = {
668 SadMxNParam(64, 64, &vpx_sad64x64_sse2),
669 SadMxNParam(64, 32, &vpx_sad64x32_sse2),
670 SadMxNParam(32, 64, &vpx_sad32x64_sse2),
671 SadMxNParam(32, 32, &vpx_sad32x32_sse2),
672 SadMxNParam(32, 16, &vpx_sad32x16_sse2),
673 SadMxNParam(16, 32, &vpx_sad16x32_sse2),
674 SadMxNParam(16, 16, &vpx_sad16x16_sse2),
675 SadMxNParam(16, 8, &vpx_sad16x8_sse2),
676 SadMxNParam(8, 16, &vpx_sad8x16_sse2),
677 SadMxNParam(8, 8, &vpx_sad8x8_sse2),
678 SadMxNParam(8, 4, &vpx_sad8x4_sse2),
679 SadMxNParam(4, 8, &vpx_sad4x8_sse2),
680 SadMxNParam(4, 4, &vpx_sad4x4_sse2),
681 #if CONFIG_VP9_HIGHBITDEPTH
682 SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 8),
683 SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 8),
684 SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 8),
685 SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 8),
686 SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 8),
687 SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 8),
688 SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 8),
689 SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 8),
690 SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 8),
691 SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 8),
692 SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 8),
693 SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 10),
694 SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 10),
695 SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 10),
696 SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 10),
697 SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 10),
698 SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 10),
699 SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 10),
700 SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 10),
701 SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 10),
702 SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 10),
703 SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 10),
704 SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 12),
705 SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 12),
706 SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 12),
707 SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 12),
708 SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 12),
709 SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 12),
710 SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 12),
711 SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 12),
712 SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 12),
713 SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 12),
714 SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 12),
715 #endif // CONFIG_VP9_HIGHBITDEPTH
716 };
717 INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
718
719 const SadMxNAvgParam avg_sse2_tests[] = {
720 SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_sse2),
721 SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_sse2),
722 SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_sse2),
723 SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_sse2),
724 SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_sse2),
725 SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_sse2),
726 SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_sse2),
727 SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_sse2),
728 SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_sse2),
729 SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_sse2),
730 SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_sse2),
731 SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_sse2),
732 SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_sse2),
733 #if CONFIG_VP9_HIGHBITDEPTH
734 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 8),
735 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 8),
736 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 8),
737 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 8),
738 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 8),
739 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 8),
740 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 8),
741 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 8),
742 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 8),
743 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 8),
744 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 8),
745 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 10),
746 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 10),
747 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 10),
748 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 10),
749 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 10),
750 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 10),
751 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 10),
752 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 10),
753 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 10),
754 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 10),
755 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 10),
756 SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 12),
757 SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 12),
758 SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 12),
759 SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 12),
760 SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 12),
761 SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 12),
762 SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 12),
763 SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 12),
764 SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 12),
765 SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 12),
766 SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
767 #endif // CONFIG_VP9_HIGHBITDEPTH
768 };
769 INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
770
771 const SadMxNx4Param x4d_sse2_tests[] = {
772 SadMxNx4Param(64, 64, &vpx_sad64x64x4d_sse2),
773 SadMxNx4Param(64, 32, &vpx_sad64x32x4d_sse2),
774 SadMxNx4Param(32, 64, &vpx_sad32x64x4d_sse2),
775 SadMxNx4Param(32, 32, &vpx_sad32x32x4d_sse2),
776 SadMxNx4Param(32, 16, &vpx_sad32x16x4d_sse2),
777 SadMxNx4Param(16, 32, &vpx_sad16x32x4d_sse2),
778 SadMxNx4Param(16, 16, &vpx_sad16x16x4d_sse2),
779 SadMxNx4Param(16, 8, &vpx_sad16x8x4d_sse2),
780 SadMxNx4Param(8, 16, &vpx_sad8x16x4d_sse2),
781 SadMxNx4Param(8, 8, &vpx_sad8x8x4d_sse2),
782 SadMxNx4Param(8, 4, &vpx_sad8x4x4d_sse2),
783 SadMxNx4Param(4, 8, &vpx_sad4x8x4d_sse2),
784 SadMxNx4Param(4, 4, &vpx_sad4x4x4d_sse2),
785 #if CONFIG_VP9_HIGHBITDEPTH
786 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 8),
787 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 8),
788 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 8),
789 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 8),
790 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 8),
791 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 8),
792 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 8),
793 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 8),
794 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 8),
795 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 8),
796 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 8),
797 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 8),
798 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 8),
799 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 10),
800 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 10),
801 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 10),
802 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 10),
803 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 10),
804 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 10),
805 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 10),
806 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 10),
807 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 10),
808 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 10),
809 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 10),
810 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 10),
811 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 10),
812 SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 12),
813 SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 12),
814 SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 12),
815 SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 12),
816 SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 12),
817 SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 12),
818 SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 12),
819 SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 12),
820 SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 12),
821 SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 12),
822 SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 12),
823 SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 12),
824 SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
825 #endif // CONFIG_VP9_HIGHBITDEPTH
826 };
827 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
828 #endif // HAVE_SSE2
829
830 #if HAVE_SSE3
831 // Only functions are x3, which do not have tests.
832 #endif // HAVE_SSE3
833
834 #if HAVE_SSSE3
835 // Only functions are x3, which do not have tests.
836 #endif // HAVE_SSSE3
837
838 #if HAVE_SSE4_1
839 // Only functions are x8, which do not have tests.
840 #endif // HAVE_SSE4_1
841
842 #if HAVE_AVX2
843 const SadMxNParam avx2_tests[] = {
844 SadMxNParam(64, 64, &vpx_sad64x64_avx2),
845 SadMxNParam(64, 32, &vpx_sad64x32_avx2),
846 SadMxNParam(32, 64, &vpx_sad32x64_avx2),
847 SadMxNParam(32, 32, &vpx_sad32x32_avx2),
848 SadMxNParam(32, 16, &vpx_sad32x16_avx2),
849 };
850 INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
851
852 const SadMxNAvgParam avg_avx2_tests[] = {
853 SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_avx2),
854 SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_avx2),
855 SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_avx2),
856 SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_avx2),
857 SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_avx2),
858 };
859 INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
860
861 const SadMxNx4Param x4d_avx2_tests[] = {
862 SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx2),
863 SadMxNx4Param(32, 32, &vpx_sad32x32x4d_avx2),
864 };
865 INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
866 #endif // HAVE_AVX2
867
868 //------------------------------------------------------------------------------
869 // MIPS functions
870 #if HAVE_MSA
871 const SadMxNParam msa_tests[] = {
872 SadMxNParam(64, 64, &vpx_sad64x64_msa),
873 SadMxNParam(64, 32, &vpx_sad64x32_msa),
874 SadMxNParam(32, 64, &vpx_sad32x64_msa),
875 SadMxNParam(32, 32, &vpx_sad32x32_msa),
876 SadMxNParam(32, 16, &vpx_sad32x16_msa),
877 SadMxNParam(16, 32, &vpx_sad16x32_msa),
878 SadMxNParam(16, 16, &vpx_sad16x16_msa),
879 SadMxNParam(16, 8, &vpx_sad16x8_msa),
880 SadMxNParam(8, 16, &vpx_sad8x16_msa),
881 SadMxNParam(8, 8, &vpx_sad8x8_msa),
882 SadMxNParam(8, 4, &vpx_sad8x4_msa),
883 SadMxNParam(4, 8, &vpx_sad4x8_msa),
884 SadMxNParam(4, 4, &vpx_sad4x4_msa),
885 };
886 INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
887
888 const SadMxNAvgParam avg_msa_tests[] = {
889 SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_msa),
890 SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_msa),
891 SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_msa),
892 SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_msa),
893 SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_msa),
894 SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_msa),
895 SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_msa),
896 SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_msa),
897 SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_msa),
898 SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_msa),
899 SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_msa),
900 SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_msa),
901 SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_msa),
902 };
903 INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
904
905 const SadMxNx4Param x4d_msa_tests[] = {
906 SadMxNx4Param(64, 64, &vpx_sad64x64x4d_msa),
907 SadMxNx4Param(64, 32, &vpx_sad64x32x4d_msa),
908 SadMxNx4Param(32, 64, &vpx_sad32x64x4d_msa),
909 SadMxNx4Param(32, 32, &vpx_sad32x32x4d_msa),
910 SadMxNx4Param(32, 16, &vpx_sad32x16x4d_msa),
911 SadMxNx4Param(16, 32, &vpx_sad16x32x4d_msa),
912 SadMxNx4Param(16, 16, &vpx_sad16x16x4d_msa),
913 SadMxNx4Param(16, 8, &vpx_sad16x8x4d_msa),
914 SadMxNx4Param(8, 16, &vpx_sad8x16x4d_msa),
915 SadMxNx4Param(8, 8, &vpx_sad8x8x4d_msa),
916 SadMxNx4Param(8, 4, &vpx_sad8x4x4d_msa),
917 SadMxNx4Param(4, 8, &vpx_sad4x8x4d_msa),
918 SadMxNx4Param(4, 4, &vpx_sad4x4x4d_msa),
919 };
920 INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
921 #endif // HAVE_MSA
922
923 //------------------------------------------------------------------------------
924 // VSX functions
925 #if HAVE_VSX
926 const SadMxNParam vsx_tests[] = {
927 SadMxNParam(64, 64, &vpx_sad64x64_vsx),
928 SadMxNParam(64, 32, &vpx_sad64x32_vsx),
929 SadMxNParam(32, 64, &vpx_sad32x64_vsx),
930 SadMxNParam(32, 32, &vpx_sad32x32_vsx),
931 SadMxNParam(32, 16, &vpx_sad32x16_vsx),
932 SadMxNParam(16, 32, &vpx_sad16x32_vsx),
933 SadMxNParam(16, 16, &vpx_sad16x16_vsx),
934 SadMxNParam(16, 8, &vpx_sad16x8_vsx),
935 };
936 INSTANTIATE_TEST_CASE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
937 #endif // HAVE_VSX
938 } // namespace
939