2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
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.
16 #include "./vpx_config.h"
17 #include "./vpx_dsp_rtcd.h"
18 #include "vpx_mem/vpx_mem.h"
19 #include "vpx_ports/mem.h"
21 #include "test/acm_random.h"
22 #include "test/clear_system_state.h"
23 #include "test/register_state_check.h"
24 #include "test/util.h"
25 #include "third_party/googletest/src/include/gtest/gtest.h"
26 #include "vpx/vpx_codec.h"
29 typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr,
31 const uint8_t *ref_ptr,
33 typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
35 typedef uint32_t (*SadMxNAvgFunc)(const uint8_t *src_ptr,
37 const uint8_t *ref_ptr,
39 const uint8_t *second_pred);
40 typedef std::tr1::tuple<int, int, SadMxNAvgFunc, int> SadMxNAvgParam;
42 typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
44 const uint8_t *const ref_ptr[],
47 typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
49 using libvpx_test::ACMRandom;
52 class SADTestBase : public ::testing::Test {
54 SADTestBase(int width, int height, int bit_depth) :
55 width_(width), height_(height), bd_(bit_depth) {}
57 static void SetUpTestCase() {
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_ = reinterpret_cast<uint8_t*>(
63 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)));
72 static void TearDownTestCase() {
73 vpx_free(source_data8_);
75 vpx_free(reference_data8_);
76 reference_data8_ = NULL;
77 vpx_free(second_pred8_);
79 vpx_free(source_data16_);
80 source_data16_ = NULL;
81 vpx_free(reference_data16_);
82 reference_data16_ = NULL;
83 vpx_free(second_pred16_);
84 second_pred16_ = NULL;
87 virtual void TearDown() {
88 libvpx_test::ClearSystemState();
92 // Handle blocks up to 4 blocks 64x64 with stride up to 128
93 static const int kDataAlignment = 16;
94 static const int kDataBlockSize = 64 * 128;
95 static const int kDataBufferSize = 4 * kDataBlockSize;
97 virtual void SetUp() {
99 use_high_bit_depth_ = false;
100 bit_depth_ = VPX_BITS_8;
101 source_data_ = source_data8_;
102 reference_data_ = reference_data8_;
103 second_pred_ = second_pred8_;
104 #if CONFIG_VP9_HIGHBITDEPTH
106 use_high_bit_depth_ = true;
107 bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
108 source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
109 reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
110 second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
111 #endif // CONFIG_VP9_HIGHBITDEPTH
113 mask_ = (1 << bit_depth_) - 1;
114 source_stride_ = (width_ + 31) & ~31;
115 reference_stride_ = width_ * 2;
116 rnd_.Reset(ACMRandom::DeterministicSeed());
119 virtual uint8_t *GetReference(int block_idx) {
120 #if CONFIG_VP9_HIGHBITDEPTH
121 if (use_high_bit_depth_)
122 return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
123 block_idx * kDataBlockSize);
124 #endif // CONFIG_VP9_HIGHBITDEPTH
125 return reference_data_ + block_idx * kDataBlockSize;
128 // Sum of Absolute Differences. Given two blocks, calculate the absolute
129 // difference between two pixels in the same relative location; accumulate.
130 unsigned int ReferenceSAD(int block_idx) {
131 unsigned int sad = 0;
132 const uint8_t *const reference8 = GetReference(block_idx);
133 const uint8_t *const source8 = source_data_;
134 #if CONFIG_VP9_HIGHBITDEPTH
135 const uint16_t *const reference16 =
136 CONVERT_TO_SHORTPTR(GetReference(block_idx));
137 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
138 #endif // CONFIG_VP9_HIGHBITDEPTH
139 for (int h = 0; h < height_; ++h) {
140 for (int w = 0; w < width_; ++w) {
141 if (!use_high_bit_depth_) {
142 sad += abs(source8[h * source_stride_ + w] -
143 reference8[h * reference_stride_ + w]);
144 #if CONFIG_VP9_HIGHBITDEPTH
146 sad += abs(source16[h * source_stride_ + w] -
147 reference16[h * reference_stride_ + w]);
148 #endif // CONFIG_VP9_HIGHBITDEPTH
155 // Sum of Absolute Differences Average. Given two blocks, and a prediction
156 // calculate the absolute difference between one pixel and average of the
157 // corresponding and predicted pixels; accumulate.
158 unsigned int ReferenceSADavg(int block_idx) {
159 unsigned int sad = 0;
160 const uint8_t *const reference8 = GetReference(block_idx);
161 const uint8_t *const source8 = source_data_;
162 const uint8_t *const second_pred8 = second_pred_;
163 #if CONFIG_VP9_HIGHBITDEPTH
164 const uint16_t *const reference16 =
165 CONVERT_TO_SHORTPTR(GetReference(block_idx));
166 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
167 const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
168 #endif // CONFIG_VP9_HIGHBITDEPTH
169 for (int h = 0; h < height_; ++h) {
170 for (int w = 0; w < width_; ++w) {
171 if (!use_high_bit_depth_) {
172 const int tmp = second_pred8[h * width_ + w] +
173 reference8[h * reference_stride_ + w];
174 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
175 sad += abs(source8[h * source_stride_ + w] - comp_pred);
176 #if CONFIG_VP9_HIGHBITDEPTH
178 const int tmp = second_pred16[h * width_ + w] +
179 reference16[h * reference_stride_ + w];
180 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
181 sad += abs(source16[h * source_stride_ + w] - comp_pred);
182 #endif // CONFIG_VP9_HIGHBITDEPTH
189 void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
190 uint8_t *data8 = data;
191 #if CONFIG_VP9_HIGHBITDEPTH
192 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
193 #endif // CONFIG_VP9_HIGHBITDEPTH
194 for (int h = 0; h < height_; ++h) {
195 for (int w = 0; w < width_; ++w) {
196 if (!use_high_bit_depth_) {
197 data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
198 #if CONFIG_VP9_HIGHBITDEPTH
200 data16[h * stride + w] = fill_constant;
201 #endif // CONFIG_VP9_HIGHBITDEPTH
207 void FillRandom(uint8_t *data, int stride) {
208 uint8_t *data8 = data;
209 #if CONFIG_VP9_HIGHBITDEPTH
210 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
211 #endif // CONFIG_VP9_HIGHBITDEPTH
212 for (int h = 0; h < height_; ++h) {
213 for (int w = 0; w < width_; ++w) {
214 if (!use_high_bit_depth_) {
215 data8[h * stride + w] = rnd_.Rand8();
216 #if CONFIG_VP9_HIGHBITDEPTH
218 data16[h * stride + w] = rnd_.Rand16() & mask_;
219 #endif // CONFIG_VP9_HIGHBITDEPTH
225 int width_, height_, mask_, bd_;
226 vpx_bit_depth_t bit_depth_;
227 static uint8_t *source_data_;
228 static uint8_t *reference_data_;
229 static uint8_t *second_pred_;
231 bool use_high_bit_depth_;
232 static uint8_t *source_data8_;
233 static uint8_t *reference_data8_;
234 static uint8_t *second_pred8_;
235 static uint16_t *source_data16_;
236 static uint16_t *reference_data16_;
237 static uint16_t *second_pred16_;
238 int reference_stride_;
244 : public SADTestBase,
245 public ::testing::WithParamInterface<SadMxNx4Param> {
247 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
250 void SADs(unsigned int *results) {
251 const uint8_t *references[] = {GetReference(0), GetReference(1),
252 GetReference(2), GetReference(3)};
254 ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
255 references, reference_stride_,
260 unsigned int reference_sad, exp_sad[4];
263 for (int block = 0; block < 4; ++block) {
264 reference_sad = ReferenceSAD(block);
266 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
272 : public SADTestBase,
273 public ::testing::WithParamInterface<SadMxNParam> {
275 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
278 unsigned int SAD(int block_idx) {
280 const uint8_t *const reference = GetReference(block_idx);
282 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
283 reference, reference_stride_));
288 const unsigned int reference_sad = ReferenceSAD(0);
289 const unsigned int exp_sad = SAD(0);
291 ASSERT_EQ(reference_sad, exp_sad);
296 : public SADTestBase,
297 public ::testing::WithParamInterface<SadMxNAvgParam> {
299 SADavgTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
302 unsigned int SAD_avg(int block_idx) {
304 const uint8_t *const reference = GetReference(block_idx);
306 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
307 reference, reference_stride_,
313 const unsigned int reference_sad = ReferenceSADavg(0);
314 const unsigned int exp_sad = SAD_avg(0);
316 ASSERT_EQ(reference_sad, exp_sad);
320 uint8_t *SADTestBase::source_data_ = NULL;
321 uint8_t *SADTestBase::reference_data_ = NULL;
322 uint8_t *SADTestBase::second_pred_ = NULL;
323 uint8_t *SADTestBase::source_data8_ = NULL;
324 uint8_t *SADTestBase::reference_data8_ = NULL;
325 uint8_t *SADTestBase::second_pred8_ = NULL;
326 uint16_t *SADTestBase::source_data16_ = NULL;
327 uint16_t *SADTestBase::reference_data16_ = NULL;
328 uint16_t *SADTestBase::second_pred16_ = NULL;
330 TEST_P(SADTest, MaxRef) {
331 FillConstant(source_data_, source_stride_, 0);
332 FillConstant(reference_data_, reference_stride_, mask_);
336 TEST_P(SADTest, MaxSrc) {
337 FillConstant(source_data_, source_stride_, mask_);
338 FillConstant(reference_data_, reference_stride_, 0);
342 TEST_P(SADTest, ShortRef) {
343 const int tmp_stride = reference_stride_;
344 reference_stride_ >>= 1;
345 FillRandom(source_data_, source_stride_);
346 FillRandom(reference_data_, reference_stride_);
348 reference_stride_ = tmp_stride;
351 TEST_P(SADTest, UnalignedRef) {
352 // The reference frame, but not the source frame, may be unaligned for
353 // certain types of searches.
354 const int tmp_stride = reference_stride_;
355 reference_stride_ -= 1;
356 FillRandom(source_data_, source_stride_);
357 FillRandom(reference_data_, reference_stride_);
359 reference_stride_ = tmp_stride;
362 TEST_P(SADTest, ShortSrc) {
363 const int tmp_stride = source_stride_;
364 source_stride_ >>= 1;
365 FillRandom(source_data_, source_stride_);
366 FillRandom(reference_data_, reference_stride_);
368 source_stride_ = tmp_stride;
371 TEST_P(SADavgTest, MaxRef) {
372 FillConstant(source_data_, source_stride_, 0);
373 FillConstant(reference_data_, reference_stride_, mask_);
374 FillConstant(second_pred_, width_, 0);
377 TEST_P(SADavgTest, MaxSrc) {
378 FillConstant(source_data_, source_stride_, mask_);
379 FillConstant(reference_data_, reference_stride_, 0);
380 FillConstant(second_pred_, width_, 0);
384 TEST_P(SADavgTest, ShortRef) {
385 const int tmp_stride = reference_stride_;
386 reference_stride_ >>= 1;
387 FillRandom(source_data_, source_stride_);
388 FillRandom(reference_data_, reference_stride_);
389 FillRandom(second_pred_, width_);
391 reference_stride_ = tmp_stride;
394 TEST_P(SADavgTest, UnalignedRef) {
395 // The reference frame, but not the source frame, may be unaligned for
396 // certain types of searches.
397 const int tmp_stride = reference_stride_;
398 reference_stride_ -= 1;
399 FillRandom(source_data_, source_stride_);
400 FillRandom(reference_data_, reference_stride_);
401 FillRandom(second_pred_, width_);
403 reference_stride_ = tmp_stride;
406 TEST_P(SADavgTest, ShortSrc) {
407 const int tmp_stride = source_stride_;
408 source_stride_ >>= 1;
409 FillRandom(source_data_, source_stride_);
410 FillRandom(reference_data_, reference_stride_);
411 FillRandom(second_pred_, width_);
413 source_stride_ = tmp_stride;
416 TEST_P(SADx4Test, MaxRef) {
417 FillConstant(source_data_, source_stride_, 0);
418 FillConstant(GetReference(0), reference_stride_, mask_);
419 FillConstant(GetReference(1), reference_stride_, mask_);
420 FillConstant(GetReference(2), reference_stride_, mask_);
421 FillConstant(GetReference(3), reference_stride_, mask_);
425 TEST_P(SADx4Test, MaxSrc) {
426 FillConstant(source_data_, source_stride_, mask_);
427 FillConstant(GetReference(0), reference_stride_, 0);
428 FillConstant(GetReference(1), reference_stride_, 0);
429 FillConstant(GetReference(2), reference_stride_, 0);
430 FillConstant(GetReference(3), reference_stride_, 0);
434 TEST_P(SADx4Test, ShortRef) {
435 int tmp_stride = reference_stride_;
436 reference_stride_ >>= 1;
437 FillRandom(source_data_, source_stride_);
438 FillRandom(GetReference(0), reference_stride_);
439 FillRandom(GetReference(1), reference_stride_);
440 FillRandom(GetReference(2), reference_stride_);
441 FillRandom(GetReference(3), reference_stride_);
443 reference_stride_ = tmp_stride;
446 TEST_P(SADx4Test, UnalignedRef) {
447 // The reference frame, but not the source frame, may be unaligned for
448 // certain types of searches.
449 int tmp_stride = reference_stride_;
450 reference_stride_ -= 1;
451 FillRandom(source_data_, source_stride_);
452 FillRandom(GetReference(0), reference_stride_);
453 FillRandom(GetReference(1), reference_stride_);
454 FillRandom(GetReference(2), reference_stride_);
455 FillRandom(GetReference(3), reference_stride_);
457 reference_stride_ = tmp_stride;
460 TEST_P(SADx4Test, ShortSrc) {
461 int tmp_stride = source_stride_;
462 source_stride_ >>= 1;
463 FillRandom(source_data_, source_stride_);
464 FillRandom(GetReference(0), reference_stride_);
465 FillRandom(GetReference(1), reference_stride_);
466 FillRandom(GetReference(2), reference_stride_);
467 FillRandom(GetReference(3), reference_stride_);
469 source_stride_ = tmp_stride;
472 TEST_P(SADx4Test, SrcAlignedByWidth) {
473 uint8_t * tmp_source_data = source_data_;
474 source_data_ += width_;
475 FillRandom(source_data_, source_stride_);
476 FillRandom(GetReference(0), reference_stride_);
477 FillRandom(GetReference(1), reference_stride_);
478 FillRandom(GetReference(2), reference_stride_);
479 FillRandom(GetReference(3), reference_stride_);
481 source_data_ = tmp_source_data;
484 using std::tr1::make_tuple;
486 //------------------------------------------------------------------------------
488 const SadMxNFunc sad64x64_c = vpx_sad64x64_c;
489 const SadMxNFunc sad64x32_c = vpx_sad64x32_c;
490 const SadMxNFunc sad32x64_c = vpx_sad32x64_c;
491 const SadMxNFunc sad32x32_c = vpx_sad32x32_c;
492 const SadMxNFunc sad32x16_c = vpx_sad32x16_c;
493 const SadMxNFunc sad16x32_c = vpx_sad16x32_c;
494 const SadMxNFunc sad16x16_c = vpx_sad16x16_c;
495 const SadMxNFunc sad16x8_c = vpx_sad16x8_c;
496 const SadMxNFunc sad8x16_c = vpx_sad8x16_c;
497 const SadMxNFunc sad8x8_c = vpx_sad8x8_c;
498 const SadMxNFunc sad8x4_c = vpx_sad8x4_c;
499 const SadMxNFunc sad4x8_c = vpx_sad4x8_c;
500 const SadMxNFunc sad4x4_c = vpx_sad4x4_c;
501 #if CONFIG_VP9_HIGHBITDEPTH
502 const SadMxNFunc highbd_sad64x64_c = vpx_highbd_sad64x64_c;
503 const SadMxNFunc highbd_sad64x32_c = vpx_highbd_sad64x32_c;
504 const SadMxNFunc highbd_sad32x64_c = vpx_highbd_sad32x64_c;
505 const SadMxNFunc highbd_sad32x32_c = vpx_highbd_sad32x32_c;
506 const SadMxNFunc highbd_sad32x16_c = vpx_highbd_sad32x16_c;
507 const SadMxNFunc highbd_sad16x32_c = vpx_highbd_sad16x32_c;
508 const SadMxNFunc highbd_sad16x16_c = vpx_highbd_sad16x16_c;
509 const SadMxNFunc highbd_sad16x8_c = vpx_highbd_sad16x8_c;
510 const SadMxNFunc highbd_sad8x16_c = vpx_highbd_sad8x16_c;
511 const SadMxNFunc highbd_sad8x8_c = vpx_highbd_sad8x8_c;
512 const SadMxNFunc highbd_sad8x4_c = vpx_highbd_sad8x4_c;
513 const SadMxNFunc highbd_sad4x8_c = vpx_highbd_sad4x8_c;
514 const SadMxNFunc highbd_sad4x4_c = vpx_highbd_sad4x4_c;
515 #endif // CONFIG_VP9_HIGHBITDEPTH
516 const SadMxNParam c_tests[] = {
517 make_tuple(64, 64, sad64x64_c, -1),
518 make_tuple(64, 32, sad64x32_c, -1),
519 make_tuple(32, 64, sad32x64_c, -1),
520 make_tuple(32, 32, sad32x32_c, -1),
521 make_tuple(32, 16, sad32x16_c, -1),
522 make_tuple(16, 32, sad16x32_c, -1),
523 make_tuple(16, 16, sad16x16_c, -1),
524 make_tuple(16, 8, sad16x8_c, -1),
525 make_tuple(8, 16, sad8x16_c, -1),
526 make_tuple(8, 8, sad8x8_c, -1),
527 make_tuple(8, 4, sad8x4_c, -1),
528 make_tuple(4, 8, sad4x8_c, -1),
529 make_tuple(4, 4, sad4x4_c, -1),
530 #if CONFIG_VP9_HIGHBITDEPTH
531 make_tuple(64, 64, highbd_sad64x64_c, 8),
532 make_tuple(64, 32, highbd_sad64x32_c, 8),
533 make_tuple(32, 64, highbd_sad32x64_c, 8),
534 make_tuple(32, 32, highbd_sad32x32_c, 8),
535 make_tuple(32, 16, highbd_sad32x16_c, 8),
536 make_tuple(16, 32, highbd_sad16x32_c, 8),
537 make_tuple(16, 16, highbd_sad16x16_c, 8),
538 make_tuple(16, 8, highbd_sad16x8_c, 8),
539 make_tuple(8, 16, highbd_sad8x16_c, 8),
540 make_tuple(8, 8, highbd_sad8x8_c, 8),
541 make_tuple(8, 4, highbd_sad8x4_c, 8),
542 make_tuple(4, 8, highbd_sad4x8_c, 8),
543 make_tuple(4, 4, highbd_sad4x4_c, 8),
544 make_tuple(64, 64, highbd_sad64x64_c, 10),
545 make_tuple(64, 32, highbd_sad64x32_c, 10),
546 make_tuple(32, 64, highbd_sad32x64_c, 10),
547 make_tuple(32, 32, highbd_sad32x32_c, 10),
548 make_tuple(32, 16, highbd_sad32x16_c, 10),
549 make_tuple(16, 32, highbd_sad16x32_c, 10),
550 make_tuple(16, 16, highbd_sad16x16_c, 10),
551 make_tuple(16, 8, highbd_sad16x8_c, 10),
552 make_tuple(8, 16, highbd_sad8x16_c, 10),
553 make_tuple(8, 8, highbd_sad8x8_c, 10),
554 make_tuple(8, 4, highbd_sad8x4_c, 10),
555 make_tuple(4, 8, highbd_sad4x8_c, 10),
556 make_tuple(4, 4, highbd_sad4x4_c, 10),
557 make_tuple(64, 64, highbd_sad64x64_c, 12),
558 make_tuple(64, 32, highbd_sad64x32_c, 12),
559 make_tuple(32, 64, highbd_sad32x64_c, 12),
560 make_tuple(32, 32, highbd_sad32x32_c, 12),
561 make_tuple(32, 16, highbd_sad32x16_c, 12),
562 make_tuple(16, 32, highbd_sad16x32_c, 12),
563 make_tuple(16, 16, highbd_sad16x16_c, 12),
564 make_tuple(16, 8, highbd_sad16x8_c, 12),
565 make_tuple(8, 16, highbd_sad8x16_c, 12),
566 make_tuple(8, 8, highbd_sad8x8_c, 12),
567 make_tuple(8, 4, highbd_sad8x4_c, 12),
568 make_tuple(4, 8, highbd_sad4x8_c, 12),
569 make_tuple(4, 4, highbd_sad4x4_c, 12),
570 #endif // CONFIG_VP9_HIGHBITDEPTH
572 INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
574 const SadMxNAvgFunc sad64x64_avg_c = vpx_sad64x64_avg_c;
575 const SadMxNAvgFunc sad64x32_avg_c = vpx_sad64x32_avg_c;
576 const SadMxNAvgFunc sad32x64_avg_c = vpx_sad32x64_avg_c;
577 const SadMxNAvgFunc sad32x32_avg_c = vpx_sad32x32_avg_c;
578 const SadMxNAvgFunc sad32x16_avg_c = vpx_sad32x16_avg_c;
579 const SadMxNAvgFunc sad16x32_avg_c = vpx_sad16x32_avg_c;
580 const SadMxNAvgFunc sad16x16_avg_c = vpx_sad16x16_avg_c;
581 const SadMxNAvgFunc sad16x8_avg_c = vpx_sad16x8_avg_c;
582 const SadMxNAvgFunc sad8x16_avg_c = vpx_sad8x16_avg_c;
583 const SadMxNAvgFunc sad8x8_avg_c = vpx_sad8x8_avg_c;
584 const SadMxNAvgFunc sad8x4_avg_c = vpx_sad8x4_avg_c;
585 const SadMxNAvgFunc sad4x8_avg_c = vpx_sad4x8_avg_c;
586 const SadMxNAvgFunc sad4x4_avg_c = vpx_sad4x4_avg_c;
587 #if CONFIG_VP9_HIGHBITDEPTH
588 const SadMxNAvgFunc highbd_sad64x64_avg_c = vpx_highbd_sad64x64_avg_c;
589 const SadMxNAvgFunc highbd_sad64x32_avg_c = vpx_highbd_sad64x32_avg_c;
590 const SadMxNAvgFunc highbd_sad32x64_avg_c = vpx_highbd_sad32x64_avg_c;
591 const SadMxNAvgFunc highbd_sad32x32_avg_c = vpx_highbd_sad32x32_avg_c;
592 const SadMxNAvgFunc highbd_sad32x16_avg_c = vpx_highbd_sad32x16_avg_c;
593 const SadMxNAvgFunc highbd_sad16x32_avg_c = vpx_highbd_sad16x32_avg_c;
594 const SadMxNAvgFunc highbd_sad16x16_avg_c = vpx_highbd_sad16x16_avg_c;
595 const SadMxNAvgFunc highbd_sad16x8_avg_c = vpx_highbd_sad16x8_avg_c;
596 const SadMxNAvgFunc highbd_sad8x16_avg_c = vpx_highbd_sad8x16_avg_c;
597 const SadMxNAvgFunc highbd_sad8x8_avg_c = vpx_highbd_sad8x8_avg_c;
598 const SadMxNAvgFunc highbd_sad8x4_avg_c = vpx_highbd_sad8x4_avg_c;
599 const SadMxNAvgFunc highbd_sad4x8_avg_c = vpx_highbd_sad4x8_avg_c;
600 const SadMxNAvgFunc highbd_sad4x4_avg_c = vpx_highbd_sad4x4_avg_c;
601 #endif // CONFIG_VP9_HIGHBITDEPTH
602 const SadMxNAvgParam avg_c_tests[] = {
603 make_tuple(64, 64, sad64x64_avg_c, -1),
604 make_tuple(64, 32, sad64x32_avg_c, -1),
605 make_tuple(32, 64, sad32x64_avg_c, -1),
606 make_tuple(32, 32, sad32x32_avg_c, -1),
607 make_tuple(32, 16, sad32x16_avg_c, -1),
608 make_tuple(16, 32, sad16x32_avg_c, -1),
609 make_tuple(16, 16, sad16x16_avg_c, -1),
610 make_tuple(16, 8, sad16x8_avg_c, -1),
611 make_tuple(8, 16, sad8x16_avg_c, -1),
612 make_tuple(8, 8, sad8x8_avg_c, -1),
613 make_tuple(8, 4, sad8x4_avg_c, -1),
614 make_tuple(4, 8, sad4x8_avg_c, -1),
615 make_tuple(4, 4, sad4x4_avg_c, -1),
616 #if CONFIG_VP9_HIGHBITDEPTH
617 make_tuple(64, 64, highbd_sad64x64_avg_c, 8),
618 make_tuple(64, 32, highbd_sad64x32_avg_c, 8),
619 make_tuple(32, 64, highbd_sad32x64_avg_c, 8),
620 make_tuple(32, 32, highbd_sad32x32_avg_c, 8),
621 make_tuple(32, 16, highbd_sad32x16_avg_c, 8),
622 make_tuple(16, 32, highbd_sad16x32_avg_c, 8),
623 make_tuple(16, 16, highbd_sad16x16_avg_c, 8),
624 make_tuple(16, 8, highbd_sad16x8_avg_c, 8),
625 make_tuple(8, 16, highbd_sad8x16_avg_c, 8),
626 make_tuple(8, 8, highbd_sad8x8_avg_c, 8),
627 make_tuple(8, 4, highbd_sad8x4_avg_c, 8),
628 make_tuple(4, 8, highbd_sad4x8_avg_c, 8),
629 make_tuple(4, 4, highbd_sad4x4_avg_c, 8),
630 make_tuple(64, 64, highbd_sad64x64_avg_c, 10),
631 make_tuple(64, 32, highbd_sad64x32_avg_c, 10),
632 make_tuple(32, 64, highbd_sad32x64_avg_c, 10),
633 make_tuple(32, 32, highbd_sad32x32_avg_c, 10),
634 make_tuple(32, 16, highbd_sad32x16_avg_c, 10),
635 make_tuple(16, 32, highbd_sad16x32_avg_c, 10),
636 make_tuple(16, 16, highbd_sad16x16_avg_c, 10),
637 make_tuple(16, 8, highbd_sad16x8_avg_c, 10),
638 make_tuple(8, 16, highbd_sad8x16_avg_c, 10),
639 make_tuple(8, 8, highbd_sad8x8_avg_c, 10),
640 make_tuple(8, 4, highbd_sad8x4_avg_c, 10),
641 make_tuple(4, 8, highbd_sad4x8_avg_c, 10),
642 make_tuple(4, 4, highbd_sad4x4_avg_c, 10),
643 make_tuple(64, 64, highbd_sad64x64_avg_c, 12),
644 make_tuple(64, 32, highbd_sad64x32_avg_c, 12),
645 make_tuple(32, 64, highbd_sad32x64_avg_c, 12),
646 make_tuple(32, 32, highbd_sad32x32_avg_c, 12),
647 make_tuple(32, 16, highbd_sad32x16_avg_c, 12),
648 make_tuple(16, 32, highbd_sad16x32_avg_c, 12),
649 make_tuple(16, 16, highbd_sad16x16_avg_c, 12),
650 make_tuple(16, 8, highbd_sad16x8_avg_c, 12),
651 make_tuple(8, 16, highbd_sad8x16_avg_c, 12),
652 make_tuple(8, 8, highbd_sad8x8_avg_c, 12),
653 make_tuple(8, 4, highbd_sad8x4_avg_c, 12),
654 make_tuple(4, 8, highbd_sad4x8_avg_c, 12),
655 make_tuple(4, 4, highbd_sad4x4_avg_c, 12),
656 #endif // CONFIG_VP9_HIGHBITDEPTH
658 INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));
660 const SadMxNx4Func sad64x64x4d_c = vpx_sad64x64x4d_c;
661 const SadMxNx4Func sad64x32x4d_c = vpx_sad64x32x4d_c;
662 const SadMxNx4Func sad32x64x4d_c = vpx_sad32x64x4d_c;
663 const SadMxNx4Func sad32x32x4d_c = vpx_sad32x32x4d_c;
664 const SadMxNx4Func sad32x16x4d_c = vpx_sad32x16x4d_c;
665 const SadMxNx4Func sad16x32x4d_c = vpx_sad16x32x4d_c;
666 const SadMxNx4Func sad16x16x4d_c = vpx_sad16x16x4d_c;
667 const SadMxNx4Func sad16x8x4d_c = vpx_sad16x8x4d_c;
668 const SadMxNx4Func sad8x16x4d_c = vpx_sad8x16x4d_c;
669 const SadMxNx4Func sad8x8x4d_c = vpx_sad8x8x4d_c;
670 const SadMxNx4Func sad8x4x4d_c = vpx_sad8x4x4d_c;
671 const SadMxNx4Func sad4x8x4d_c = vpx_sad4x8x4d_c;
672 const SadMxNx4Func sad4x4x4d_c = vpx_sad4x4x4d_c;
673 #if CONFIG_VP9_HIGHBITDEPTH
674 const SadMxNx4Func highbd_sad64x64x4d_c = vpx_highbd_sad64x64x4d_c;
675 const SadMxNx4Func highbd_sad64x32x4d_c = vpx_highbd_sad64x32x4d_c;
676 const SadMxNx4Func highbd_sad32x64x4d_c = vpx_highbd_sad32x64x4d_c;
677 const SadMxNx4Func highbd_sad32x32x4d_c = vpx_highbd_sad32x32x4d_c;
678 const SadMxNx4Func highbd_sad32x16x4d_c = vpx_highbd_sad32x16x4d_c;
679 const SadMxNx4Func highbd_sad16x32x4d_c = vpx_highbd_sad16x32x4d_c;
680 const SadMxNx4Func highbd_sad16x16x4d_c = vpx_highbd_sad16x16x4d_c;
681 const SadMxNx4Func highbd_sad16x8x4d_c = vpx_highbd_sad16x8x4d_c;
682 const SadMxNx4Func highbd_sad8x16x4d_c = vpx_highbd_sad8x16x4d_c;
683 const SadMxNx4Func highbd_sad8x8x4d_c = vpx_highbd_sad8x8x4d_c;
684 const SadMxNx4Func highbd_sad8x4x4d_c = vpx_highbd_sad8x4x4d_c;
685 const SadMxNx4Func highbd_sad4x8x4d_c = vpx_highbd_sad4x8x4d_c;
686 const SadMxNx4Func highbd_sad4x4x4d_c = vpx_highbd_sad4x4x4d_c;
687 #endif // CONFIG_VP9_HIGHBITDEPTH
688 const SadMxNx4Param x4d_c_tests[] = {
689 make_tuple(64, 64, sad64x64x4d_c, -1),
690 make_tuple(64, 32, sad64x32x4d_c, -1),
691 make_tuple(32, 64, sad32x64x4d_c, -1),
692 make_tuple(32, 32, sad32x32x4d_c, -1),
693 make_tuple(32, 16, sad32x16x4d_c, -1),
694 make_tuple(16, 32, sad16x32x4d_c, -1),
695 make_tuple(16, 16, sad16x16x4d_c, -1),
696 make_tuple(16, 8, sad16x8x4d_c, -1),
697 make_tuple(8, 16, sad8x16x4d_c, -1),
698 make_tuple(8, 8, sad8x8x4d_c, -1),
699 make_tuple(8, 4, sad8x4x4d_c, -1),
700 make_tuple(4, 8, sad4x8x4d_c, -1),
701 make_tuple(4, 4, sad4x4x4d_c, -1),
702 #if CONFIG_VP9_HIGHBITDEPTH
703 make_tuple(64, 64, highbd_sad64x64x4d_c, 8),
704 make_tuple(64, 32, highbd_sad64x32x4d_c, 8),
705 make_tuple(32, 64, highbd_sad32x64x4d_c, 8),
706 make_tuple(32, 32, highbd_sad32x32x4d_c, 8),
707 make_tuple(32, 16, highbd_sad32x16x4d_c, 8),
708 make_tuple(16, 32, highbd_sad16x32x4d_c, 8),
709 make_tuple(16, 16, highbd_sad16x16x4d_c, 8),
710 make_tuple(16, 8, highbd_sad16x8x4d_c, 8),
711 make_tuple(8, 16, highbd_sad8x16x4d_c, 8),
712 make_tuple(8, 8, highbd_sad8x8x4d_c, 8),
713 make_tuple(8, 4, highbd_sad8x4x4d_c, 8),
714 make_tuple(4, 8, highbd_sad4x8x4d_c, 8),
715 make_tuple(4, 4, highbd_sad4x4x4d_c, 8),
716 make_tuple(64, 64, highbd_sad64x64x4d_c, 10),
717 make_tuple(64, 32, highbd_sad64x32x4d_c, 10),
718 make_tuple(32, 64, highbd_sad32x64x4d_c, 10),
719 make_tuple(32, 32, highbd_sad32x32x4d_c, 10),
720 make_tuple(32, 16, highbd_sad32x16x4d_c, 10),
721 make_tuple(16, 32, highbd_sad16x32x4d_c, 10),
722 make_tuple(16, 16, highbd_sad16x16x4d_c, 10),
723 make_tuple(16, 8, highbd_sad16x8x4d_c, 10),
724 make_tuple(8, 16, highbd_sad8x16x4d_c, 10),
725 make_tuple(8, 8, highbd_sad8x8x4d_c, 10),
726 make_tuple(8, 4, highbd_sad8x4x4d_c, 10),
727 make_tuple(4, 8, highbd_sad4x8x4d_c, 10),
728 make_tuple(4, 4, highbd_sad4x4x4d_c, 10),
729 make_tuple(64, 64, highbd_sad64x64x4d_c, 12),
730 make_tuple(64, 32, highbd_sad64x32x4d_c, 12),
731 make_tuple(32, 64, highbd_sad32x64x4d_c, 12),
732 make_tuple(32, 32, highbd_sad32x32x4d_c, 12),
733 make_tuple(32, 16, highbd_sad32x16x4d_c, 12),
734 make_tuple(16, 32, highbd_sad16x32x4d_c, 12),
735 make_tuple(16, 16, highbd_sad16x16x4d_c, 12),
736 make_tuple(16, 8, highbd_sad16x8x4d_c, 12),
737 make_tuple(8, 16, highbd_sad8x16x4d_c, 12),
738 make_tuple(8, 8, highbd_sad8x8x4d_c, 12),
739 make_tuple(8, 4, highbd_sad8x4x4d_c, 12),
740 make_tuple(4, 8, highbd_sad4x8x4d_c, 12),
741 make_tuple(4, 4, highbd_sad4x4x4d_c, 12),
742 #endif // CONFIG_VP9_HIGHBITDEPTH
744 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
746 //------------------------------------------------------------------------------
749 const SadMxNFunc sad16x16_media = vpx_sad16x16_media;
750 const SadMxNParam media_tests[] = {
751 make_tuple(16, 16, sad16x16_media, -1),
753 INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::ValuesIn(media_tests));
757 const SadMxNFunc sad64x64_neon = vpx_sad64x64_neon;
758 const SadMxNFunc sad32x32_neon = vpx_sad32x32_neon;
759 const SadMxNFunc sad16x16_neon = vpx_sad16x16_neon;
760 const SadMxNFunc sad16x8_neon = vpx_sad16x8_neon;
761 const SadMxNFunc sad8x16_neon = vpx_sad8x16_neon;
762 const SadMxNFunc sad8x8_neon = vpx_sad8x8_neon;
763 const SadMxNFunc sad4x4_neon = vpx_sad4x4_neon;
765 const SadMxNParam neon_tests[] = {
766 make_tuple(64, 64, sad64x64_neon, -1),
767 make_tuple(32, 32, sad32x32_neon, -1),
768 make_tuple(16, 16, sad16x16_neon, -1),
769 make_tuple(16, 8, sad16x8_neon, -1),
770 make_tuple(8, 16, sad8x16_neon, -1),
771 make_tuple(8, 8, sad8x8_neon, -1),
772 make_tuple(4, 4, sad4x4_neon, -1),
774 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));
776 const SadMxNx4Func sad64x64x4d_neon = vpx_sad64x64x4d_neon;
777 const SadMxNx4Func sad32x32x4d_neon = vpx_sad32x32x4d_neon;
778 const SadMxNx4Func sad16x16x4d_neon = vpx_sad16x16x4d_neon;
779 const SadMxNx4Param x4d_neon_tests[] = {
780 make_tuple(64, 64, sad64x64x4d_neon, -1),
781 make_tuple(32, 32, sad32x32x4d_neon, -1),
782 make_tuple(16, 16, sad16x16x4d_neon, -1),
784 INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
787 //------------------------------------------------------------------------------
790 const SadMxNFunc sad16x16_mmx = vpx_sad16x16_mmx;
791 const SadMxNFunc sad16x8_mmx = vpx_sad16x8_mmx;
792 const SadMxNFunc sad8x16_mmx = vpx_sad8x16_mmx;
793 const SadMxNFunc sad8x8_mmx = vpx_sad8x8_mmx;
794 const SadMxNFunc sad4x4_mmx = vpx_sad4x4_mmx;
795 const SadMxNParam mmx_tests[] = {
796 make_tuple(16, 16, sad16x16_mmx, -1),
797 make_tuple(16, 8, sad16x8_mmx, -1),
798 make_tuple(8, 16, sad8x16_mmx, -1),
799 make_tuple(8, 8, sad8x8_mmx, -1),
800 make_tuple(4, 4, sad4x4_mmx, -1),
802 INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
806 #if CONFIG_USE_X86INC
807 const SadMxNFunc sad4x8_sse = vpx_sad4x8_sse;
808 const SadMxNFunc sad4x4_sse = vpx_sad4x4_sse;
809 const SadMxNParam sse_tests[] = {
810 make_tuple(4, 8, sad4x8_sse, -1),
811 make_tuple(4, 4, sad4x4_sse, -1),
813 INSTANTIATE_TEST_CASE_P(SSE, SADTest, ::testing::ValuesIn(sse_tests));
815 const SadMxNAvgFunc sad4x8_avg_sse = vpx_sad4x8_avg_sse;
816 const SadMxNAvgFunc sad4x4_avg_sse = vpx_sad4x4_avg_sse;
817 const SadMxNAvgParam avg_sse_tests[] = {
818 make_tuple(4, 8, sad4x8_avg_sse, -1),
819 make_tuple(4, 4, sad4x4_avg_sse, -1),
821 INSTANTIATE_TEST_CASE_P(SSE, SADavgTest, ::testing::ValuesIn(avg_sse_tests));
823 const SadMxNx4Func sad4x8x4d_sse = vpx_sad4x8x4d_sse;
824 const SadMxNx4Func sad4x4x4d_sse = vpx_sad4x4x4d_sse;
825 const SadMxNx4Param x4d_sse_tests[] = {
826 make_tuple(4, 8, sad4x8x4d_sse, -1),
827 make_tuple(4, 4, sad4x4x4d_sse, -1),
829 INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::ValuesIn(x4d_sse_tests));
830 #endif // CONFIG_USE_X86INC
834 #if CONFIG_USE_X86INC
835 const SadMxNFunc sad64x64_sse2 = vpx_sad64x64_sse2;
836 const SadMxNFunc sad64x32_sse2 = vpx_sad64x32_sse2;
837 const SadMxNFunc sad32x64_sse2 = vpx_sad32x64_sse2;
838 const SadMxNFunc sad32x32_sse2 = vpx_sad32x32_sse2;
839 const SadMxNFunc sad32x16_sse2 = vpx_sad32x16_sse2;
840 const SadMxNFunc sad16x32_sse2 = vpx_sad16x32_sse2;
841 const SadMxNFunc sad16x16_sse2 = vpx_sad16x16_sse2;
842 const SadMxNFunc sad16x8_sse2 = vpx_sad16x8_sse2;
843 const SadMxNFunc sad8x16_sse2 = vpx_sad8x16_sse2;
844 const SadMxNFunc sad8x8_sse2 = vpx_sad8x8_sse2;
845 const SadMxNFunc sad8x4_sse2 = vpx_sad8x4_sse2;
846 #if CONFIG_VP9_HIGHBITDEPTH
847 const SadMxNFunc highbd_sad64x64_sse2 = vpx_highbd_sad64x64_sse2;
848 const SadMxNFunc highbd_sad64x32_sse2 = vpx_highbd_sad64x32_sse2;
849 const SadMxNFunc highbd_sad32x64_sse2 = vpx_highbd_sad32x64_sse2;
850 const SadMxNFunc highbd_sad32x32_sse2 = vpx_highbd_sad32x32_sse2;
851 const SadMxNFunc highbd_sad32x16_sse2 = vpx_highbd_sad32x16_sse2;
852 const SadMxNFunc highbd_sad16x32_sse2 = vpx_highbd_sad16x32_sse2;
853 const SadMxNFunc highbd_sad16x16_sse2 = vpx_highbd_sad16x16_sse2;
854 const SadMxNFunc highbd_sad16x8_sse2 = vpx_highbd_sad16x8_sse2;
855 const SadMxNFunc highbd_sad8x16_sse2 = vpx_highbd_sad8x16_sse2;
856 const SadMxNFunc highbd_sad8x8_sse2 = vpx_highbd_sad8x8_sse2;
857 const SadMxNFunc highbd_sad8x4_sse2 = vpx_highbd_sad8x4_sse2;
858 #endif // CONFIG_VP9_HIGHBITDEPTH
859 const SadMxNParam sse2_tests[] = {
860 make_tuple(64, 64, sad64x64_sse2, -1),
861 make_tuple(64, 32, sad64x32_sse2, -1),
862 make_tuple(32, 64, sad32x64_sse2, -1),
863 make_tuple(32, 32, sad32x32_sse2, -1),
864 make_tuple(32, 16, sad32x16_sse2, -1),
865 make_tuple(16, 32, sad16x32_sse2, -1),
866 make_tuple(16, 16, sad16x16_sse2, -1),
867 make_tuple(16, 8, sad16x8_sse2, -1),
868 make_tuple(8, 16, sad8x16_sse2, -1),
869 make_tuple(8, 8, sad8x8_sse2, -1),
870 make_tuple(8, 4, sad8x4_sse2, -1),
871 #if CONFIG_VP9_HIGHBITDEPTH
872 make_tuple(64, 64, highbd_sad64x64_sse2, 8),
873 make_tuple(64, 32, highbd_sad64x32_sse2, 8),
874 make_tuple(32, 64, highbd_sad32x64_sse2, 8),
875 make_tuple(32, 32, highbd_sad32x32_sse2, 8),
876 make_tuple(32, 16, highbd_sad32x16_sse2, 8),
877 make_tuple(16, 32, highbd_sad16x32_sse2, 8),
878 make_tuple(16, 16, highbd_sad16x16_sse2, 8),
879 make_tuple(16, 8, highbd_sad16x8_sse2, 8),
880 make_tuple(8, 16, highbd_sad8x16_sse2, 8),
881 make_tuple(8, 8, highbd_sad8x8_sse2, 8),
882 make_tuple(8, 4, highbd_sad8x4_sse2, 8),
883 make_tuple(64, 64, highbd_sad64x64_sse2, 10),
884 make_tuple(64, 32, highbd_sad64x32_sse2, 10),
885 make_tuple(32, 64, highbd_sad32x64_sse2, 10),
886 make_tuple(32, 32, highbd_sad32x32_sse2, 10),
887 make_tuple(32, 16, highbd_sad32x16_sse2, 10),
888 make_tuple(16, 32, highbd_sad16x32_sse2, 10),
889 make_tuple(16, 16, highbd_sad16x16_sse2, 10),
890 make_tuple(16, 8, highbd_sad16x8_sse2, 10),
891 make_tuple(8, 16, highbd_sad8x16_sse2, 10),
892 make_tuple(8, 8, highbd_sad8x8_sse2, 10),
893 make_tuple(8, 4, highbd_sad8x4_sse2, 10),
894 make_tuple(64, 64, highbd_sad64x64_sse2, 12),
895 make_tuple(64, 32, highbd_sad64x32_sse2, 12),
896 make_tuple(32, 64, highbd_sad32x64_sse2, 12),
897 make_tuple(32, 32, highbd_sad32x32_sse2, 12),
898 make_tuple(32, 16, highbd_sad32x16_sse2, 12),
899 make_tuple(16, 32, highbd_sad16x32_sse2, 12),
900 make_tuple(16, 16, highbd_sad16x16_sse2, 12),
901 make_tuple(16, 8, highbd_sad16x8_sse2, 12),
902 make_tuple(8, 16, highbd_sad8x16_sse2, 12),
903 make_tuple(8, 8, highbd_sad8x8_sse2, 12),
904 make_tuple(8, 4, highbd_sad8x4_sse2, 12),
905 #endif // CONFIG_VP9_HIGHBITDEPTH
907 INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
909 const SadMxNAvgFunc sad64x64_avg_sse2 = vpx_sad64x64_avg_sse2;
910 const SadMxNAvgFunc sad64x32_avg_sse2 = vpx_sad64x32_avg_sse2;
911 const SadMxNAvgFunc sad32x64_avg_sse2 = vpx_sad32x64_avg_sse2;
912 const SadMxNAvgFunc sad32x32_avg_sse2 = vpx_sad32x32_avg_sse2;
913 const SadMxNAvgFunc sad32x16_avg_sse2 = vpx_sad32x16_avg_sse2;
914 const SadMxNAvgFunc sad16x32_avg_sse2 = vpx_sad16x32_avg_sse2;
915 const SadMxNAvgFunc sad16x16_avg_sse2 = vpx_sad16x16_avg_sse2;
916 const SadMxNAvgFunc sad16x8_avg_sse2 = vpx_sad16x8_avg_sse2;
917 const SadMxNAvgFunc sad8x16_avg_sse2 = vpx_sad8x16_avg_sse2;
918 const SadMxNAvgFunc sad8x8_avg_sse2 = vpx_sad8x8_avg_sse2;
919 const SadMxNAvgFunc sad8x4_avg_sse2 = vpx_sad8x4_avg_sse2;
920 #if CONFIG_VP9_HIGHBITDEPTH
921 const SadMxNAvgFunc highbd_sad64x64_avg_sse2 = vpx_highbd_sad64x64_avg_sse2;
922 const SadMxNAvgFunc highbd_sad64x32_avg_sse2 = vpx_highbd_sad64x32_avg_sse2;
923 const SadMxNAvgFunc highbd_sad32x64_avg_sse2 = vpx_highbd_sad32x64_avg_sse2;
924 const SadMxNAvgFunc highbd_sad32x32_avg_sse2 = vpx_highbd_sad32x32_avg_sse2;
925 const SadMxNAvgFunc highbd_sad32x16_avg_sse2 = vpx_highbd_sad32x16_avg_sse2;
926 const SadMxNAvgFunc highbd_sad16x32_avg_sse2 = vpx_highbd_sad16x32_avg_sse2;
927 const SadMxNAvgFunc highbd_sad16x16_avg_sse2 = vpx_highbd_sad16x16_avg_sse2;
928 const SadMxNAvgFunc highbd_sad16x8_avg_sse2 = vpx_highbd_sad16x8_avg_sse2;
929 const SadMxNAvgFunc highbd_sad8x16_avg_sse2 = vpx_highbd_sad8x16_avg_sse2;
930 const SadMxNAvgFunc highbd_sad8x8_avg_sse2 = vpx_highbd_sad8x8_avg_sse2;
931 const SadMxNAvgFunc highbd_sad8x4_avg_sse2 = vpx_highbd_sad8x4_avg_sse2;
932 #endif // CONFIG_VP9_HIGHBITDEPTH
933 const SadMxNAvgParam avg_sse2_tests[] = {
934 make_tuple(64, 64, sad64x64_avg_sse2, -1),
935 make_tuple(64, 32, sad64x32_avg_sse2, -1),
936 make_tuple(32, 64, sad32x64_avg_sse2, -1),
937 make_tuple(32, 32, sad32x32_avg_sse2, -1),
938 make_tuple(32, 16, sad32x16_avg_sse2, -1),
939 make_tuple(16, 32, sad16x32_avg_sse2, -1),
940 make_tuple(16, 16, sad16x16_avg_sse2, -1),
941 make_tuple(16, 8, sad16x8_avg_sse2, -1),
942 make_tuple(8, 16, sad8x16_avg_sse2, -1),
943 make_tuple(8, 8, sad8x8_avg_sse2, -1),
944 make_tuple(8, 4, sad8x4_avg_sse2, -1),
945 #if CONFIG_VP9_HIGHBITDEPTH
946 make_tuple(64, 64, highbd_sad64x64_avg_sse2, 8),
947 make_tuple(64, 32, highbd_sad64x32_avg_sse2, 8),
948 make_tuple(32, 64, highbd_sad32x64_avg_sse2, 8),
949 make_tuple(32, 32, highbd_sad32x32_avg_sse2, 8),
950 make_tuple(32, 16, highbd_sad32x16_avg_sse2, 8),
951 make_tuple(16, 32, highbd_sad16x32_avg_sse2, 8),
952 make_tuple(16, 16, highbd_sad16x16_avg_sse2, 8),
953 make_tuple(16, 8, highbd_sad16x8_avg_sse2, 8),
954 make_tuple(8, 16, highbd_sad8x16_avg_sse2, 8),
955 make_tuple(8, 8, highbd_sad8x8_avg_sse2, 8),
956 make_tuple(8, 4, highbd_sad8x4_avg_sse2, 8),
957 make_tuple(64, 64, highbd_sad64x64_avg_sse2, 10),
958 make_tuple(64, 32, highbd_sad64x32_avg_sse2, 10),
959 make_tuple(32, 64, highbd_sad32x64_avg_sse2, 10),
960 make_tuple(32, 32, highbd_sad32x32_avg_sse2, 10),
961 make_tuple(32, 16, highbd_sad32x16_avg_sse2, 10),
962 make_tuple(16, 32, highbd_sad16x32_avg_sse2, 10),
963 make_tuple(16, 16, highbd_sad16x16_avg_sse2, 10),
964 make_tuple(16, 8, highbd_sad16x8_avg_sse2, 10),
965 make_tuple(8, 16, highbd_sad8x16_avg_sse2, 10),
966 make_tuple(8, 8, highbd_sad8x8_avg_sse2, 10),
967 make_tuple(8, 4, highbd_sad8x4_avg_sse2, 10),
968 make_tuple(64, 64, highbd_sad64x64_avg_sse2, 12),
969 make_tuple(64, 32, highbd_sad64x32_avg_sse2, 12),
970 make_tuple(32, 64, highbd_sad32x64_avg_sse2, 12),
971 make_tuple(32, 32, highbd_sad32x32_avg_sse2, 12),
972 make_tuple(32, 16, highbd_sad32x16_avg_sse2, 12),
973 make_tuple(16, 32, highbd_sad16x32_avg_sse2, 12),
974 make_tuple(16, 16, highbd_sad16x16_avg_sse2, 12),
975 make_tuple(16, 8, highbd_sad16x8_avg_sse2, 12),
976 make_tuple(8, 16, highbd_sad8x16_avg_sse2, 12),
977 make_tuple(8, 8, highbd_sad8x8_avg_sse2, 12),
978 make_tuple(8, 4, highbd_sad8x4_avg_sse2, 12),
979 #endif // CONFIG_VP9_HIGHBITDEPTH
981 INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));
983 const SadMxNx4Func sad64x64x4d_sse2 = vpx_sad64x64x4d_sse2;
984 const SadMxNx4Func sad64x32x4d_sse2 = vpx_sad64x32x4d_sse2;
985 const SadMxNx4Func sad32x64x4d_sse2 = vpx_sad32x64x4d_sse2;
986 const SadMxNx4Func sad32x32x4d_sse2 = vpx_sad32x32x4d_sse2;
987 const SadMxNx4Func sad32x16x4d_sse2 = vpx_sad32x16x4d_sse2;
988 const SadMxNx4Func sad16x32x4d_sse2 = vpx_sad16x32x4d_sse2;
989 const SadMxNx4Func sad16x16x4d_sse2 = vpx_sad16x16x4d_sse2;
990 const SadMxNx4Func sad16x8x4d_sse2 = vpx_sad16x8x4d_sse2;
991 const SadMxNx4Func sad8x16x4d_sse2 = vpx_sad8x16x4d_sse2;
992 const SadMxNx4Func sad8x8x4d_sse2 = vpx_sad8x8x4d_sse2;
993 const SadMxNx4Func sad8x4x4d_sse2 = vpx_sad8x4x4d_sse2;
994 #if CONFIG_VP9_HIGHBITDEPTH
995 const SadMxNx4Func highbd_sad64x64x4d_sse2 = vpx_highbd_sad64x64x4d_sse2;
996 const SadMxNx4Func highbd_sad64x32x4d_sse2 = vpx_highbd_sad64x32x4d_sse2;
997 const SadMxNx4Func highbd_sad32x64x4d_sse2 = vpx_highbd_sad32x64x4d_sse2;
998 const SadMxNx4Func highbd_sad32x32x4d_sse2 = vpx_highbd_sad32x32x4d_sse2;
999 const SadMxNx4Func highbd_sad32x16x4d_sse2 = vpx_highbd_sad32x16x4d_sse2;
1000 const SadMxNx4Func highbd_sad16x32x4d_sse2 = vpx_highbd_sad16x32x4d_sse2;
1001 const SadMxNx4Func highbd_sad16x16x4d_sse2 = vpx_highbd_sad16x16x4d_sse2;
1002 const SadMxNx4Func highbd_sad16x8x4d_sse2 = vpx_highbd_sad16x8x4d_sse2;
1003 const SadMxNx4Func highbd_sad8x16x4d_sse2 = vpx_highbd_sad8x16x4d_sse2;
1004 const SadMxNx4Func highbd_sad8x8x4d_sse2 = vpx_highbd_sad8x8x4d_sse2;
1005 const SadMxNx4Func highbd_sad8x4x4d_sse2 = vpx_highbd_sad8x4x4d_sse2;
1006 const SadMxNx4Func highbd_sad4x8x4d_sse2 = vpx_highbd_sad4x8x4d_sse2;
1007 const SadMxNx4Func highbd_sad4x4x4d_sse2 = vpx_highbd_sad4x4x4d_sse2;
1008 #endif // CONFIG_VP9_HIGHBITDEPTH
1009 const SadMxNx4Param x4d_sse2_tests[] = {
1010 make_tuple(64, 64, sad64x64x4d_sse2, -1),
1011 make_tuple(64, 32, sad64x32x4d_sse2, -1),
1012 make_tuple(32, 64, sad32x64x4d_sse2, -1),
1013 make_tuple(32, 32, sad32x32x4d_sse2, -1),
1014 make_tuple(32, 16, sad32x16x4d_sse2, -1),
1015 make_tuple(16, 32, sad16x32x4d_sse2, -1),
1016 make_tuple(16, 16, sad16x16x4d_sse2, -1),
1017 make_tuple(16, 8, sad16x8x4d_sse2, -1),
1018 make_tuple(8, 16, sad8x16x4d_sse2, -1),
1019 make_tuple(8, 8, sad8x8x4d_sse2, -1),
1020 make_tuple(8, 4, sad8x4x4d_sse2, -1),
1021 #if CONFIG_VP9_HIGHBITDEPTH
1022 make_tuple(64, 64, highbd_sad64x64x4d_sse2, 8),
1023 make_tuple(64, 32, highbd_sad64x32x4d_sse2, 8),
1024 make_tuple(32, 64, highbd_sad32x64x4d_sse2, 8),
1025 make_tuple(32, 32, highbd_sad32x32x4d_sse2, 8),
1026 make_tuple(32, 16, highbd_sad32x16x4d_sse2, 8),
1027 make_tuple(16, 32, highbd_sad16x32x4d_sse2, 8),
1028 make_tuple(16, 16, highbd_sad16x16x4d_sse2, 8),
1029 make_tuple(16, 8, highbd_sad16x8x4d_sse2, 8),
1030 make_tuple(8, 16, highbd_sad8x16x4d_sse2, 8),
1031 make_tuple(8, 8, highbd_sad8x8x4d_sse2, 8),
1032 make_tuple(8, 4, highbd_sad8x4x4d_sse2, 8),
1033 make_tuple(4, 8, highbd_sad4x8x4d_sse2, 8),
1034 make_tuple(4, 4, highbd_sad4x4x4d_sse2, 8),
1035 make_tuple(64, 64, highbd_sad64x64x4d_sse2, 10),
1036 make_tuple(64, 32, highbd_sad64x32x4d_sse2, 10),
1037 make_tuple(32, 64, highbd_sad32x64x4d_sse2, 10),
1038 make_tuple(32, 32, highbd_sad32x32x4d_sse2, 10),
1039 make_tuple(32, 16, highbd_sad32x16x4d_sse2, 10),
1040 make_tuple(16, 32, highbd_sad16x32x4d_sse2, 10),
1041 make_tuple(16, 16, highbd_sad16x16x4d_sse2, 10),
1042 make_tuple(16, 8, highbd_sad16x8x4d_sse2, 10),
1043 make_tuple(8, 16, highbd_sad8x16x4d_sse2, 10),
1044 make_tuple(8, 8, highbd_sad8x8x4d_sse2, 10),
1045 make_tuple(8, 4, highbd_sad8x4x4d_sse2, 10),
1046 make_tuple(4, 8, highbd_sad4x8x4d_sse2, 10),
1047 make_tuple(4, 4, highbd_sad4x4x4d_sse2, 10),
1048 make_tuple(64, 64, highbd_sad64x64x4d_sse2, 12),
1049 make_tuple(64, 32, highbd_sad64x32x4d_sse2, 12),
1050 make_tuple(32, 64, highbd_sad32x64x4d_sse2, 12),
1051 make_tuple(32, 32, highbd_sad32x32x4d_sse2, 12),
1052 make_tuple(32, 16, highbd_sad32x16x4d_sse2, 12),
1053 make_tuple(16, 32, highbd_sad16x32x4d_sse2, 12),
1054 make_tuple(16, 16, highbd_sad16x16x4d_sse2, 12),
1055 make_tuple(16, 8, highbd_sad16x8x4d_sse2, 12),
1056 make_tuple(8, 16, highbd_sad8x16x4d_sse2, 12),
1057 make_tuple(8, 8, highbd_sad8x8x4d_sse2, 12),
1058 make_tuple(8, 4, highbd_sad8x4x4d_sse2, 12),
1059 make_tuple(4, 8, highbd_sad4x8x4d_sse2, 12),
1060 make_tuple(4, 4, highbd_sad4x4x4d_sse2, 12),
1061 #endif // CONFIG_VP9_HIGHBITDEPTH
1063 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
1064 #endif // CONFIG_USE_X86INC
1068 // Only functions are x3, which do not have tests.
1072 // Only functions are x3, which do not have tests.
1073 #endif // HAVE_SSSE3
1076 // Only functions are x8, which do not have tests.
1077 #endif // HAVE_SSE4_1
1080 const SadMxNFunc sad64x64_avx2 = vpx_sad64x64_avx2;
1081 const SadMxNFunc sad64x32_avx2 = vpx_sad64x32_avx2;
1082 const SadMxNFunc sad32x64_avx2 = vpx_sad32x64_avx2;
1083 const SadMxNFunc sad32x32_avx2 = vpx_sad32x32_avx2;
1084 const SadMxNFunc sad32x16_avx2 = vpx_sad32x16_avx2;
1085 const SadMxNParam avx2_tests[] = {
1086 make_tuple(64, 64, sad64x64_avx2, -1),
1087 make_tuple(64, 32, sad64x32_avx2, -1),
1088 make_tuple(32, 64, sad32x64_avx2, -1),
1089 make_tuple(32, 32, sad32x32_avx2, -1),
1090 make_tuple(32, 16, sad32x16_avx2, -1),
1092 INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));
1094 const SadMxNAvgFunc sad64x64_avg_avx2 = vpx_sad64x64_avg_avx2;
1095 const SadMxNAvgFunc sad64x32_avg_avx2 = vpx_sad64x32_avg_avx2;
1096 const SadMxNAvgFunc sad32x64_avg_avx2 = vpx_sad32x64_avg_avx2;
1097 const SadMxNAvgFunc sad32x32_avg_avx2 = vpx_sad32x32_avg_avx2;
1098 const SadMxNAvgFunc sad32x16_avg_avx2 = vpx_sad32x16_avg_avx2;
1099 const SadMxNAvgParam avg_avx2_tests[] = {
1100 make_tuple(64, 64, sad64x64_avg_avx2, -1),
1101 make_tuple(64, 32, sad64x32_avg_avx2, -1),
1102 make_tuple(32, 64, sad32x64_avg_avx2, -1),
1103 make_tuple(32, 32, sad32x32_avg_avx2, -1),
1104 make_tuple(32, 16, sad32x16_avg_avx2, -1),
1106 INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
1108 const SadMxNx4Func sad64x64x4d_avx2 = vpx_sad64x64x4d_avx2;
1109 const SadMxNx4Func sad32x32x4d_avx2 = vpx_sad32x32x4d_avx2;
1110 const SadMxNx4Param x4d_avx2_tests[] = {
1111 make_tuple(64, 64, sad64x64x4d_avx2, -1),
1112 make_tuple(32, 32, sad32x32x4d_avx2, -1),
1114 INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
1117 //------------------------------------------------------------------------------
1120 const SadMxNFunc sad64x64_msa = vpx_sad64x64_msa;
1121 const SadMxNFunc sad64x32_msa = vpx_sad64x32_msa;
1122 const SadMxNFunc sad32x64_msa = vpx_sad32x64_msa;
1123 const SadMxNFunc sad32x32_msa = vpx_sad32x32_msa;
1124 const SadMxNFunc sad32x16_msa = vpx_sad32x16_msa;
1125 const SadMxNFunc sad16x32_msa = vpx_sad16x32_msa;
1126 const SadMxNFunc sad16x16_msa = vpx_sad16x16_msa;
1127 const SadMxNFunc sad16x8_msa = vpx_sad16x8_msa;
1128 const SadMxNFunc sad8x16_msa = vpx_sad8x16_msa;
1129 const SadMxNFunc sad8x8_msa = vpx_sad8x8_msa;
1130 const SadMxNFunc sad8x4_msa = vpx_sad8x4_msa;
1131 const SadMxNFunc sad4x8_msa = vpx_sad4x8_msa;
1132 const SadMxNFunc sad4x4_msa = vpx_sad4x4_msa;
1133 const SadMxNParam msa_tests[] = {
1134 make_tuple(64, 64, sad64x64_msa, -1),
1135 make_tuple(64, 32, sad64x32_msa, -1),
1136 make_tuple(32, 64, sad32x64_msa, -1),
1137 make_tuple(32, 32, sad32x32_msa, -1),
1138 make_tuple(32, 16, sad32x16_msa, -1),
1139 make_tuple(16, 32, sad16x32_msa, -1),
1140 make_tuple(16, 16, sad16x16_msa, -1),
1141 make_tuple(16, 8, sad16x8_msa, -1),
1142 make_tuple(8, 16, sad8x16_msa, -1),
1143 make_tuple(8, 8, sad8x8_msa, -1),
1144 make_tuple(8, 4, sad8x4_msa, -1),
1145 make_tuple(4, 8, sad4x8_msa, -1),
1146 make_tuple(4, 4, sad4x4_msa, -1),
1148 INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));
1150 const SadMxNAvgFunc sad64x64_avg_msa = vpx_sad64x64_avg_msa;
1151 const SadMxNAvgFunc sad64x32_avg_msa = vpx_sad64x32_avg_msa;
1152 const SadMxNAvgFunc sad32x64_avg_msa = vpx_sad32x64_avg_msa;
1153 const SadMxNAvgFunc sad32x32_avg_msa = vpx_sad32x32_avg_msa;
1154 const SadMxNAvgFunc sad32x16_avg_msa = vpx_sad32x16_avg_msa;
1155 const SadMxNAvgFunc sad16x32_avg_msa = vpx_sad16x32_avg_msa;
1156 const SadMxNAvgFunc sad16x16_avg_msa = vpx_sad16x16_avg_msa;
1157 const SadMxNAvgFunc sad16x8_avg_msa = vpx_sad16x8_avg_msa;
1158 const SadMxNAvgFunc sad8x16_avg_msa = vpx_sad8x16_avg_msa;
1159 const SadMxNAvgFunc sad8x8_avg_msa = vpx_sad8x8_avg_msa;
1160 const SadMxNAvgFunc sad8x4_avg_msa = vpx_sad8x4_avg_msa;
1161 const SadMxNAvgFunc sad4x8_avg_msa = vpx_sad4x8_avg_msa;
1162 const SadMxNAvgFunc sad4x4_avg_msa = vpx_sad4x4_avg_msa;
1163 const SadMxNAvgParam avg_msa_tests[] = {
1164 make_tuple(64, 64, sad64x64_avg_msa, -1),
1165 make_tuple(64, 32, sad64x32_avg_msa, -1),
1166 make_tuple(32, 64, sad32x64_avg_msa, -1),
1167 make_tuple(32, 32, sad32x32_avg_msa, -1),
1168 make_tuple(32, 16, sad32x16_avg_msa, -1),
1169 make_tuple(16, 32, sad16x32_avg_msa, -1),
1170 make_tuple(16, 16, sad16x16_avg_msa, -1),
1171 make_tuple(16, 8, sad16x8_avg_msa, -1),
1172 make_tuple(8, 16, sad8x16_avg_msa, -1),
1173 make_tuple(8, 8, sad8x8_avg_msa, -1),
1174 make_tuple(8, 4, sad8x4_avg_msa, -1),
1175 make_tuple(4, 8, sad4x8_avg_msa, -1),
1176 make_tuple(4, 4, sad4x4_avg_msa, -1),
1178 INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));
1180 const SadMxNx4Func sad64x64x4d_msa = vpx_sad64x64x4d_msa;
1181 const SadMxNx4Func sad64x32x4d_msa = vpx_sad64x32x4d_msa;
1182 const SadMxNx4Func sad32x64x4d_msa = vpx_sad32x64x4d_msa;
1183 const SadMxNx4Func sad32x32x4d_msa = vpx_sad32x32x4d_msa;
1184 const SadMxNx4Func sad32x16x4d_msa = vpx_sad32x16x4d_msa;
1185 const SadMxNx4Func sad16x32x4d_msa = vpx_sad16x32x4d_msa;
1186 const SadMxNx4Func sad16x16x4d_msa = vpx_sad16x16x4d_msa;
1187 const SadMxNx4Func sad16x8x4d_msa = vpx_sad16x8x4d_msa;
1188 const SadMxNx4Func sad8x16x4d_msa = vpx_sad8x16x4d_msa;
1189 const SadMxNx4Func sad8x8x4d_msa = vpx_sad8x8x4d_msa;
1190 const SadMxNx4Func sad8x4x4d_msa = vpx_sad8x4x4d_msa;
1191 const SadMxNx4Func sad4x8x4d_msa = vpx_sad4x8x4d_msa;
1192 const SadMxNx4Func sad4x4x4d_msa = vpx_sad4x4x4d_msa;
1193 const SadMxNx4Param x4d_msa_tests[] = {
1194 make_tuple(64, 64, sad64x64x4d_msa, -1),
1195 make_tuple(64, 32, sad64x32x4d_msa, -1),
1196 make_tuple(32, 64, sad32x64x4d_msa, -1),
1197 make_tuple(32, 32, sad32x32x4d_msa, -1),
1198 make_tuple(32, 16, sad32x16x4d_msa, -1),
1199 make_tuple(16, 32, sad16x32x4d_msa, -1),
1200 make_tuple(16, 16, sad16x16x4d_msa, -1),
1201 make_tuple(16, 8, sad16x8x4d_msa, -1),
1202 make_tuple(8, 16, sad8x16x4d_msa, -1),
1203 make_tuple(8, 8, sad8x8x4d_msa, -1),
1204 make_tuple(8, 4, sad8x4x4d_msa, -1),
1205 make_tuple(4, 8, sad4x8x4d_msa, -1),
1206 make_tuple(4, 4, sad4x4x4d_msa, -1),
1208 INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));