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