1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
10 */
11
12 #include <string.h>
13 #include <limits.h>
14 #include <stdio.h>
15
16 #include "third_party/googletest/src/googletest/include/gtest/gtest.h"
17
18 #include "./aom_config.h"
19 #include "./aom_dsp_rtcd.h"
20 #include "test/acm_random.h"
21 #include "test/clear_system_state.h"
22 #include "test/register_state_check.h"
23 #include "test/util.h"
24 #include "aom/aom_codec.h"
25 #include "aom_mem/aom_mem.h"
26 #include "aom_ports/mem.h"
27
28 typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr, int src_stride,
29 const uint8_t *ref_ptr, int ref_stride);
30 typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
31
32 typedef uint32_t (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
33 const uint8_t *ref_ptr, int ref_stride,
34 const uint8_t *second_pred);
35 typedef std::tr1::tuple<int, int, SadMxNAvgFunc, int> SadMxNAvgParam;
36
37 typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
38 const uint8_t *const ref_ptr[], int ref_stride,
39 uint32_t *sad_array);
40 typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
41
42 using libaom_test::ACMRandom;
43
44 namespace {
45 class SADTestBase : public ::testing::Test {
46 public:
SADTestBase(int width,int height,int bit_depth)47 SADTestBase(int width, int height, int bit_depth)
48 : width_(width), height_(height), bd_(bit_depth) {}
49
SetUpTestCase()50 static void SetUpTestCase() {
51 source_data8_ = reinterpret_cast<uint8_t *>(
52 aom_memalign(kDataAlignment, kDataBlockSize));
53 reference_data8_ = reinterpret_cast<uint8_t *>(
54 aom_memalign(kDataAlignment, kDataBufferSize));
55 second_pred8_ =
56 reinterpret_cast<uint8_t *>(aom_memalign(kDataAlignment, 128 * 128));
57 source_data16_ = reinterpret_cast<uint16_t *>(
58 aom_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
59 reference_data16_ = reinterpret_cast<uint16_t *>(
60 aom_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
61 second_pred16_ = reinterpret_cast<uint16_t *>(
62 aom_memalign(kDataAlignment, 128 * 128 * sizeof(uint16_t)));
63 }
64
TearDownTestCase()65 static void TearDownTestCase() {
66 aom_free(source_data8_);
67 source_data8_ = NULL;
68 aom_free(reference_data8_);
69 reference_data8_ = NULL;
70 aom_free(second_pred8_);
71 second_pred8_ = NULL;
72 aom_free(source_data16_);
73 source_data16_ = NULL;
74 aom_free(reference_data16_);
75 reference_data16_ = NULL;
76 aom_free(second_pred16_);
77 second_pred16_ = NULL;
78 }
79
TearDown()80 virtual void TearDown() { libaom_test::ClearSystemState(); }
81
82 protected:
83 // Handle up to 4 128x128 blocks, with stride up to 256
84 static const int kDataAlignment = 16;
85 static const int kDataBlockSize = 128 * 256;
86 static const int kDataBufferSize = 4 * kDataBlockSize;
87
SetUp()88 virtual void SetUp() {
89 if (bd_ == -1) {
90 use_high_bit_depth_ = false;
91 bit_depth_ = AOM_BITS_8;
92 source_data_ = source_data8_;
93 reference_data_ = reference_data8_;
94 second_pred_ = second_pred8_;
95 #if CONFIG_HIGHBITDEPTH
96 } else {
97 use_high_bit_depth_ = true;
98 bit_depth_ = static_cast<aom_bit_depth_t>(bd_);
99 source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
100 reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
101 second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
102 #endif // CONFIG_HIGHBITDEPTH
103 }
104 mask_ = (1 << bit_depth_) - 1;
105 source_stride_ = (width_ + 31) & ~31;
106 reference_stride_ = width_ * 2;
107 rnd_.Reset(ACMRandom::DeterministicSeed());
108 }
109
GetReference(int block_idx)110 virtual uint8_t *GetReference(int block_idx) {
111 #if CONFIG_HIGHBITDEPTH
112 if (use_high_bit_depth_)
113 return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
114 block_idx * kDataBlockSize);
115 #endif // CONFIG_HIGHBITDEPTH
116 return reference_data_ + block_idx * kDataBlockSize;
117 }
118
119 // Sum of Absolute Differences. Given two blocks, calculate the absolute
120 // difference between two pixels in the same relative location; accumulate.
ReferenceSAD(int block_idx)121 unsigned int ReferenceSAD(int block_idx) {
122 unsigned int sad = 0;
123 const uint8_t *const reference8 = GetReference(block_idx);
124 const uint8_t *const source8 = source_data_;
125 #if CONFIG_HIGHBITDEPTH
126 const uint16_t *const reference16 =
127 CONVERT_TO_SHORTPTR(GetReference(block_idx));
128 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
129 #endif // CONFIG_HIGHBITDEPTH
130 for (int h = 0; h < height_; ++h) {
131 for (int w = 0; w < width_; ++w) {
132 if (!use_high_bit_depth_) {
133 sad += abs(source8[h * source_stride_ + w] -
134 reference8[h * reference_stride_ + w]);
135 #if CONFIG_HIGHBITDEPTH
136 } else {
137 sad += abs(source16[h * source_stride_ + w] -
138 reference16[h * reference_stride_ + w]);
139 #endif // CONFIG_HIGHBITDEPTH
140 }
141 }
142 }
143 return sad;
144 }
145
146 // Sum of Absolute Differences Average. Given two blocks, and a prediction
147 // calculate the absolute difference between one pixel and average of the
148 // corresponding and predicted pixels; accumulate.
ReferenceSADavg(int block_idx)149 unsigned int ReferenceSADavg(int block_idx) {
150 unsigned int sad = 0;
151 const uint8_t *const reference8 = GetReference(block_idx);
152 const uint8_t *const source8 = source_data_;
153 const uint8_t *const second_pred8 = second_pred_;
154 #if CONFIG_HIGHBITDEPTH
155 const uint16_t *const reference16 =
156 CONVERT_TO_SHORTPTR(GetReference(block_idx));
157 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
158 const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
159 #endif // CONFIG_HIGHBITDEPTH
160 for (int h = 0; h < height_; ++h) {
161 for (int w = 0; w < width_; ++w) {
162 if (!use_high_bit_depth_) {
163 const int tmp = second_pred8[h * width_ + w] +
164 reference8[h * reference_stride_ + w];
165 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
166 sad += abs(source8[h * source_stride_ + w] - comp_pred);
167 #if CONFIG_HIGHBITDEPTH
168 } else {
169 const int tmp = second_pred16[h * width_ + w] +
170 reference16[h * reference_stride_ + w];
171 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
172 sad += abs(source16[h * source_stride_ + w] - comp_pred);
173 #endif // CONFIG_HIGHBITDEPTH
174 }
175 }
176 }
177 return sad;
178 }
179
FillConstant(uint8_t * data,int stride,uint16_t fill_constant)180 void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
181 uint8_t *data8 = data;
182 #if CONFIG_HIGHBITDEPTH
183 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
184 #endif // CONFIG_HIGHBITDEPTH
185 for (int h = 0; h < height_; ++h) {
186 for (int w = 0; w < width_; ++w) {
187 if (!use_high_bit_depth_) {
188 data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
189 #if CONFIG_HIGHBITDEPTH
190 } else {
191 data16[h * stride + w] = fill_constant;
192 #endif // CONFIG_HIGHBITDEPTH
193 }
194 }
195 }
196 }
197
FillRandom(uint8_t * data,int stride)198 void FillRandom(uint8_t *data, int stride) {
199 uint8_t *data8 = data;
200 #if CONFIG_HIGHBITDEPTH
201 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
202 #endif // CONFIG_HIGHBITDEPTH
203 for (int h = 0; h < height_; ++h) {
204 for (int w = 0; w < width_; ++w) {
205 if (!use_high_bit_depth_) {
206 data8[h * stride + w] = rnd_.Rand8();
207 #if CONFIG_HIGHBITDEPTH
208 } else {
209 data16[h * stride + w] = rnd_.Rand16() & mask_;
210 #endif // CONFIG_HIGHBITDEPTH
211 }
212 }
213 }
214 }
215
216 int width_, height_, mask_, bd_;
217 aom_bit_depth_t bit_depth_;
218 static uint8_t *source_data_;
219 static uint8_t *reference_data_;
220 static uint8_t *second_pred_;
221 int source_stride_;
222 bool use_high_bit_depth_;
223 static uint8_t *source_data8_;
224 static uint8_t *reference_data8_;
225 static uint8_t *second_pred8_;
226 static uint16_t *source_data16_;
227 static uint16_t *reference_data16_;
228 static uint16_t *second_pred16_;
229 int reference_stride_;
230
231 ACMRandom rnd_;
232 };
233
234 class SADx4Test : public ::testing::WithParamInterface<SadMxNx4Param>,
235 public SADTestBase {
236 public:
SADx4Test()237 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
238
239 protected:
SADs(unsigned int * results)240 void SADs(unsigned int *results) {
241 const uint8_t *references[] = { GetReference(0), GetReference(1),
242 GetReference(2), GetReference(3) };
243
244 ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(
245 source_data_, source_stride_, references, reference_stride_, results));
246 }
247
CheckSADs()248 void CheckSADs() {
249 unsigned int reference_sad, exp_sad[4];
250
251 SADs(exp_sad);
252 for (int block = 0; block < 4; ++block) {
253 reference_sad = ReferenceSAD(block);
254
255 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
256 }
257 }
258 };
259
260 class SADTest : public ::testing::WithParamInterface<SadMxNParam>,
261 public SADTestBase {
262 public:
SADTest()263 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
264
265 protected:
SAD(int block_idx)266 unsigned int SAD(int block_idx) {
267 unsigned int ret;
268 const uint8_t *const reference = GetReference(block_idx);
269
270 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
271 reference, reference_stride_));
272 return ret;
273 }
274
CheckSAD()275 void CheckSAD() {
276 const unsigned int reference_sad = ReferenceSAD(0);
277 const unsigned int exp_sad = SAD(0);
278
279 ASSERT_EQ(reference_sad, exp_sad);
280 }
281
SpeedSAD()282 void SpeedSAD() {
283 int test_count = 20000000;
284 while (test_count > 0) {
285 SAD(0);
286 test_count -= 1;
287 }
288 }
289 };
290
291 class SADavgTest : public ::testing::WithParamInterface<SadMxNAvgParam>,
292 public SADTestBase {
293 public:
SADavgTest()294 SADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
295
296 protected:
SAD_avg(int block_idx)297 unsigned int SAD_avg(int block_idx) {
298 unsigned int ret;
299 const uint8_t *const reference = GetReference(block_idx);
300
301 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
302 reference, reference_stride_,
303 second_pred_));
304 return ret;
305 }
306
CheckSAD()307 void CheckSAD() {
308 const unsigned int reference_sad = ReferenceSADavg(0);
309 const unsigned int exp_sad = SAD_avg(0);
310
311 ASSERT_EQ(reference_sad, exp_sad);
312 }
313 };
314
315 uint8_t *SADTestBase::source_data_ = NULL;
316 uint8_t *SADTestBase::reference_data_ = NULL;
317 uint8_t *SADTestBase::second_pred_ = NULL;
318 uint8_t *SADTestBase::source_data8_ = NULL;
319 uint8_t *SADTestBase::reference_data8_ = NULL;
320 uint8_t *SADTestBase::second_pred8_ = NULL;
321 uint16_t *SADTestBase::source_data16_ = NULL;
322 uint16_t *SADTestBase::reference_data16_ = NULL;
323 uint16_t *SADTestBase::second_pred16_ = NULL;
324
TEST_P(SADTest,MaxRef)325 TEST_P(SADTest, MaxRef) {
326 FillConstant(source_data_, source_stride_, 0);
327 FillConstant(reference_data_, reference_stride_, mask_);
328 CheckSAD();
329 }
330
TEST_P(SADTest,MaxSrc)331 TEST_P(SADTest, MaxSrc) {
332 FillConstant(source_data_, source_stride_, mask_);
333 FillConstant(reference_data_, reference_stride_, 0);
334 CheckSAD();
335 }
336
TEST_P(SADTest,ShortRef)337 TEST_P(SADTest, ShortRef) {
338 const int tmp_stride = reference_stride_;
339 reference_stride_ >>= 1;
340 FillRandom(source_data_, source_stride_);
341 FillRandom(reference_data_, reference_stride_);
342 CheckSAD();
343 reference_stride_ = tmp_stride;
344 }
345
TEST_P(SADTest,UnalignedRef)346 TEST_P(SADTest, UnalignedRef) {
347 // The reference frame, but not the source frame, may be unaligned for
348 // certain types of searches.
349 const int tmp_stride = reference_stride_;
350 reference_stride_ -= 1;
351 FillRandom(source_data_, source_stride_);
352 FillRandom(reference_data_, reference_stride_);
353 CheckSAD();
354 reference_stride_ = tmp_stride;
355 }
356
TEST_P(SADTest,ShortSrc)357 TEST_P(SADTest, ShortSrc) {
358 const int tmp_stride = source_stride_;
359 source_stride_ >>= 1;
360 int test_count = 2000;
361 while (test_count > 0) {
362 FillRandom(source_data_, source_stride_);
363 FillRandom(reference_data_, reference_stride_);
364 CheckSAD();
365 test_count -= 1;
366 }
367 source_stride_ = tmp_stride;
368 }
369
370 #define SPEED_TEST (0)
371 #if SPEED_TEST
TEST_P(SADTest,Speed)372 TEST_P(SADTest, Speed) {
373 const int tmp_stride = source_stride_;
374 source_stride_ >>= 1;
375 FillRandom(source_data_, source_stride_);
376 FillRandom(reference_data_, reference_stride_);
377 SpeedSAD();
378 source_stride_ = tmp_stride;
379 }
380 #endif
381
TEST_P(SADavgTest,MaxRef)382 TEST_P(SADavgTest, MaxRef) {
383 FillConstant(source_data_, source_stride_, 0);
384 FillConstant(reference_data_, reference_stride_, mask_);
385 FillConstant(second_pred_, width_, 0);
386 CheckSAD();
387 }
TEST_P(SADavgTest,MaxSrc)388 TEST_P(SADavgTest, MaxSrc) {
389 FillConstant(source_data_, source_stride_, mask_);
390 FillConstant(reference_data_, reference_stride_, 0);
391 FillConstant(second_pred_, width_, 0);
392 CheckSAD();
393 }
394
TEST_P(SADavgTest,ShortRef)395 TEST_P(SADavgTest, ShortRef) {
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
TEST_P(SADavgTest,UnalignedRef)405 TEST_P(SADavgTest, UnalignedRef) {
406 // The reference frame, but not the source frame, may be unaligned for
407 // certain types of searches.
408 const int tmp_stride = reference_stride_;
409 reference_stride_ -= 1;
410 FillRandom(source_data_, source_stride_);
411 FillRandom(reference_data_, reference_stride_);
412 FillRandom(second_pred_, width_);
413 CheckSAD();
414 reference_stride_ = tmp_stride;
415 }
416
TEST_P(SADavgTest,ShortSrc)417 TEST_P(SADavgTest, ShortSrc) {
418 const int tmp_stride = source_stride_;
419 source_stride_ >>= 1;
420 int test_count = 2000;
421 while (test_count > 0) {
422 FillRandom(source_data_, source_stride_);
423 FillRandom(reference_data_, reference_stride_);
424 FillRandom(second_pred_, width_);
425 CheckSAD();
426 test_count -= 1;
427 }
428 source_stride_ = tmp_stride;
429 }
430
TEST_P(SADx4Test,MaxRef)431 TEST_P(SADx4Test, MaxRef) {
432 FillConstant(source_data_, source_stride_, 0);
433 FillConstant(GetReference(0), reference_stride_, mask_);
434 FillConstant(GetReference(1), reference_stride_, mask_);
435 FillConstant(GetReference(2), reference_stride_, mask_);
436 FillConstant(GetReference(3), reference_stride_, mask_);
437 CheckSADs();
438 }
439
TEST_P(SADx4Test,MaxSrc)440 TEST_P(SADx4Test, MaxSrc) {
441 FillConstant(source_data_, source_stride_, mask_);
442 FillConstant(GetReference(0), reference_stride_, 0);
443 FillConstant(GetReference(1), reference_stride_, 0);
444 FillConstant(GetReference(2), reference_stride_, 0);
445 FillConstant(GetReference(3), reference_stride_, 0);
446 CheckSADs();
447 }
448
TEST_P(SADx4Test,ShortRef)449 TEST_P(SADx4Test, ShortRef) {
450 int tmp_stride = reference_stride_;
451 reference_stride_ >>= 1;
452 FillRandom(source_data_, source_stride_);
453 FillRandom(GetReference(0), reference_stride_);
454 FillRandom(GetReference(1), reference_stride_);
455 FillRandom(GetReference(2), reference_stride_);
456 FillRandom(GetReference(3), reference_stride_);
457 CheckSADs();
458 reference_stride_ = tmp_stride;
459 }
460
TEST_P(SADx4Test,UnalignedRef)461 TEST_P(SADx4Test, UnalignedRef) {
462 // The reference frame, but not the source frame, may be unaligned for
463 // certain types of searches.
464 int tmp_stride = reference_stride_;
465 reference_stride_ -= 1;
466 FillRandom(source_data_, source_stride_);
467 FillRandom(GetReference(0), reference_stride_);
468 FillRandom(GetReference(1), reference_stride_);
469 FillRandom(GetReference(2), reference_stride_);
470 FillRandom(GetReference(3), reference_stride_);
471 CheckSADs();
472 reference_stride_ = tmp_stride;
473 }
474
TEST_P(SADx4Test,ShortSrc)475 TEST_P(SADx4Test, ShortSrc) {
476 int tmp_stride = source_stride_;
477 source_stride_ >>= 1;
478 int test_count = 1000;
479 while (test_count > 0) {
480 FillRandom(source_data_, source_stride_);
481 FillRandom(GetReference(0), reference_stride_);
482 FillRandom(GetReference(1), reference_stride_);
483 FillRandom(GetReference(2), reference_stride_);
484 FillRandom(GetReference(3), reference_stride_);
485 CheckSADs();
486 test_count -= 1;
487 }
488 source_stride_ = tmp_stride;
489 }
490
TEST_P(SADx4Test,SrcAlignedByWidth)491 TEST_P(SADx4Test, SrcAlignedByWidth) {
492 uint8_t *tmp_source_data = source_data_;
493 source_data_ += width_;
494 FillRandom(source_data_, source_stride_);
495 FillRandom(GetReference(0), reference_stride_);
496 FillRandom(GetReference(1), reference_stride_);
497 FillRandom(GetReference(2), reference_stride_);
498 FillRandom(GetReference(3), reference_stride_);
499 CheckSADs();
500 source_data_ = tmp_source_data;
501 }
502
503 using std::tr1::make_tuple;
504
505 //------------------------------------------------------------------------------
506 // C functions
507 const SadMxNParam c_tests[] = {
508 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
509 make_tuple(128, 128, &aom_sad128x128_c, -1),
510 make_tuple(128, 64, &aom_sad128x64_c, -1),
511 make_tuple(64, 128, &aom_sad64x128_c, -1),
512 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
513 make_tuple(64, 64, &aom_sad64x64_c, -1),
514 make_tuple(64, 32, &aom_sad64x32_c, -1),
515 make_tuple(32, 64, &aom_sad32x64_c, -1),
516 make_tuple(32, 32, &aom_sad32x32_c, -1),
517 make_tuple(32, 16, &aom_sad32x16_c, -1),
518 make_tuple(16, 32, &aom_sad16x32_c, -1),
519 make_tuple(16, 16, &aom_sad16x16_c, -1),
520 make_tuple(16, 8, &aom_sad16x8_c, -1),
521 make_tuple(8, 16, &aom_sad8x16_c, -1),
522 make_tuple(8, 8, &aom_sad8x8_c, -1),
523 make_tuple(8, 4, &aom_sad8x4_c, -1),
524 make_tuple(4, 8, &aom_sad4x8_c, -1),
525 make_tuple(4, 4, &aom_sad4x4_c, -1),
526 #if CONFIG_HIGHBITDEPTH
527 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
528 make_tuple(128, 128, &aom_highbd_sad128x128_c, 8),
529 make_tuple(128, 64, &aom_highbd_sad128x64_c, 8),
530 make_tuple(64, 128, &aom_highbd_sad64x128_c, 8),
531 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
532 make_tuple(64, 64, &aom_highbd_sad64x64_c, 8),
533 make_tuple(64, 32, &aom_highbd_sad64x32_c, 8),
534 make_tuple(32, 64, &aom_highbd_sad32x64_c, 8),
535 make_tuple(32, 32, &aom_highbd_sad32x32_c, 8),
536 make_tuple(32, 16, &aom_highbd_sad32x16_c, 8),
537 make_tuple(16, 32, &aom_highbd_sad16x32_c, 8),
538 make_tuple(16, 16, &aom_highbd_sad16x16_c, 8),
539 make_tuple(16, 8, &aom_highbd_sad16x8_c, 8),
540 make_tuple(8, 16, &aom_highbd_sad8x16_c, 8),
541 make_tuple(8, 8, &aom_highbd_sad8x8_c, 8),
542 make_tuple(8, 4, &aom_highbd_sad8x4_c, 8),
543 make_tuple(4, 8, &aom_highbd_sad4x8_c, 8),
544 make_tuple(4, 4, &aom_highbd_sad4x4_c, 8),
545 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
546 make_tuple(128, 128, &aom_highbd_sad128x128_c, 10),
547 make_tuple(128, 64, &aom_highbd_sad128x64_c, 10),
548 make_tuple(64, 128, &aom_highbd_sad64x128_c, 10),
549 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
550 make_tuple(64, 64, &aom_highbd_sad64x64_c, 10),
551 make_tuple(64, 32, &aom_highbd_sad64x32_c, 10),
552 make_tuple(32, 64, &aom_highbd_sad32x64_c, 10),
553 make_tuple(32, 32, &aom_highbd_sad32x32_c, 10),
554 make_tuple(32, 16, &aom_highbd_sad32x16_c, 10),
555 make_tuple(16, 32, &aom_highbd_sad16x32_c, 10),
556 make_tuple(16, 16, &aom_highbd_sad16x16_c, 10),
557 make_tuple(16, 8, &aom_highbd_sad16x8_c, 10),
558 make_tuple(8, 16, &aom_highbd_sad8x16_c, 10),
559 make_tuple(8, 8, &aom_highbd_sad8x8_c, 10),
560 make_tuple(8, 4, &aom_highbd_sad8x4_c, 10),
561 make_tuple(4, 8, &aom_highbd_sad4x8_c, 10),
562 make_tuple(4, 4, &aom_highbd_sad4x4_c, 10),
563 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
564 make_tuple(128, 128, &aom_highbd_sad128x128_c, 12),
565 make_tuple(128, 64, &aom_highbd_sad128x64_c, 12),
566 make_tuple(64, 128, &aom_highbd_sad64x128_c, 12),
567 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
568 make_tuple(64, 64, &aom_highbd_sad64x64_c, 12),
569 make_tuple(64, 32, &aom_highbd_sad64x32_c, 12),
570 make_tuple(32, 64, &aom_highbd_sad32x64_c, 12),
571 make_tuple(32, 32, &aom_highbd_sad32x32_c, 12),
572 make_tuple(32, 16, &aom_highbd_sad32x16_c, 12),
573 make_tuple(16, 32, &aom_highbd_sad16x32_c, 12),
574 make_tuple(16, 16, &aom_highbd_sad16x16_c, 12),
575 make_tuple(16, 8, &aom_highbd_sad16x8_c, 12),
576 make_tuple(8, 16, &aom_highbd_sad8x16_c, 12),
577 make_tuple(8, 8, &aom_highbd_sad8x8_c, 12),
578 make_tuple(8, 4, &aom_highbd_sad8x4_c, 12),
579 make_tuple(4, 8, &aom_highbd_sad4x8_c, 12),
580 make_tuple(4, 4, &aom_highbd_sad4x4_c, 12),
581 #endif // CONFIG_HIGHBITDEPTH
582 };
583 INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
584
585 const SadMxNAvgParam avg_c_tests[] = {
586 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
587 make_tuple(128, 128, &aom_sad128x128_avg_c, -1),
588 make_tuple(128, 64, &aom_sad128x64_avg_c, -1),
589 make_tuple(64, 128, &aom_sad64x128_avg_c, -1),
590 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
591 make_tuple(64, 64, &aom_sad64x64_avg_c, -1),
592 make_tuple(64, 32, &aom_sad64x32_avg_c, -1),
593 make_tuple(32, 64, &aom_sad32x64_avg_c, -1),
594 make_tuple(32, 32, &aom_sad32x32_avg_c, -1),
595 make_tuple(32, 16, &aom_sad32x16_avg_c, -1),
596 make_tuple(16, 32, &aom_sad16x32_avg_c, -1),
597 make_tuple(16, 16, &aom_sad16x16_avg_c, -1),
598 make_tuple(16, 8, &aom_sad16x8_avg_c, -1),
599 make_tuple(8, 16, &aom_sad8x16_avg_c, -1),
600 make_tuple(8, 8, &aom_sad8x8_avg_c, -1),
601 make_tuple(8, 4, &aom_sad8x4_avg_c, -1),
602 make_tuple(4, 8, &aom_sad4x8_avg_c, -1),
603 make_tuple(4, 4, &aom_sad4x4_avg_c, -1),
604 #if CONFIG_HIGHBITDEPTH
605 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
606 make_tuple(128, 128, &aom_highbd_sad128x128_avg_c, 8),
607 make_tuple(128, 64, &aom_highbd_sad128x64_avg_c, 8),
608 make_tuple(64, 128, &aom_highbd_sad64x128_avg_c, 8),
609 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
610 make_tuple(64, 64, &aom_highbd_sad64x64_avg_c, 8),
611 make_tuple(64, 32, &aom_highbd_sad64x32_avg_c, 8),
612 make_tuple(32, 64, &aom_highbd_sad32x64_avg_c, 8),
613 make_tuple(32, 32, &aom_highbd_sad32x32_avg_c, 8),
614 make_tuple(32, 16, &aom_highbd_sad32x16_avg_c, 8),
615 make_tuple(16, 32, &aom_highbd_sad16x32_avg_c, 8),
616 make_tuple(16, 16, &aom_highbd_sad16x16_avg_c, 8),
617 make_tuple(16, 8, &aom_highbd_sad16x8_avg_c, 8),
618 make_tuple(8, 16, &aom_highbd_sad8x16_avg_c, 8),
619 make_tuple(8, 8, &aom_highbd_sad8x8_avg_c, 8),
620 make_tuple(8, 4, &aom_highbd_sad8x4_avg_c, 8),
621 make_tuple(4, 8, &aom_highbd_sad4x8_avg_c, 8),
622 make_tuple(4, 4, &aom_highbd_sad4x4_avg_c, 8),
623 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
624 make_tuple(128, 128, &aom_highbd_sad128x128_avg_c, 10),
625 make_tuple(128, 64, &aom_highbd_sad128x64_avg_c, 10),
626 make_tuple(64, 128, &aom_highbd_sad64x128_avg_c, 10),
627 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
628 make_tuple(64, 64, &aom_highbd_sad64x64_avg_c, 10),
629 make_tuple(64, 32, &aom_highbd_sad64x32_avg_c, 10),
630 make_tuple(32, 64, &aom_highbd_sad32x64_avg_c, 10),
631 make_tuple(32, 32, &aom_highbd_sad32x32_avg_c, 10),
632 make_tuple(32, 16, &aom_highbd_sad32x16_avg_c, 10),
633 make_tuple(16, 32, &aom_highbd_sad16x32_avg_c, 10),
634 make_tuple(16, 16, &aom_highbd_sad16x16_avg_c, 10),
635 make_tuple(16, 8, &aom_highbd_sad16x8_avg_c, 10),
636 make_tuple(8, 16, &aom_highbd_sad8x16_avg_c, 10),
637 make_tuple(8, 8, &aom_highbd_sad8x8_avg_c, 10),
638 make_tuple(8, 4, &aom_highbd_sad8x4_avg_c, 10),
639 make_tuple(4, 8, &aom_highbd_sad4x8_avg_c, 10),
640 make_tuple(4, 4, &aom_highbd_sad4x4_avg_c, 10),
641 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
642 make_tuple(128, 128, &aom_highbd_sad128x128_avg_c, 12),
643 make_tuple(128, 64, &aom_highbd_sad128x64_avg_c, 12),
644 make_tuple(64, 128, &aom_highbd_sad64x128_avg_c, 12),
645 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
646 make_tuple(64, 64, &aom_highbd_sad64x64_avg_c, 12),
647 make_tuple(64, 32, &aom_highbd_sad64x32_avg_c, 12),
648 make_tuple(32, 64, &aom_highbd_sad32x64_avg_c, 12),
649 make_tuple(32, 32, &aom_highbd_sad32x32_avg_c, 12),
650 make_tuple(32, 16, &aom_highbd_sad32x16_avg_c, 12),
651 make_tuple(16, 32, &aom_highbd_sad16x32_avg_c, 12),
652 make_tuple(16, 16, &aom_highbd_sad16x16_avg_c, 12),
653 make_tuple(16, 8, &aom_highbd_sad16x8_avg_c, 12),
654 make_tuple(8, 16, &aom_highbd_sad8x16_avg_c, 12),
655 make_tuple(8, 8, &aom_highbd_sad8x8_avg_c, 12),
656 make_tuple(8, 4, &aom_highbd_sad8x4_avg_c, 12),
657 make_tuple(4, 8, &aom_highbd_sad4x8_avg_c, 12),
658 make_tuple(4, 4, &aom_highbd_sad4x4_avg_c, 12),
659 #endif // CONFIG_HIGHBITDEPTH
660 };
661 INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
662
663 const SadMxNx4Param x4d_c_tests[] = {
664 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
665 make_tuple(128, 128, &aom_sad128x128x4d_c, -1),
666 make_tuple(128, 64, &aom_sad128x64x4d_c, -1),
667 make_tuple(64, 128, &aom_sad64x128x4d_c, -1),
668 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
669 make_tuple(64, 64, &aom_sad64x64x4d_c, -1),
670 make_tuple(64, 32, &aom_sad64x32x4d_c, -1),
671 make_tuple(32, 64, &aom_sad32x64x4d_c, -1),
672 make_tuple(32, 32, &aom_sad32x32x4d_c, -1),
673 make_tuple(32, 16, &aom_sad32x16x4d_c, -1),
674 make_tuple(16, 32, &aom_sad16x32x4d_c, -1),
675 make_tuple(16, 16, &aom_sad16x16x4d_c, -1),
676 make_tuple(16, 8, &aom_sad16x8x4d_c, -1),
677 make_tuple(8, 16, &aom_sad8x16x4d_c, -1),
678 make_tuple(8, 8, &aom_sad8x8x4d_c, -1),
679 make_tuple(8, 4, &aom_sad8x4x4d_c, -1),
680 make_tuple(4, 8, &aom_sad4x8x4d_c, -1),
681 make_tuple(4, 4, &aom_sad4x4x4d_c, -1),
682 #if CONFIG_HIGHBITDEPTH
683 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
684 make_tuple(128, 128, &aom_highbd_sad128x128x4d_c, 8),
685 make_tuple(128, 64, &aom_highbd_sad128x64x4d_c, 8),
686 make_tuple(64, 128, &aom_highbd_sad64x128x4d_c, 8),
687 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
688 make_tuple(64, 64, &aom_highbd_sad64x64x4d_c, 8),
689 make_tuple(64, 32, &aom_highbd_sad64x32x4d_c, 8),
690 make_tuple(32, 64, &aom_highbd_sad32x64x4d_c, 8),
691 make_tuple(32, 32, &aom_highbd_sad32x32x4d_c, 8),
692 make_tuple(32, 16, &aom_highbd_sad32x16x4d_c, 8),
693 make_tuple(16, 32, &aom_highbd_sad16x32x4d_c, 8),
694 make_tuple(16, 16, &aom_highbd_sad16x16x4d_c, 8),
695 make_tuple(16, 8, &aom_highbd_sad16x8x4d_c, 8),
696 make_tuple(8, 16, &aom_highbd_sad8x16x4d_c, 8),
697 make_tuple(8, 8, &aom_highbd_sad8x8x4d_c, 8),
698 make_tuple(8, 4, &aom_highbd_sad8x4x4d_c, 8),
699 make_tuple(4, 8, &aom_highbd_sad4x8x4d_c, 8),
700 make_tuple(4, 4, &aom_highbd_sad4x4x4d_c, 8),
701 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
702 make_tuple(128, 128, &aom_highbd_sad128x128x4d_c, 10),
703 make_tuple(128, 64, &aom_highbd_sad128x64x4d_c, 10),
704 make_tuple(64, 128, &aom_highbd_sad64x128x4d_c, 10),
705 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
706 make_tuple(64, 64, &aom_highbd_sad64x64x4d_c, 10),
707 make_tuple(64, 32, &aom_highbd_sad64x32x4d_c, 10),
708 make_tuple(32, 64, &aom_highbd_sad32x64x4d_c, 10),
709 make_tuple(32, 32, &aom_highbd_sad32x32x4d_c, 10),
710 make_tuple(32, 16, &aom_highbd_sad32x16x4d_c, 10),
711 make_tuple(16, 32, &aom_highbd_sad16x32x4d_c, 10),
712 make_tuple(16, 16, &aom_highbd_sad16x16x4d_c, 10),
713 make_tuple(16, 8, &aom_highbd_sad16x8x4d_c, 10),
714 make_tuple(8, 16, &aom_highbd_sad8x16x4d_c, 10),
715 make_tuple(8, 8, &aom_highbd_sad8x8x4d_c, 10),
716 make_tuple(8, 4, &aom_highbd_sad8x4x4d_c, 10),
717 make_tuple(4, 8, &aom_highbd_sad4x8x4d_c, 10),
718 make_tuple(4, 4, &aom_highbd_sad4x4x4d_c, 10),
719 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
720 make_tuple(128, 128, &aom_highbd_sad128x128x4d_c, 12),
721 make_tuple(128, 64, &aom_highbd_sad128x64x4d_c, 12),
722 make_tuple(64, 128, &aom_highbd_sad64x128x4d_c, 12),
723 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
724 make_tuple(64, 64, &aom_highbd_sad64x64x4d_c, 12),
725 make_tuple(64, 32, &aom_highbd_sad64x32x4d_c, 12),
726 make_tuple(32, 64, &aom_highbd_sad32x64x4d_c, 12),
727 make_tuple(32, 32, &aom_highbd_sad32x32x4d_c, 12),
728 make_tuple(32, 16, &aom_highbd_sad32x16x4d_c, 12),
729 make_tuple(16, 32, &aom_highbd_sad16x32x4d_c, 12),
730 make_tuple(16, 16, &aom_highbd_sad16x16x4d_c, 12),
731 make_tuple(16, 8, &aom_highbd_sad16x8x4d_c, 12),
732 make_tuple(8, 16, &aom_highbd_sad8x16x4d_c, 12),
733 make_tuple(8, 8, &aom_highbd_sad8x8x4d_c, 12),
734 make_tuple(8, 4, &aom_highbd_sad8x4x4d_c, 12),
735 make_tuple(4, 8, &aom_highbd_sad4x8x4d_c, 12),
736 make_tuple(4, 4, &aom_highbd_sad4x4x4d_c, 12),
737 #endif // CONFIG_HIGHBITDEPTH
738 };
739 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
740
741 //------------------------------------------------------------------------------
742 // ARM functions
743 #if HAVE_NEON
744 const SadMxNParam neon_tests[] = {
745 make_tuple(64, 64, &aom_sad64x64_neon, -1),
746 make_tuple(32, 32, &aom_sad32x32_neon, -1),
747 make_tuple(16, 16, &aom_sad16x16_neon, -1),
748 make_tuple(16, 8, &aom_sad16x8_neon, -1),
749 make_tuple(8, 16, &aom_sad8x16_neon, -1),
750 make_tuple(8, 8, &aom_sad8x8_neon, -1),
751 make_tuple(4, 4, &aom_sad4x4_neon, -1),
752 };
753 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
754
755 const SadMxNx4Param x4d_neon_tests[] = {
756 make_tuple(64, 64, &aom_sad64x64x4d_neon, -1),
757 make_tuple(32, 32, &aom_sad32x32x4d_neon, -1),
758 make_tuple(16, 16, &aom_sad16x16x4d_neon, -1),
759 };
760 INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
761 #endif // HAVE_NEON
762
763 //------------------------------------------------------------------------------
764 // x86 functions
765 #if HAVE_SSE2
766 const SadMxNParam sse2_tests[] = {
767 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
768 make_tuple(128, 128, &aom_sad128x128_sse2, -1),
769 make_tuple(128, 64, &aom_sad128x64_sse2, -1),
770 make_tuple(64, 128, &aom_sad64x128_sse2, -1),
771 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
772 make_tuple(64, 64, &aom_sad64x64_sse2, -1),
773 make_tuple(64, 32, &aom_sad64x32_sse2, -1),
774 make_tuple(32, 64, &aom_sad32x64_sse2, -1),
775 make_tuple(32, 32, &aom_sad32x32_sse2, -1),
776 make_tuple(32, 16, &aom_sad32x16_sse2, -1),
777 make_tuple(16, 32, &aom_sad16x32_sse2, -1),
778 make_tuple(16, 16, &aom_sad16x16_sse2, -1),
779 make_tuple(16, 8, &aom_sad16x8_sse2, -1),
780 make_tuple(8, 16, &aom_sad8x16_sse2, -1),
781 make_tuple(8, 8, &aom_sad8x8_sse2, -1),
782 make_tuple(8, 4, &aom_sad8x4_sse2, -1),
783 make_tuple(4, 8, &aom_sad4x8_sse2, -1),
784 make_tuple(4, 4, &aom_sad4x4_sse2, -1),
785 #if CONFIG_HIGHBITDEPTH
786 make_tuple(64, 64, &aom_highbd_sad64x64_sse2, 8),
787 make_tuple(64, 32, &aom_highbd_sad64x32_sse2, 8),
788 make_tuple(32, 64, &aom_highbd_sad32x64_sse2, 8),
789 make_tuple(32, 32, &aom_highbd_sad32x32_sse2, 8),
790 make_tuple(32, 16, &aom_highbd_sad32x16_sse2, 8),
791 make_tuple(16, 32, &aom_highbd_sad16x32_sse2, 8),
792 make_tuple(16, 16, &aom_highbd_sad16x16_sse2, 8),
793 make_tuple(16, 8, &aom_highbd_sad16x8_sse2, 8),
794 make_tuple(8, 16, &aom_highbd_sad8x16_sse2, 8),
795 make_tuple(8, 8, &aom_highbd_sad8x8_sse2, 8),
796 make_tuple(8, 4, &aom_highbd_sad8x4_sse2, 8),
797 make_tuple(64, 64, &aom_highbd_sad64x64_sse2, 10),
798 make_tuple(64, 32, &aom_highbd_sad64x32_sse2, 10),
799 make_tuple(32, 64, &aom_highbd_sad32x64_sse2, 10),
800 make_tuple(32, 32, &aom_highbd_sad32x32_sse2, 10),
801 make_tuple(32, 16, &aom_highbd_sad32x16_sse2, 10),
802 make_tuple(16, 32, &aom_highbd_sad16x32_sse2, 10),
803 make_tuple(16, 16, &aom_highbd_sad16x16_sse2, 10),
804 make_tuple(16, 8, &aom_highbd_sad16x8_sse2, 10),
805 make_tuple(8, 16, &aom_highbd_sad8x16_sse2, 10),
806 make_tuple(8, 8, &aom_highbd_sad8x8_sse2, 10),
807 make_tuple(8, 4, &aom_highbd_sad8x4_sse2, 10),
808 make_tuple(64, 64, &aom_highbd_sad64x64_sse2, 12),
809 make_tuple(64, 32, &aom_highbd_sad64x32_sse2, 12),
810 make_tuple(32, 64, &aom_highbd_sad32x64_sse2, 12),
811 make_tuple(32, 32, &aom_highbd_sad32x32_sse2, 12),
812 make_tuple(32, 16, &aom_highbd_sad32x16_sse2, 12),
813 make_tuple(16, 32, &aom_highbd_sad16x32_sse2, 12),
814 make_tuple(16, 16, &aom_highbd_sad16x16_sse2, 12),
815 make_tuple(16, 8, &aom_highbd_sad16x8_sse2, 12),
816 make_tuple(8, 16, &aom_highbd_sad8x16_sse2, 12),
817 make_tuple(8, 8, &aom_highbd_sad8x8_sse2, 12),
818 make_tuple(8, 4, &aom_highbd_sad8x4_sse2, 12),
819 #endif // CONFIG_HIGHBITDEPTH
820 };
821 INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
822
823 const SadMxNAvgParam avg_sse2_tests[] = {
824 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
825 make_tuple(128, 128, &aom_sad128x128_avg_sse2, -1),
826 make_tuple(128, 64, &aom_sad128x64_avg_sse2, -1),
827 make_tuple(64, 128, &aom_sad64x128_avg_sse2, -1),
828 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
829 make_tuple(64, 64, &aom_sad64x64_avg_sse2, -1),
830 make_tuple(64, 32, &aom_sad64x32_avg_sse2, -1),
831 make_tuple(32, 64, &aom_sad32x64_avg_sse2, -1),
832 make_tuple(32, 32, &aom_sad32x32_avg_sse2, -1),
833 make_tuple(32, 16, &aom_sad32x16_avg_sse2, -1),
834 make_tuple(16, 32, &aom_sad16x32_avg_sse2, -1),
835 make_tuple(16, 16, &aom_sad16x16_avg_sse2, -1),
836 make_tuple(16, 8, &aom_sad16x8_avg_sse2, -1),
837 make_tuple(8, 16, &aom_sad8x16_avg_sse2, -1),
838 make_tuple(8, 8, &aom_sad8x8_avg_sse2, -1),
839 make_tuple(8, 4, &aom_sad8x4_avg_sse2, -1),
840 make_tuple(4, 8, &aom_sad4x8_avg_sse2, -1),
841 make_tuple(4, 4, &aom_sad4x4_avg_sse2, -1),
842 #if CONFIG_HIGHBITDEPTH
843 make_tuple(64, 64, &aom_highbd_sad64x64_avg_sse2, 8),
844 make_tuple(64, 32, &aom_highbd_sad64x32_avg_sse2, 8),
845 make_tuple(32, 64, &aom_highbd_sad32x64_avg_sse2, 8),
846 make_tuple(32, 32, &aom_highbd_sad32x32_avg_sse2, 8),
847 make_tuple(32, 16, &aom_highbd_sad32x16_avg_sse2, 8),
848 make_tuple(16, 32, &aom_highbd_sad16x32_avg_sse2, 8),
849 make_tuple(16, 16, &aom_highbd_sad16x16_avg_sse2, 8),
850 make_tuple(16, 8, &aom_highbd_sad16x8_avg_sse2, 8),
851 make_tuple(8, 16, &aom_highbd_sad8x16_avg_sse2, 8),
852 make_tuple(8, 8, &aom_highbd_sad8x8_avg_sse2, 8),
853 make_tuple(8, 4, &aom_highbd_sad8x4_avg_sse2, 8),
854 make_tuple(64, 64, &aom_highbd_sad64x64_avg_sse2, 10),
855 make_tuple(64, 32, &aom_highbd_sad64x32_avg_sse2, 10),
856 make_tuple(32, 64, &aom_highbd_sad32x64_avg_sse2, 10),
857 make_tuple(32, 32, &aom_highbd_sad32x32_avg_sse2, 10),
858 make_tuple(32, 16, &aom_highbd_sad32x16_avg_sse2, 10),
859 make_tuple(16, 32, &aom_highbd_sad16x32_avg_sse2, 10),
860 make_tuple(16, 16, &aom_highbd_sad16x16_avg_sse2, 10),
861 make_tuple(16, 8, &aom_highbd_sad16x8_avg_sse2, 10),
862 make_tuple(8, 16, &aom_highbd_sad8x16_avg_sse2, 10),
863 make_tuple(8, 8, &aom_highbd_sad8x8_avg_sse2, 10),
864 make_tuple(8, 4, &aom_highbd_sad8x4_avg_sse2, 10),
865 make_tuple(64, 64, &aom_highbd_sad64x64_avg_sse2, 12),
866 make_tuple(64, 32, &aom_highbd_sad64x32_avg_sse2, 12),
867 make_tuple(32, 64, &aom_highbd_sad32x64_avg_sse2, 12),
868 make_tuple(32, 32, &aom_highbd_sad32x32_avg_sse2, 12),
869 make_tuple(32, 16, &aom_highbd_sad32x16_avg_sse2, 12),
870 make_tuple(16, 32, &aom_highbd_sad16x32_avg_sse2, 12),
871 make_tuple(16, 16, &aom_highbd_sad16x16_avg_sse2, 12),
872 make_tuple(16, 8, &aom_highbd_sad16x8_avg_sse2, 12),
873 make_tuple(8, 16, &aom_highbd_sad8x16_avg_sse2, 12),
874 make_tuple(8, 8, &aom_highbd_sad8x8_avg_sse2, 12),
875 make_tuple(8, 4, &aom_highbd_sad8x4_avg_sse2, 12),
876 #endif // CONFIG_HIGHBITDEPTH
877 };
878 INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
879
880 const SadMxNx4Param x4d_sse2_tests[] = {
881 #if CONFIG_AV1 && CONFIG_EXT_PARTITION
882 make_tuple(128, 128, &aom_sad128x128x4d_sse2, -1),
883 make_tuple(128, 64, &aom_sad128x64x4d_sse2, -1),
884 make_tuple(64, 128, &aom_sad64x128x4d_sse2, -1),
885 #endif // CONFIG_AV1 && CONFIG_EXT_PARTITION
886 make_tuple(64, 64, &aom_sad64x64x4d_sse2, -1),
887 make_tuple(64, 32, &aom_sad64x32x4d_sse2, -1),
888 make_tuple(32, 64, &aom_sad32x64x4d_sse2, -1),
889 make_tuple(32, 32, &aom_sad32x32x4d_sse2, -1),
890 make_tuple(32, 16, &aom_sad32x16x4d_sse2, -1),
891 make_tuple(16, 32, &aom_sad16x32x4d_sse2, -1),
892 make_tuple(16, 16, &aom_sad16x16x4d_sse2, -1),
893 make_tuple(16, 8, &aom_sad16x8x4d_sse2, -1),
894 make_tuple(8, 16, &aom_sad8x16x4d_sse2, -1),
895 make_tuple(8, 8, &aom_sad8x8x4d_sse2, -1),
896 make_tuple(8, 4, &aom_sad8x4x4d_sse2, -1),
897 make_tuple(4, 8, &aom_sad4x8x4d_sse2, -1),
898 make_tuple(4, 4, &aom_sad4x4x4d_sse2, -1),
899 #if CONFIG_HIGHBITDEPTH
900 make_tuple(64, 64, &aom_highbd_sad64x64x4d_sse2, 8),
901 make_tuple(64, 32, &aom_highbd_sad64x32x4d_sse2, 8),
902 make_tuple(32, 64, &aom_highbd_sad32x64x4d_sse2, 8),
903 make_tuple(32, 32, &aom_highbd_sad32x32x4d_sse2, 8),
904 make_tuple(32, 16, &aom_highbd_sad32x16x4d_sse2, 8),
905 make_tuple(16, 32, &aom_highbd_sad16x32x4d_sse2, 8),
906 make_tuple(16, 16, &aom_highbd_sad16x16x4d_sse2, 8),
907 make_tuple(16, 8, &aom_highbd_sad16x8x4d_sse2, 8),
908 make_tuple(8, 16, &aom_highbd_sad8x16x4d_sse2, 8),
909 make_tuple(8, 8, &aom_highbd_sad8x8x4d_sse2, 8),
910 make_tuple(8, 4, &aom_highbd_sad8x4x4d_sse2, 8),
911 make_tuple(4, 8, &aom_highbd_sad4x8x4d_sse2, 8),
912 make_tuple(4, 4, &aom_highbd_sad4x4x4d_sse2, 8),
913 make_tuple(64, 64, &aom_highbd_sad64x64x4d_sse2, 10),
914 make_tuple(64, 32, &aom_highbd_sad64x32x4d_sse2, 10),
915 make_tuple(32, 64, &aom_highbd_sad32x64x4d_sse2, 10),
916 make_tuple(32, 32, &aom_highbd_sad32x32x4d_sse2, 10),
917 make_tuple(32, 16, &aom_highbd_sad32x16x4d_sse2, 10),
918 make_tuple(16, 32, &aom_highbd_sad16x32x4d_sse2, 10),
919 make_tuple(16, 16, &aom_highbd_sad16x16x4d_sse2, 10),
920 make_tuple(16, 8, &aom_highbd_sad16x8x4d_sse2, 10),
921 make_tuple(8, 16, &aom_highbd_sad8x16x4d_sse2, 10),
922 make_tuple(8, 8, &aom_highbd_sad8x8x4d_sse2, 10),
923 make_tuple(8, 4, &aom_highbd_sad8x4x4d_sse2, 10),
924 make_tuple(4, 8, &aom_highbd_sad4x8x4d_sse2, 10),
925 make_tuple(4, 4, &aom_highbd_sad4x4x4d_sse2, 10),
926 make_tuple(64, 64, &aom_highbd_sad64x64x4d_sse2, 12),
927 make_tuple(64, 32, &aom_highbd_sad64x32x4d_sse2, 12),
928 make_tuple(32, 64, &aom_highbd_sad32x64x4d_sse2, 12),
929 make_tuple(32, 32, &aom_highbd_sad32x32x4d_sse2, 12),
930 make_tuple(32, 16, &aom_highbd_sad32x16x4d_sse2, 12),
931 make_tuple(16, 32, &aom_highbd_sad16x32x4d_sse2, 12),
932 make_tuple(16, 16, &aom_highbd_sad16x16x4d_sse2, 12),
933 make_tuple(16, 8, &aom_highbd_sad16x8x4d_sse2, 12),
934 make_tuple(8, 16, &aom_highbd_sad8x16x4d_sse2, 12),
935 make_tuple(8, 8, &aom_highbd_sad8x8x4d_sse2, 12),
936 make_tuple(8, 4, &aom_highbd_sad8x4x4d_sse2, 12),
937 make_tuple(4, 8, &aom_highbd_sad4x8x4d_sse2, 12),
938 make_tuple(4, 4, &aom_highbd_sad4x4x4d_sse2, 12),
939 #endif // CONFIG_HIGHBITDEPTH
940 };
941 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
942 #endif // HAVE_SSE2
943
944 #if HAVE_SSE3
945 // Only functions are x3, which do not have tests.
946 #endif // HAVE_SSE3
947
948 #if HAVE_SSSE3
949 // Only functions are x3, which do not have tests.
950 #endif // HAVE_SSSE3
951
952 #if HAVE_SSE4_1
953 // Only functions are x8, which do not have tests.
954 #endif // HAVE_SSE4_1
955
956 #if HAVE_AVX2
957 const SadMxNParam avx2_tests[] = {
958 #if CONFIG_EXT_PARTITION
959 make_tuple(64, 128, &aom_sad64x128_avx2, -1),
960 make_tuple(128, 64, &aom_sad128x64_avx2, -1),
961 make_tuple(128, 128, &aom_sad128x128_avx2, -1),
962 #endif
963 make_tuple(64, 64, &aom_sad64x64_avx2, -1),
964 make_tuple(64, 32, &aom_sad64x32_avx2, -1),
965 make_tuple(32, 64, &aom_sad32x64_avx2, -1),
966 make_tuple(32, 32, &aom_sad32x32_avx2, -1),
967 make_tuple(32, 16, &aom_sad32x16_avx2, -1),
968 #if CONFIG_HIGHBITDEPTH
969 #if CONFIG_EXT_PARTITION
970 make_tuple(128, 128, &aom_highbd_sad128x128_avx2, 8),
971 make_tuple(128, 128, &aom_highbd_sad128x128_avx2, 10),
972 make_tuple(128, 128, &aom_highbd_sad128x128_avx2, 12),
973 make_tuple(128, 64, &aom_highbd_sad128x64_avx2, 8),
974 make_tuple(128, 64, &aom_highbd_sad128x64_avx2, 10),
975 make_tuple(128, 64, &aom_highbd_sad128x64_avx2, 12),
976 make_tuple(64, 128, &aom_highbd_sad64x128_avx2, 8),
977 make_tuple(64, 128, &aom_highbd_sad64x128_avx2, 10),
978 make_tuple(64, 128, &aom_highbd_sad64x128_avx2, 12),
979 #endif
980 make_tuple(64, 64, &aom_highbd_sad64x64_avx2, 8),
981 make_tuple(64, 64, &aom_highbd_sad64x64_avx2, 10),
982 make_tuple(64, 64, &aom_highbd_sad64x64_avx2, 12),
983 make_tuple(64, 32, &aom_highbd_sad64x32_avx2, 8),
984 make_tuple(64, 32, &aom_highbd_sad64x32_avx2, 10),
985 make_tuple(64, 32, &aom_highbd_sad64x32_avx2, 12),
986 make_tuple(32, 64, &aom_highbd_sad32x64_avx2, 8),
987 make_tuple(32, 64, &aom_highbd_sad32x64_avx2, 10),
988 make_tuple(32, 64, &aom_highbd_sad32x64_avx2, 12),
989 make_tuple(32, 32, &aom_highbd_sad32x32_avx2, 8),
990 make_tuple(32, 32, &aom_highbd_sad32x32_avx2, 10),
991 make_tuple(32, 32, &aom_highbd_sad32x32_avx2, 12),
992 make_tuple(32, 16, &aom_highbd_sad32x16_avx2, 8),
993 make_tuple(32, 16, &aom_highbd_sad32x16_avx2, 10),
994 make_tuple(32, 16, &aom_highbd_sad32x16_avx2, 12),
995 make_tuple(16, 32, &aom_highbd_sad16x32_avx2, 8),
996 make_tuple(16, 32, &aom_highbd_sad16x32_avx2, 10),
997 make_tuple(16, 32, &aom_highbd_sad16x32_avx2, 12),
998 make_tuple(16, 16, &aom_highbd_sad16x16_avx2, 8),
999 make_tuple(16, 16, &aom_highbd_sad16x16_avx2, 10),
1000 make_tuple(16, 16, &aom_highbd_sad16x16_avx2, 12),
1001 make_tuple(16, 8, &aom_highbd_sad16x8_avx2, 8),
1002 make_tuple(16, 8, &aom_highbd_sad16x8_avx2, 10),
1003 make_tuple(16, 8, &aom_highbd_sad16x8_avx2, 12),
1004 #endif
1005 };
1006 INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
1007
1008 const SadMxNAvgParam avg_avx2_tests[] = {
1009 #if CONFIG_EXT_PARTITION
1010 make_tuple(64, 128, &aom_sad64x128_avg_avx2, -1),
1011 make_tuple(128, 64, &aom_sad128x64_avg_avx2, -1),
1012 make_tuple(128, 128, &aom_sad128x128_avg_avx2, -1),
1013 #endif
1014 make_tuple(64, 64, &aom_sad64x64_avg_avx2, -1),
1015 make_tuple(64, 32, &aom_sad64x32_avg_avx2, -1),
1016 make_tuple(32, 64, &aom_sad32x64_avg_avx2, -1),
1017 make_tuple(32, 32, &aom_sad32x32_avg_avx2, -1),
1018 make_tuple(32, 16, &aom_sad32x16_avg_avx2, -1),
1019 #if CONFIG_HIGHBITDEPTH
1020 #if CONFIG_EXT_PARTITION
1021 make_tuple(128, 128, &aom_highbd_sad128x128_avg_avx2, 8),
1022 make_tuple(128, 128, &aom_highbd_sad128x128_avg_avx2, 10),
1023 make_tuple(128, 128, &aom_highbd_sad128x128_avg_avx2, 12),
1024 make_tuple(128, 64, &aom_highbd_sad128x64_avg_avx2, 8),
1025 make_tuple(128, 64, &aom_highbd_sad128x64_avg_avx2, 10),
1026 make_tuple(128, 64, &aom_highbd_sad128x64_avg_avx2, 12),
1027 make_tuple(64, 128, &aom_highbd_sad64x128_avg_avx2, 8),
1028 make_tuple(64, 128, &aom_highbd_sad64x128_avg_avx2, 10),
1029 make_tuple(64, 128, &aom_highbd_sad64x128_avg_avx2, 12),
1030 #endif
1031 make_tuple(64, 64, &aom_highbd_sad64x64_avg_avx2, 8),
1032 make_tuple(64, 64, &aom_highbd_sad64x64_avg_avx2, 10),
1033 make_tuple(64, 64, &aom_highbd_sad64x64_avg_avx2, 12),
1034 make_tuple(64, 32, &aom_highbd_sad64x32_avg_avx2, 8),
1035 make_tuple(64, 32, &aom_highbd_sad64x32_avg_avx2, 10),
1036 make_tuple(64, 32, &aom_highbd_sad64x32_avg_avx2, 12),
1037 make_tuple(32, 64, &aom_highbd_sad32x64_avg_avx2, 8),
1038 make_tuple(32, 64, &aom_highbd_sad32x64_avg_avx2, 10),
1039 make_tuple(32, 64, &aom_highbd_sad32x64_avg_avx2, 12),
1040 make_tuple(32, 32, &aom_highbd_sad32x32_avg_avx2, 8),
1041 make_tuple(32, 32, &aom_highbd_sad32x32_avg_avx2, 10),
1042 make_tuple(32, 32, &aom_highbd_sad32x32_avg_avx2, 12),
1043 make_tuple(32, 16, &aom_highbd_sad32x16_avg_avx2, 8),
1044 make_tuple(32, 16, &aom_highbd_sad32x16_avg_avx2, 10),
1045 make_tuple(32, 16, &aom_highbd_sad32x16_avg_avx2, 12),
1046 make_tuple(16, 32, &aom_highbd_sad16x32_avg_avx2, 8),
1047 make_tuple(16, 32, &aom_highbd_sad16x32_avg_avx2, 10),
1048 make_tuple(16, 32, &aom_highbd_sad16x32_avg_avx2, 12),
1049 make_tuple(16, 16, &aom_highbd_sad16x16_avg_avx2, 8),
1050 make_tuple(16, 16, &aom_highbd_sad16x16_avg_avx2, 10),
1051 make_tuple(16, 16, &aom_highbd_sad16x16_avg_avx2, 12),
1052 make_tuple(16, 8, &aom_highbd_sad16x8_avg_avx2, 8),
1053 make_tuple(16, 8, &aom_highbd_sad16x8_avg_avx2, 10),
1054 make_tuple(16, 8, &aom_highbd_sad16x8_avg_avx2, 12),
1055 #endif
1056 };
1057 INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
1058
1059 const SadMxNx4Param x4d_avx2_tests[] = {
1060 #if CONFIG_EXT_PARTITION
1061 make_tuple(64, 128, &aom_sad64x128x4d_avx2, -1),
1062 make_tuple(128, 64, &aom_sad128x64x4d_avx2, -1),
1063 make_tuple(128, 128, &aom_sad128x128x4d_avx2, -1),
1064 #endif
1065 make_tuple(64, 64, &aom_sad64x64x4d_avx2, -1),
1066 make_tuple(32, 64, &aom_sad32x64x4d_avx2, -1),
1067 make_tuple(64, 32, &aom_sad64x32x4d_avx2, -1),
1068 make_tuple(32, 32, &aom_sad32x32x4d_avx2, -1),
1069 #if CONFIG_HIGHBITDEPTH
1070 #if CONFIG_EXT_PARTITION
1071 make_tuple(128, 128, &aom_highbd_sad128x128x4d_avx2, 8),
1072 make_tuple(128, 128, &aom_highbd_sad128x128x4d_avx2, 10),
1073 make_tuple(128, 128, &aom_highbd_sad128x128x4d_avx2, 12),
1074 make_tuple(128, 64, &aom_highbd_sad128x64x4d_avx2, 8),
1075 make_tuple(128, 64, &aom_highbd_sad128x64x4d_avx2, 10),
1076 make_tuple(128, 64, &aom_highbd_sad128x64x4d_avx2, 12),
1077 make_tuple(64, 128, &aom_highbd_sad64x128x4d_avx2, 8),
1078 make_tuple(64, 128, &aom_highbd_sad64x128x4d_avx2, 10),
1079 make_tuple(64, 128, &aom_highbd_sad64x128x4d_avx2, 12),
1080 #endif
1081 make_tuple(64, 64, &aom_highbd_sad64x64x4d_avx2, 8),
1082 make_tuple(64, 64, &aom_highbd_sad64x64x4d_avx2, 10),
1083 make_tuple(64, 64, &aom_highbd_sad64x64x4d_avx2, 12),
1084 make_tuple(64, 32, &aom_highbd_sad64x32x4d_avx2, 8),
1085 make_tuple(64, 32, &aom_highbd_sad64x32x4d_avx2, 10),
1086 make_tuple(64, 32, &aom_highbd_sad64x32x4d_avx2, 12),
1087 make_tuple(32, 64, &aom_highbd_sad32x64x4d_avx2, 8),
1088 make_tuple(32, 64, &aom_highbd_sad32x64x4d_avx2, 10),
1089 make_tuple(32, 64, &aom_highbd_sad32x64x4d_avx2, 12),
1090 make_tuple(32, 32, &aom_highbd_sad32x32x4d_avx2, 8),
1091 make_tuple(32, 32, &aom_highbd_sad32x32x4d_avx2, 10),
1092 make_tuple(32, 32, &aom_highbd_sad32x32x4d_avx2, 12),
1093 make_tuple(32, 16, &aom_highbd_sad32x16x4d_avx2, 8),
1094 make_tuple(32, 16, &aom_highbd_sad32x16x4d_avx2, 10),
1095 make_tuple(32, 16, &aom_highbd_sad32x16x4d_avx2, 12),
1096 make_tuple(16, 32, &aom_highbd_sad16x32x4d_avx2, 8),
1097 make_tuple(16, 32, &aom_highbd_sad16x32x4d_avx2, 10),
1098 make_tuple(16, 32, &aom_highbd_sad16x32x4d_avx2, 12),
1099 make_tuple(16, 16, &aom_highbd_sad16x16x4d_avx2, 8),
1100 make_tuple(16, 16, &aom_highbd_sad16x16x4d_avx2, 10),
1101 make_tuple(16, 16, &aom_highbd_sad16x16x4d_avx2, 12),
1102 make_tuple(16, 8, &aom_highbd_sad16x8x4d_avx2, 8),
1103 make_tuple(16, 8, &aom_highbd_sad16x8x4d_avx2, 10),
1104 make_tuple(16, 8, &aom_highbd_sad16x8x4d_avx2, 12),
1105 #endif
1106 };
1107 INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
1108 #endif // HAVE_AVX2
1109
1110 //------------------------------------------------------------------------------
1111 // MIPS functions
1112 #if HAVE_MSA
1113 const SadMxNParam msa_tests[] = {
1114 make_tuple(64, 64, &aom_sad64x64_msa, -1),
1115 make_tuple(64, 32, &aom_sad64x32_msa, -1),
1116 make_tuple(32, 64, &aom_sad32x64_msa, -1),
1117 make_tuple(32, 32, &aom_sad32x32_msa, -1),
1118 make_tuple(32, 16, &aom_sad32x16_msa, -1),
1119 make_tuple(16, 32, &aom_sad16x32_msa, -1),
1120 make_tuple(16, 16, &aom_sad16x16_msa, -1),
1121 make_tuple(16, 8, &aom_sad16x8_msa, -1),
1122 make_tuple(8, 16, &aom_sad8x16_msa, -1),
1123 make_tuple(8, 8, &aom_sad8x8_msa, -1),
1124 make_tuple(8, 4, &aom_sad8x4_msa, -1),
1125 make_tuple(4, 8, &aom_sad4x8_msa, -1),
1126 make_tuple(4, 4, &aom_sad4x4_msa, -1),
1127 };
1128 INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
1129
1130 const SadMxNAvgParam avg_msa_tests[] = {
1131 make_tuple(64, 64, &aom_sad64x64_avg_msa, -1),
1132 make_tuple(64, 32, &aom_sad64x32_avg_msa, -1),
1133 make_tuple(32, 64, &aom_sad32x64_avg_msa, -1),
1134 make_tuple(32, 32, &aom_sad32x32_avg_msa, -1),
1135 make_tuple(32, 16, &aom_sad32x16_avg_msa, -1),
1136 make_tuple(16, 32, &aom_sad16x32_avg_msa, -1),
1137 make_tuple(16, 16, &aom_sad16x16_avg_msa, -1),
1138 make_tuple(16, 8, &aom_sad16x8_avg_msa, -1),
1139 make_tuple(8, 16, &aom_sad8x16_avg_msa, -1),
1140 make_tuple(8, 8, &aom_sad8x8_avg_msa, -1),
1141 make_tuple(8, 4, &aom_sad8x4_avg_msa, -1),
1142 make_tuple(4, 8, &aom_sad4x8_avg_msa, -1),
1143 make_tuple(4, 4, &aom_sad4x4_avg_msa, -1),
1144 };
1145 INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
1146
1147 const SadMxNx4Param x4d_msa_tests[] = {
1148 make_tuple(64, 64, &aom_sad64x64x4d_msa, -1),
1149 make_tuple(64, 32, &aom_sad64x32x4d_msa, -1),
1150 make_tuple(32, 64, &aom_sad32x64x4d_msa, -1),
1151 make_tuple(32, 32, &aom_sad32x32x4d_msa, -1),
1152 make_tuple(32, 16, &aom_sad32x16x4d_msa, -1),
1153 make_tuple(16, 32, &aom_sad16x32x4d_msa, -1),
1154 make_tuple(16, 16, &aom_sad16x16x4d_msa, -1),
1155 make_tuple(16, 8, &aom_sad16x8x4d_msa, -1),
1156 make_tuple(8, 16, &aom_sad8x16x4d_msa, -1),
1157 make_tuple(8, 8, &aom_sad8x8x4d_msa, -1),
1158 make_tuple(8, 4, &aom_sad8x4x4d_msa, -1),
1159 make_tuple(4, 8, &aom_sad4x8x4d_msa, -1),
1160 make_tuple(4, 4, &aom_sad4x4x4d_msa, -1),
1161 };
1162 INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
1163 #endif // HAVE_MSA
1164
1165 } // namespace
1166