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 #if CONFIG_VP8_ENCODER
18 #include "./vp8_rtcd.h"
20 #if CONFIG_VP9_ENCODER
21 #include "./vp9_rtcd.h"
23 #include "vpx_mem/vpx_mem.h"
25 #include "test/acm_random.h"
26 #include "test/clear_system_state.h"
27 #include "test/register_state_check.h"
28 #include "test/util.h"
29 #include "third_party/googletest/src/include/gtest/gtest.h"
30 #include "vpx/vpx_codec.h"
33 #if CONFIG_VP8_ENCODER
34 typedef unsigned int (*SadMxNFunc)(const unsigned char *source_ptr,
36 const unsigned char *reference_ptr,
38 unsigned int max_sad);
39 typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
41 #if CONFIG_VP9_ENCODER
42 typedef unsigned int (*SadMxNVp9Func)(const unsigned char *source_ptr,
44 const unsigned char *reference_ptr,
45 int reference_stride);
46 typedef std::tr1::tuple<int, int, SadMxNVp9Func, int> SadMxNVp9Param;
47 typedef uint32_t (*SadMxNAvgVp9Func)(const uint8_t *source_ptr,
49 const uint8_t *reference_ptr,
51 const uint8_t *second_pred);
52 typedef std::tr1::tuple<int, int, SadMxNAvgVp9Func, int> SadMxNAvgVp9Param;
55 typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
57 const uint8_t *const ref_ptr[],
60 typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
62 using libvpx_test::ACMRandom;
65 class SADTestBase : public ::testing::Test {
67 SADTestBase(int width, int height, int bit_depth) :
68 width_(width), height_(height), bd_(bit_depth) {}
70 static void SetUpTestCase() {
71 #if CONFIG_VP9_HIGHBITDEPTH
72 source_data8_ = reinterpret_cast<uint8_t*>(
73 vpx_memalign(kDataAlignment, kDataBlockSize));
74 reference_data8_ = reinterpret_cast<uint8_t*>(
75 vpx_memalign(kDataAlignment, kDataBufferSize));
76 second_pred8_ = reinterpret_cast<uint8_t*>(
77 vpx_memalign(kDataAlignment, 64*64));
78 source_data16_ = reinterpret_cast<uint16_t*>(
79 vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));
80 reference_data16_ = reinterpret_cast<uint16_t*>(
81 vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));
82 second_pred16_ = reinterpret_cast<uint16_t*>(
83 vpx_memalign(kDataAlignment, 64*64*sizeof(uint16_t)));
85 source_data_ = reinterpret_cast<uint8_t*>(
86 vpx_memalign(kDataAlignment, kDataBlockSize));
87 reference_data_ = reinterpret_cast<uint8_t*>(
88 vpx_memalign(kDataAlignment, kDataBufferSize));
89 second_pred_ = reinterpret_cast<uint8_t*>(
90 vpx_memalign(kDataAlignment, 64*64));
94 static void TearDownTestCase() {
95 #if CONFIG_VP9_HIGHBITDEPTH
96 vpx_free(source_data8_);
98 vpx_free(reference_data8_);
99 reference_data8_ = NULL;
100 vpx_free(second_pred8_);
101 second_pred8_ = NULL;
102 vpx_free(source_data16_);
103 source_data16_ = NULL;
104 vpx_free(reference_data16_);
105 reference_data16_ = NULL;
106 vpx_free(second_pred16_);
107 second_pred16_ = NULL;
109 vpx_free(source_data_);
111 vpx_free(reference_data_);
112 reference_data_ = NULL;
113 vpx_free(second_pred_);
118 virtual void TearDown() {
119 libvpx_test::ClearSystemState();
123 // Handle blocks up to 4 blocks 64x64 with stride up to 128
124 static const int kDataAlignment = 16;
125 static const int kDataBlockSize = 64 * 128;
126 static const int kDataBufferSize = 4 * kDataBlockSize;
128 virtual void SetUp() {
129 #if CONFIG_VP9_HIGHBITDEPTH
131 use_high_bit_depth_ = false;
132 bit_depth_ = VPX_BITS_8;
133 source_data_ = source_data8_;
134 reference_data_ = reference_data8_;
135 second_pred_ = second_pred8_;
137 use_high_bit_depth_ = true;
138 bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
139 source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
140 reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
141 second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
144 mask_ = (1 << bit_depth_) - 1;
145 source_stride_ = (width_ + 31) & ~31;
146 reference_stride_ = width_ * 2;
147 rnd_.Reset(ACMRandom::DeterministicSeed());
150 virtual uint8_t *GetReference(int block_idx) {
151 #if CONFIG_VP9_HIGHBITDEPTH
152 if (!use_high_bit_depth_) {
153 return reference_data_ + block_idx * kDataBlockSize;
155 return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
156 block_idx * kDataBlockSize);
159 return reference_data_ + block_idx * kDataBlockSize;
163 // Sum of Absolute Differences. Given two blocks, calculate the absolute
164 // difference between two pixels in the same relative location; accumulate.
165 unsigned int ReferenceSAD(unsigned int max_sad, int block_idx) {
166 unsigned int sad = 0;
167 #if CONFIG_VP9_HIGHBITDEPTH
168 const uint8_t *const reference8 = GetReference(block_idx);
169 const uint8_t *const source8 = source_data_;
170 const uint16_t *const reference16 =
171 CONVERT_TO_SHORTPTR(GetReference(block_idx));
172 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
174 const uint8_t *const reference = GetReference(block_idx);
175 const uint8_t *const source = source_data_;
177 for (int h = 0; h < height_; ++h) {
178 for (int w = 0; w < width_; ++w) {
179 #if CONFIG_VP9_HIGHBITDEPTH
180 if (!use_high_bit_depth_) {
182 abs(source8[h * source_stride_ + w] -
183 reference8[h * reference_stride_ + w]);
186 abs(source16[h * source_stride_ + w] -
187 reference16[h * reference_stride_ + w]);
191 abs(source[h * source_stride_ + w] -
192 reference[h * reference_stride_ + w]);
202 // Sum of Absolute Differences Average. Given two blocks, and a prediction
203 // calculate the absolute difference between one pixel and average of the
204 // corresponding and predicted pixels; accumulate.
205 unsigned int ReferenceSADavg(unsigned int max_sad, int block_idx) {
206 unsigned int sad = 0;
207 #if CONFIG_VP9_HIGHBITDEPTH
208 const uint8_t *const reference8 = GetReference(block_idx);
209 const uint8_t *const source8 = source_data_;
210 const uint8_t *const second_pred8 = second_pred_;
211 const uint16_t *const reference16 =
212 CONVERT_TO_SHORTPTR(GetReference(block_idx));
213 const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
214 const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
216 const uint8_t *const reference = GetReference(block_idx);
217 const uint8_t *const source = source_data_;
218 const uint8_t *const second_pred = second_pred_;
220 for (int h = 0; h < height_; ++h) {
221 for (int w = 0; w < width_; ++w) {
222 #if CONFIG_VP9_HIGHBITDEPTH
223 if (!use_high_bit_depth_) {
224 const int tmp = second_pred8[h * width_ + w] +
225 reference8[h * reference_stride_ + w];
226 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
227 sad += abs(source8[h * source_stride_ + w] - comp_pred);
229 const int tmp = second_pred16[h * width_ + w] +
230 reference16[h * reference_stride_ + w];
231 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
232 sad += abs(source16[h * source_stride_ + w] - comp_pred);
235 const int tmp = second_pred[h * width_ + w] +
236 reference[h * reference_stride_ + w];
237 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
238 sad += abs(source[h * source_stride_ + w] - comp_pred);
248 void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
249 #if CONFIG_VP9_HIGHBITDEPTH
250 uint8_t *data8 = data;
251 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
253 for (int h = 0; h < height_; ++h) {
254 for (int w = 0; w < width_; ++w) {
255 #if CONFIG_VP9_HIGHBITDEPTH
256 if (!use_high_bit_depth_) {
257 data8[h * stride + w] = fill_constant;
259 data16[h * stride + w] = fill_constant;
262 data[h * stride + w] = fill_constant;
268 void FillRandom(uint8_t *data, int stride) {
269 #if CONFIG_VP9_HIGHBITDEPTH
270 uint8_t *data8 = data;
271 uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
273 for (int h = 0; h < height_; ++h) {
274 for (int w = 0; w < width_; ++w) {
275 #if CONFIG_VP9_HIGHBITDEPTH
276 if (!use_high_bit_depth_) {
277 data8[h * stride + w] = rnd_.Rand8();
279 data16[h * stride + w] = rnd_.Rand16() & mask_;
282 data[h * stride + w] = rnd_.Rand8();
288 int width_, height_, mask_, bd_;
289 vpx_bit_depth_t bit_depth_;
290 static uint8_t *source_data_;
291 static uint8_t *reference_data_;
292 static uint8_t *second_pred_;
294 #if CONFIG_VP9_HIGHBITDEPTH
295 bool use_high_bit_depth_;
296 static uint8_t *source_data8_;
297 static uint8_t *reference_data8_;
298 static uint8_t *second_pred8_;
299 static uint16_t *source_data16_;
300 static uint16_t *reference_data16_;
301 static uint16_t *second_pred16_;
303 int reference_stride_;
309 : public SADTestBase,
310 public ::testing::WithParamInterface<SadMxNx4Param> {
312 SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
315 void SADs(unsigned int *results) {
316 const uint8_t *refs[] = {GetReference(0), GetReference(1),
317 GetReference(2), GetReference(3)};
319 ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
320 refs, reference_stride_,
325 unsigned int reference_sad, exp_sad[4];
328 for (int block = 0; block < 4; ++block) {
329 reference_sad = ReferenceSAD(UINT_MAX, block);
331 EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
336 #if CONFIG_VP8_ENCODER
338 : public SADTestBase,
339 public ::testing::WithParamInterface<SadMxNParam> {
341 SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
344 unsigned int SAD(unsigned int max_sad, int block_idx) {
346 const uint8_t *const reference = GetReference(block_idx);
348 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
349 reference, reference_stride_,
354 void CheckSAD(unsigned int max_sad) {
355 const unsigned int reference_sad = ReferenceSAD(max_sad, 0);
356 const unsigned int exp_sad = SAD(max_sad, 0);
358 if (reference_sad <= max_sad) {
359 ASSERT_EQ(exp_sad, reference_sad);
361 // Alternative implementations are not required to check max_sad
362 ASSERT_GE(exp_sad, reference_sad);
366 #endif // CONFIG_VP8_ENCODER
368 #if CONFIG_VP9_ENCODER
370 : public SADTestBase,
371 public ::testing::WithParamInterface<SadMxNVp9Param> {
373 SADVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
376 unsigned int SAD(int block_idx) {
378 const uint8_t *const reference = GetReference(block_idx);
380 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
381 reference, reference_stride_));
386 const unsigned int reference_sad = ReferenceSAD(UINT_MAX, 0);
387 const unsigned int exp_sad = SAD(0);
389 ASSERT_EQ(reference_sad, exp_sad);
394 : public SADTestBase,
395 public ::testing::WithParamInterface<SadMxNAvgVp9Param> {
397 SADavgVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
400 unsigned int SAD_avg(int block_idx) {
402 const uint8_t *const reference = GetReference(block_idx);
404 ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
405 reference, reference_stride_,
411 const unsigned int reference_sad = ReferenceSADavg(UINT_MAX, 0);
412 const unsigned int exp_sad = SAD_avg(0);
414 ASSERT_EQ(reference_sad, exp_sad);
417 #endif // CONFIG_VP9_ENCODER
419 uint8_t *SADTestBase::source_data_ = NULL;
420 uint8_t *SADTestBase::reference_data_ = NULL;
421 uint8_t *SADTestBase::second_pred_ = NULL;
422 #if CONFIG_VP9_ENCODER && CONFIG_VP9_HIGHBITDEPTH
423 uint8_t *SADTestBase::source_data8_ = NULL;
424 uint8_t *SADTestBase::reference_data8_ = NULL;
425 uint8_t *SADTestBase::second_pred8_ = NULL;
426 uint16_t *SADTestBase::source_data16_ = NULL;
427 uint16_t *SADTestBase::reference_data16_ = NULL;
428 uint16_t *SADTestBase::second_pred16_ = NULL;
431 #if CONFIG_VP8_ENCODER
432 TEST_P(SADTest, MaxRef) {
433 FillConstant(source_data_, source_stride_, 0);
434 FillConstant(reference_data_, reference_stride_, mask_);
438 TEST_P(SADTest, MaxSrc) {
439 FillConstant(source_data_, source_stride_, mask_);
440 FillConstant(reference_data_, reference_stride_, 0);
444 TEST_P(SADTest, ShortRef) {
445 int tmp_stride = reference_stride_;
446 reference_stride_ >>= 1;
447 FillRandom(source_data_, source_stride_);
448 FillRandom(reference_data_, reference_stride_);
450 reference_stride_ = tmp_stride;
453 TEST_P(SADTest, UnalignedRef) {
454 // The reference frame, but not the source frame, may be unaligned for
455 // certain types of searches.
456 const int tmp_stride = reference_stride_;
457 reference_stride_ -= 1;
458 FillRandom(source_data_, source_stride_);
459 FillRandom(reference_data_, reference_stride_);
461 reference_stride_ = tmp_stride;
464 TEST_P(SADTest, ShortSrc) {
465 const int tmp_stride = source_stride_;
466 source_stride_ >>= 1;
467 FillRandom(source_data_, source_stride_);
468 FillRandom(reference_data_, reference_stride_);
470 source_stride_ = tmp_stride;
473 TEST_P(SADTest, MaxSAD) {
474 // Verify that, when max_sad is set, the implementation does not return a
475 // value lower than the reference.
476 FillConstant(source_data_, source_stride_, mask_);
477 FillConstant(reference_data_, reference_stride_, 0);
480 #endif // CONFIG_VP8_ENCODER
482 #if CONFIG_VP9_ENCODER
483 TEST_P(SADVP9Test, MaxRef) {
484 FillConstant(source_data_, source_stride_, 0);
485 FillConstant(reference_data_, reference_stride_, mask_);
489 TEST_P(SADVP9Test, MaxSrc) {
490 FillConstant(source_data_, source_stride_, mask_);
491 FillConstant(reference_data_, reference_stride_, 0);
495 TEST_P(SADVP9Test, ShortRef) {
496 const int tmp_stride = reference_stride_;
497 reference_stride_ >>= 1;
498 FillRandom(source_data_, source_stride_);
499 FillRandom(reference_data_, reference_stride_);
501 reference_stride_ = tmp_stride;
504 TEST_P(SADVP9Test, UnalignedRef) {
505 // The reference frame, but not the source frame, may be unaligned for
506 // certain types of searches.
507 const int tmp_stride = reference_stride_;
508 reference_stride_ -= 1;
509 FillRandom(source_data_, source_stride_);
510 FillRandom(reference_data_, reference_stride_);
512 reference_stride_ = tmp_stride;
515 TEST_P(SADVP9Test, ShortSrc) {
516 const int tmp_stride = source_stride_;
517 source_stride_ >>= 1;
518 FillRandom(source_data_, source_stride_);
519 FillRandom(reference_data_, reference_stride_);
521 source_stride_ = tmp_stride;
524 TEST_P(SADavgVP9Test, MaxRef) {
525 FillConstant(source_data_, source_stride_, 0);
526 FillConstant(reference_data_, reference_stride_, mask_);
527 FillConstant(second_pred_, width_, 0);
530 TEST_P(SADavgVP9Test, MaxSrc) {
531 FillConstant(source_data_, source_stride_, mask_);
532 FillConstant(reference_data_, reference_stride_, 0);
533 FillConstant(second_pred_, width_, 0);
537 TEST_P(SADavgVP9Test, ShortRef) {
538 const int tmp_stride = reference_stride_;
539 reference_stride_ >>= 1;
540 FillRandom(source_data_, source_stride_);
541 FillRandom(reference_data_, reference_stride_);
542 FillRandom(second_pred_, width_);
544 reference_stride_ = tmp_stride;
547 TEST_P(SADavgVP9Test, UnalignedRef) {
548 // The reference frame, but not the source frame, may be unaligned for
549 // certain types of searches.
550 const int tmp_stride = reference_stride_;
551 reference_stride_ -= 1;
552 FillRandom(source_data_, source_stride_);
553 FillRandom(reference_data_, reference_stride_);
554 FillRandom(second_pred_, width_);
556 reference_stride_ = tmp_stride;
559 TEST_P(SADavgVP9Test, ShortSrc) {
560 const int tmp_stride = source_stride_;
561 source_stride_ >>= 1;
562 FillRandom(source_data_, source_stride_);
563 FillRandom(reference_data_, reference_stride_);
564 FillRandom(second_pred_, width_);
566 source_stride_ = tmp_stride;
568 #endif // CONFIG_VP9_ENCODER
570 TEST_P(SADx4Test, MaxRef) {
571 FillConstant(source_data_, source_stride_, 0);
572 FillConstant(GetReference(0), reference_stride_, mask_);
573 FillConstant(GetReference(1), reference_stride_, mask_);
574 FillConstant(GetReference(2), reference_stride_, mask_);
575 FillConstant(GetReference(3), reference_stride_, mask_);
579 TEST_P(SADx4Test, MaxSrc) {
580 FillConstant(source_data_, source_stride_, mask_);
581 FillConstant(GetReference(0), reference_stride_, 0);
582 FillConstant(GetReference(1), reference_stride_, 0);
583 FillConstant(GetReference(2), reference_stride_, 0);
584 FillConstant(GetReference(3), reference_stride_, 0);
588 TEST_P(SADx4Test, ShortRef) {
589 int tmp_stride = reference_stride_;
590 reference_stride_ >>= 1;
591 FillRandom(source_data_, source_stride_);
592 FillRandom(GetReference(0), reference_stride_);
593 FillRandom(GetReference(1), reference_stride_);
594 FillRandom(GetReference(2), reference_stride_);
595 FillRandom(GetReference(3), reference_stride_);
597 reference_stride_ = tmp_stride;
600 TEST_P(SADx4Test, UnalignedRef) {
601 // The reference frame, but not the source frame, may be unaligned for
602 // certain types of searches.
603 int tmp_stride = reference_stride_;
604 reference_stride_ -= 1;
605 FillRandom(source_data_, source_stride_);
606 FillRandom(GetReference(0), reference_stride_);
607 FillRandom(GetReference(1), reference_stride_);
608 FillRandom(GetReference(2), reference_stride_);
609 FillRandom(GetReference(3), reference_stride_);
611 reference_stride_ = tmp_stride;
614 TEST_P(SADx4Test, ShortSrc) {
615 int tmp_stride = source_stride_;
616 source_stride_ >>= 1;
617 FillRandom(source_data_, source_stride_);
618 FillRandom(GetReference(0), reference_stride_);
619 FillRandom(GetReference(1), reference_stride_);
620 FillRandom(GetReference(2), reference_stride_);
621 FillRandom(GetReference(3), reference_stride_);
623 source_stride_ = tmp_stride;
626 TEST_P(SADx4Test, SrcAlignedByWidth) {
627 uint8_t * tmp_source_data = source_data_;
628 source_data_ += width_;
629 FillRandom(source_data_, source_stride_);
630 FillRandom(GetReference(0), reference_stride_);
631 FillRandom(GetReference(1), reference_stride_);
632 FillRandom(GetReference(2), reference_stride_);
633 FillRandom(GetReference(3), reference_stride_);
635 source_data_ = tmp_source_data;
638 using std::tr1::make_tuple;
640 //------------------------------------------------------------------------------
642 #if CONFIG_VP8_ENCODER
643 const SadMxNFunc sad_16x16_c = vp8_sad16x16_c;
644 const SadMxNFunc sad_8x16_c = vp8_sad8x16_c;
645 const SadMxNFunc sad_16x8_c = vp8_sad16x8_c;
646 const SadMxNFunc sad_8x8_c = vp8_sad8x8_c;
647 const SadMxNFunc sad_4x4_c = vp8_sad4x4_c;
648 const SadMxNParam c_tests[] = {
649 make_tuple(16, 16, sad_16x16_c, -1),
650 make_tuple(8, 16, sad_8x16_c, -1),
651 make_tuple(16, 8, sad_16x8_c, -1),
652 make_tuple(8, 8, sad_8x8_c, -1),
653 make_tuple(4, 4, sad_4x4_c, -1),
655 INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
656 #endif // CONFIG_VP8_ENCODER
658 #if CONFIG_VP9_ENCODER
659 const SadMxNVp9Func sad_64x64_c_vp9 = vp9_sad64x64_c;
660 const SadMxNVp9Func sad_32x32_c_vp9 = vp9_sad32x32_c;
661 const SadMxNVp9Func sad_16x16_c_vp9 = vp9_sad16x16_c;
662 const SadMxNVp9Func sad_8x16_c_vp9 = vp9_sad8x16_c;
663 const SadMxNVp9Func sad_16x8_c_vp9 = vp9_sad16x8_c;
664 const SadMxNVp9Func sad_8x8_c_vp9 = vp9_sad8x8_c;
665 const SadMxNVp9Func sad_8x4_c_vp9 = vp9_sad8x4_c;
666 const SadMxNVp9Func sad_4x8_c_vp9 = vp9_sad4x8_c;
667 const SadMxNVp9Func sad_4x4_c_vp9 = vp9_sad4x4_c;
668 const SadMxNVp9Param c_vp9_tests[] = {
669 make_tuple(64, 64, sad_64x64_c_vp9, -1),
670 make_tuple(32, 32, sad_32x32_c_vp9, -1),
671 make_tuple(16, 16, sad_16x16_c_vp9, -1),
672 make_tuple(8, 16, sad_8x16_c_vp9, -1),
673 make_tuple(16, 8, sad_16x8_c_vp9, -1),
674 make_tuple(8, 8, sad_8x8_c_vp9, -1),
675 make_tuple(8, 4, sad_8x4_c_vp9, -1),
676 make_tuple(4, 8, sad_4x8_c_vp9, -1),
677 make_tuple(4, 4, sad_4x4_c_vp9, -1),
679 INSTANTIATE_TEST_CASE_P(C, SADVP9Test, ::testing::ValuesIn(c_vp9_tests));
681 const SadMxNx4Func sad_64x64x4d_c = vp9_sad64x64x4d_c;
682 const SadMxNx4Func sad_64x32x4d_c = vp9_sad64x32x4d_c;
683 const SadMxNx4Func sad_32x64x4d_c = vp9_sad32x64x4d_c;
684 const SadMxNx4Func sad_32x32x4d_c = vp9_sad32x32x4d_c;
685 const SadMxNx4Func sad_32x16x4d_c = vp9_sad32x16x4d_c;
686 const SadMxNx4Func sad_16x32x4d_c = vp9_sad16x32x4d_c;
687 const SadMxNx4Func sad_16x16x4d_c = vp9_sad16x16x4d_c;
688 const SadMxNx4Func sad_16x8x4d_c = vp9_sad16x8x4d_c;
689 const SadMxNx4Func sad_8x16x4d_c = vp9_sad8x16x4d_c;
690 const SadMxNx4Func sad_8x8x4d_c = vp9_sad8x8x4d_c;
691 const SadMxNx4Func sad_8x4x4d_c = vp9_sad8x4x4d_c;
692 const SadMxNx4Func sad_4x8x4d_c = vp9_sad4x8x4d_c;
693 const SadMxNx4Func sad_4x4x4d_c = vp9_sad4x4x4d_c;
694 INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values(
695 make_tuple(64, 64, sad_64x64x4d_c, -1),
696 make_tuple(64, 32, sad_64x32x4d_c, -1),
697 make_tuple(32, 64, sad_32x64x4d_c, -1),
698 make_tuple(32, 32, sad_32x32x4d_c, -1),
699 make_tuple(32, 16, sad_32x16x4d_c, -1),
700 make_tuple(16, 32, sad_16x32x4d_c, -1),
701 make_tuple(16, 16, sad_16x16x4d_c, -1),
702 make_tuple(16, 8, sad_16x8x4d_c, -1),
703 make_tuple(8, 16, sad_8x16x4d_c, -1),
704 make_tuple(8, 8, sad_8x8x4d_c, -1),
705 make_tuple(8, 4, sad_8x4x4d_c, -1),
706 make_tuple(4, 8, sad_4x8x4d_c, -1),
707 make_tuple(4, 4, sad_4x4x4d_c, -1)));
709 #if CONFIG_VP9_HIGHBITDEPTH
710 const SadMxNVp9Func highbd_sad_64x64_c_vp9 = vp9_highbd_sad64x64_c;
711 const SadMxNVp9Func highbd_sad_32x32_c_vp9 = vp9_highbd_sad32x32_c;
712 const SadMxNVp9Func highbd_sad_16x16_c_vp9 = vp9_highbd_sad16x16_c;
713 const SadMxNVp9Func highbd_sad_8x16_c_vp9 = vp9_highbd_sad8x16_c;
714 const SadMxNVp9Func highbd_sad_16x8_c_vp9 = vp9_highbd_sad16x8_c;
715 const SadMxNVp9Func highbd_sad_8x8_c_vp9 = vp9_highbd_sad8x8_c;
716 const SadMxNVp9Func highbd_sad_8x4_c_vp9 = vp9_highbd_sad8x4_c;
717 const SadMxNVp9Func highbd_sad_4x8_c_vp9 = vp9_highbd_sad4x8_c;
718 const SadMxNVp9Func highbd_sad_4x4_c_vp9 = vp9_highbd_sad4x4_c;
719 const SadMxNVp9Param c_vp9_highbd_8_tests[] = {
720 make_tuple(64, 64, highbd_sad_64x64_c_vp9, 8),
721 make_tuple(32, 32, highbd_sad_32x32_c_vp9, 8),
722 make_tuple(16, 16, highbd_sad_16x16_c_vp9, 8),
723 make_tuple(8, 16, highbd_sad_8x16_c_vp9, 8),
724 make_tuple(16, 8, highbd_sad_16x8_c_vp9, 8),
725 make_tuple(8, 8, highbd_sad_8x8_c_vp9, 8),
726 make_tuple(8, 4, highbd_sad_8x4_c_vp9, 8),
727 make_tuple(4, 8, highbd_sad_4x8_c_vp9, 8),
728 make_tuple(4, 4, highbd_sad_4x4_c_vp9, 8),
730 INSTANTIATE_TEST_CASE_P(C_8, SADVP9Test,
731 ::testing::ValuesIn(c_vp9_highbd_8_tests));
733 const SadMxNVp9Param c_vp9_highbd_10_tests[] = {
734 make_tuple(64, 64, highbd_sad_64x64_c_vp9, 10),
735 make_tuple(32, 32, highbd_sad_32x32_c_vp9, 10),
736 make_tuple(16, 16, highbd_sad_16x16_c_vp9, 10),
737 make_tuple(8, 16, highbd_sad_8x16_c_vp9, 10),
738 make_tuple(16, 8, highbd_sad_16x8_c_vp9, 10),
739 make_tuple(8, 8, highbd_sad_8x8_c_vp9, 10),
740 make_tuple(8, 4, highbd_sad_8x4_c_vp9, 10),
741 make_tuple(4, 8, highbd_sad_4x8_c_vp9, 10),
742 make_tuple(4, 4, highbd_sad_4x4_c_vp9, 10),
744 INSTANTIATE_TEST_CASE_P(C_10, SADVP9Test,
745 ::testing::ValuesIn(c_vp9_highbd_10_tests));
747 const SadMxNVp9Param c_vp9_highbd_12_tests[] = {
748 make_tuple(64, 64, highbd_sad_64x64_c_vp9, 12),
749 make_tuple(32, 32, highbd_sad_32x32_c_vp9, 12),
750 make_tuple(16, 16, highbd_sad_16x16_c_vp9, 12),
751 make_tuple(8, 16, highbd_sad_8x16_c_vp9, 12),
752 make_tuple(16, 8, highbd_sad_16x8_c_vp9, 12),
753 make_tuple(8, 8, highbd_sad_8x8_c_vp9, 12),
754 make_tuple(8, 4, highbd_sad_8x4_c_vp9, 12),
755 make_tuple(4, 8, highbd_sad_4x8_c_vp9, 12),
756 make_tuple(4, 4, highbd_sad_4x4_c_vp9, 12),
758 INSTANTIATE_TEST_CASE_P(C_12, SADVP9Test,
759 ::testing::ValuesIn(c_vp9_highbd_12_tests));
761 const SadMxNAvgVp9Func highbd_sad8x4_avg_c_vp9 = vp9_highbd_sad8x4_avg_c;
762 const SadMxNAvgVp9Func highbd_sad8x8_avg_c_vp9 = vp9_highbd_sad8x8_avg_c;
763 const SadMxNAvgVp9Func highbd_sad8x16_avg_c_vp9 = vp9_highbd_sad8x16_avg_c;
764 const SadMxNAvgVp9Func highbd_sad16x8_avg_c_vp9 = vp9_highbd_sad16x8_avg_c;
765 const SadMxNAvgVp9Func highbd_sad16x16_avg_c_vp9 = vp9_highbd_sad16x16_avg_c;
766 const SadMxNAvgVp9Func highbd_sad16x32_avg_c_vp9 = vp9_highbd_sad16x32_avg_c;
767 const SadMxNAvgVp9Func highbd_sad32x16_avg_c_vp9 = vp9_highbd_sad32x16_avg_c;
768 const SadMxNAvgVp9Func highbd_sad32x32_avg_c_vp9 = vp9_highbd_sad32x32_avg_c;
769 const SadMxNAvgVp9Func highbd_sad32x64_avg_c_vp9 = vp9_highbd_sad32x64_avg_c;
770 const SadMxNAvgVp9Func highbd_sad64x32_avg_c_vp9 = vp9_highbd_sad64x32_avg_c;
771 const SadMxNAvgVp9Func highbd_sad64x64_avg_c_vp9 = vp9_highbd_sad64x64_avg_c;
772 SadMxNAvgVp9Param avg_c_vp9_highbd_8_tests[] = {
773 make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 8),
774 make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 8),
775 make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 8),
776 make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 8),
777 make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 8),
778 make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 8),
779 make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 8),
780 make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 8),
781 make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 8),
782 make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 8),
783 make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 8)};
784 INSTANTIATE_TEST_CASE_P(C_8, SADavgVP9Test,
785 ::testing::ValuesIn(avg_c_vp9_highbd_8_tests));
787 SadMxNAvgVp9Param avg_c_vp9_highbd_10_tests[] = {
788 make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 10),
789 make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 10),
790 make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 10),
791 make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 10),
792 make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 10),
793 make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 10),
794 make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 10),
795 make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 10),
796 make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 10),
797 make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 10),
798 make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 10)};
799 INSTANTIATE_TEST_CASE_P(C_10, SADavgVP9Test,
800 ::testing::ValuesIn(avg_c_vp9_highbd_10_tests));
802 SadMxNAvgVp9Param avg_c_vp9_highbd_12_tests[] = {
803 make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 12),
804 make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 12),
805 make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 12),
806 make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 12),
807 make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 12),
808 make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 12),
809 make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 12),
810 make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 12),
811 make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 12),
812 make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 12),
813 make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 12)};
814 INSTANTIATE_TEST_CASE_P(C_12, SADavgVP9Test,
815 ::testing::ValuesIn(avg_c_vp9_highbd_12_tests));
817 const SadMxNx4Func highbd_sad_64x64x4d_c = vp9_highbd_sad64x64x4d_c;
818 const SadMxNx4Func highbd_sad_64x32x4d_c = vp9_highbd_sad64x32x4d_c;
819 const SadMxNx4Func highbd_sad_32x64x4d_c = vp9_highbd_sad32x64x4d_c;
820 const SadMxNx4Func highbd_sad_32x32x4d_c = vp9_highbd_sad32x32x4d_c;
821 const SadMxNx4Func highbd_sad_32x16x4d_c = vp9_highbd_sad32x16x4d_c;
822 const SadMxNx4Func highbd_sad_16x32x4d_c = vp9_highbd_sad16x32x4d_c;
823 const SadMxNx4Func highbd_sad_16x16x4d_c = vp9_highbd_sad16x16x4d_c;
824 const SadMxNx4Func highbd_sad_16x8x4d_c = vp9_highbd_sad16x8x4d_c;
825 const SadMxNx4Func highbd_sad_8x16x4d_c = vp9_highbd_sad8x16x4d_c;
826 const SadMxNx4Func highbd_sad_8x8x4d_c = vp9_highbd_sad8x8x4d_c;
827 const SadMxNx4Func highbd_sad_8x4x4d_c = vp9_highbd_sad8x4x4d_c;
828 const SadMxNx4Func highbd_sad_4x8x4d_c = vp9_highbd_sad4x8x4d_c;
829 const SadMxNx4Func highbd_sad_4x4x4d_c = vp9_highbd_sad4x4x4d_c;
830 INSTANTIATE_TEST_CASE_P(C_8, SADx4Test, ::testing::Values(
831 make_tuple(64, 64, highbd_sad_64x64x4d_c, 8),
832 make_tuple(64, 32, highbd_sad_64x32x4d_c, 8),
833 make_tuple(32, 64, highbd_sad_32x64x4d_c, 8),
834 make_tuple(32, 32, highbd_sad_32x32x4d_c, 8),
835 make_tuple(32, 16, highbd_sad_32x16x4d_c, 8),
836 make_tuple(16, 32, highbd_sad_16x32x4d_c, 8),
837 make_tuple(16, 16, highbd_sad_16x16x4d_c, 8),
838 make_tuple(16, 8, highbd_sad_16x8x4d_c, 8),
839 make_tuple(8, 16, highbd_sad_8x16x4d_c, 8),
840 make_tuple(8, 8, highbd_sad_8x8x4d_c, 8),
841 make_tuple(8, 4, highbd_sad_8x4x4d_c, 8),
842 make_tuple(4, 8, highbd_sad_4x8x4d_c, 8),
843 make_tuple(4, 4, highbd_sad_4x4x4d_c, 8)));
845 INSTANTIATE_TEST_CASE_P(C_10, SADx4Test, ::testing::Values(
846 make_tuple(64, 64, highbd_sad_64x64x4d_c, 10),
847 make_tuple(64, 32, highbd_sad_64x32x4d_c, 10),
848 make_tuple(32, 64, highbd_sad_32x64x4d_c, 10),
849 make_tuple(32, 32, highbd_sad_32x32x4d_c, 10),
850 make_tuple(32, 16, highbd_sad_32x16x4d_c, 10),
851 make_tuple(16, 32, highbd_sad_16x32x4d_c, 10),
852 make_tuple(16, 16, highbd_sad_16x16x4d_c, 10),
853 make_tuple(16, 8, highbd_sad_16x8x4d_c, 10),
854 make_tuple(8, 16, highbd_sad_8x16x4d_c, 10),
855 make_tuple(8, 8, highbd_sad_8x8x4d_c, 10),
856 make_tuple(8, 4, highbd_sad_8x4x4d_c, 10),
857 make_tuple(4, 8, highbd_sad_4x8x4d_c, 10),
858 make_tuple(4, 4, highbd_sad_4x4x4d_c, 10)));
860 INSTANTIATE_TEST_CASE_P(C_12, SADx4Test, ::testing::Values(
861 make_tuple(64, 64, highbd_sad_64x64x4d_c, 12),
862 make_tuple(64, 32, highbd_sad_64x32x4d_c, 12),
863 make_tuple(32, 64, highbd_sad_32x64x4d_c, 12),
864 make_tuple(32, 32, highbd_sad_32x32x4d_c, 12),
865 make_tuple(32, 16, highbd_sad_32x16x4d_c, 12),
866 make_tuple(16, 32, highbd_sad_16x32x4d_c, 12),
867 make_tuple(16, 16, highbd_sad_16x16x4d_c, 12),
868 make_tuple(16, 8, highbd_sad_16x8x4d_c, 12),
869 make_tuple(8, 16, highbd_sad_8x16x4d_c, 12),
870 make_tuple(8, 8, highbd_sad_8x8x4d_c, 12),
871 make_tuple(8, 4, highbd_sad_8x4x4d_c, 12),
872 make_tuple(4, 8, highbd_sad_4x8x4d_c, 12),
873 make_tuple(4, 4, highbd_sad_4x4x4d_c, 12)));
874 #endif // CONFIG_VP9_HIGHBITDEPTH
875 #endif // CONFIG_VP9_ENCODER
877 //------------------------------------------------------------------------------
880 #if CONFIG_VP8_ENCODER
881 const SadMxNFunc sad_16x16_armv6 = vp8_sad16x16_armv6;
882 INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values(
883 make_tuple(16, 16, sad_16x16_armv6, -1)));
884 #endif // CONFIG_VP8_ENCODER
888 #if CONFIG_VP8_ENCODER
889 const SadMxNFunc sad_16x16_neon = vp8_sad16x16_neon;
890 const SadMxNFunc sad_8x16_neon = vp8_sad8x16_neon;
891 const SadMxNFunc sad_16x8_neon = vp8_sad16x8_neon;
892 const SadMxNFunc sad_8x8_neon = vp8_sad8x8_neon;
893 const SadMxNFunc sad_4x4_neon = vp8_sad4x4_neon;
894 INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
895 make_tuple(16, 16, sad_16x16_neon, -1),
896 make_tuple(8, 16, sad_8x16_neon, -1),
897 make_tuple(16, 8, sad_16x8_neon, -1),
898 make_tuple(8, 8, sad_8x8_neon, -1),
899 make_tuple(4, 4, sad_4x4_neon, -1)));
900 #endif // CONFIG_VP8_ENCODER
901 #if CONFIG_VP9_ENCODER
902 const SadMxNVp9Func sad_64x64_neon_vp9 = vp9_sad64x64_neon;
903 const SadMxNVp9Func sad_32x32_neon_vp9 = vp9_sad32x32_neon;
904 const SadMxNVp9Func sad_16x16_neon_vp9 = vp9_sad16x16_neon;
905 const SadMxNVp9Func sad_8x8_neon_vp9 = vp9_sad8x8_neon;
906 const SadMxNVp9Param neon_vp9_tests[] = {
907 make_tuple(64, 64, sad_64x64_neon_vp9, -1),
908 make_tuple(32, 32, sad_32x32_neon_vp9, -1),
909 make_tuple(16, 16, sad_16x16_neon_vp9, -1),
910 make_tuple(8, 8, sad_8x8_neon_vp9, -1),
912 INSTANTIATE_TEST_CASE_P(NEON, SADVP9Test, ::testing::ValuesIn(neon_vp9_tests));
913 #endif // CONFIG_VP9_ENCODER
916 //------------------------------------------------------------------------------
919 #if CONFIG_VP8_ENCODER
920 const SadMxNFunc sad_16x16_mmx = vp8_sad16x16_mmx;
921 const SadMxNFunc sad_8x16_mmx = vp8_sad8x16_mmx;
922 const SadMxNFunc sad_16x8_mmx = vp8_sad16x8_mmx;
923 const SadMxNFunc sad_8x8_mmx = vp8_sad8x8_mmx;
924 const SadMxNFunc sad_4x4_mmx = vp8_sad4x4_mmx;
925 const SadMxNParam mmx_tests[] = {
926 make_tuple(16, 16, sad_16x16_mmx, -1),
927 make_tuple(8, 16, sad_8x16_mmx, -1),
928 make_tuple(16, 8, sad_16x8_mmx, -1),
929 make_tuple(8, 8, sad_8x8_mmx, -1),
930 make_tuple(4, 4, sad_4x4_mmx, -1),
932 INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
933 #endif // CONFIG_VP8_ENCODER
938 #if CONFIG_VP9_ENCODER
939 #if CONFIG_USE_X86INC
940 const SadMxNVp9Func sad_4x4_sse_vp9 = vp9_sad4x4_sse;
941 const SadMxNVp9Func sad_4x8_sse_vp9 = vp9_sad4x8_sse;
942 INSTANTIATE_TEST_CASE_P(SSE, SADVP9Test, ::testing::Values(
943 make_tuple(4, 4, sad_4x4_sse_vp9, -1),
944 make_tuple(4, 8, sad_4x8_sse_vp9, -1)));
946 const SadMxNx4Func sad_4x8x4d_sse = vp9_sad4x8x4d_sse;
947 const SadMxNx4Func sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
948 INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values(
949 make_tuple(4, 8, sad_4x8x4d_sse, -1),
950 make_tuple(4, 4, sad_4x4x4d_sse, -1)));
951 #endif // CONFIG_USE_X86INC
952 #endif // CONFIG_VP9_ENCODER
956 #if CONFIG_VP8_ENCODER
957 const SadMxNFunc sad_16x16_wmt = vp8_sad16x16_wmt;
958 const SadMxNFunc sad_8x16_wmt = vp8_sad8x16_wmt;
959 const SadMxNFunc sad_16x8_wmt = vp8_sad16x8_wmt;
960 const SadMxNFunc sad_8x8_wmt = vp8_sad8x8_wmt;
961 const SadMxNFunc sad_4x4_wmt = vp8_sad4x4_wmt;
962 const SadMxNParam sse2_tests[] = {
963 make_tuple(16, 16, sad_16x16_wmt, -1),
964 make_tuple(8, 16, sad_8x16_wmt, -1),
965 make_tuple(16, 8, sad_16x8_wmt, -1),
966 make_tuple(8, 8, sad_8x8_wmt, -1),
967 make_tuple(4, 4, sad_4x4_wmt, -1),
969 INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
970 #endif // CONFIG_VP8_ENCODER
972 #if CONFIG_VP9_ENCODER
973 #if CONFIG_USE_X86INC
974 const SadMxNVp9Func sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
975 const SadMxNVp9Func sad_64x32_sse2_vp9 = vp9_sad64x32_sse2;
976 const SadMxNVp9Func sad_32x64_sse2_vp9 = vp9_sad32x64_sse2;
977 const SadMxNVp9Func sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
978 const SadMxNVp9Func sad_32x16_sse2_vp9 = vp9_sad32x16_sse2;
979 const SadMxNVp9Func sad_16x32_sse2_vp9 = vp9_sad16x32_sse2;
980 const SadMxNVp9Func sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
981 const SadMxNVp9Func sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
982 const SadMxNVp9Func sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
983 const SadMxNVp9Func sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
984 const SadMxNVp9Func sad_8x4_sse2_vp9 = vp9_sad8x4_sse2;
986 const SadMxNx4Func sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
987 const SadMxNx4Func sad_64x32x4d_sse2 = vp9_sad64x32x4d_sse2;
988 const SadMxNx4Func sad_32x64x4d_sse2 = vp9_sad32x64x4d_sse2;
989 const SadMxNx4Func sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
990 const SadMxNx4Func sad_32x16x4d_sse2 = vp9_sad32x16x4d_sse2;
991 const SadMxNx4Func sad_16x32x4d_sse2 = vp9_sad16x32x4d_sse2;
992 const SadMxNx4Func sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
993 const SadMxNx4Func sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
994 const SadMxNx4Func sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
995 const SadMxNx4Func sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
996 const SadMxNx4Func sad_8x4x4d_sse2 = vp9_sad8x4x4d_sse2;
998 #if CONFIG_VP9_HIGHBITDEPTH
999 const SadMxNVp9Func highbd_sad8x4_sse2_vp9 = vp9_highbd_sad8x4_sse2;
1000 const SadMxNVp9Func highbd_sad8x8_sse2_vp9 = vp9_highbd_sad8x8_sse2;
1001 const SadMxNVp9Func highbd_sad8x16_sse2_vp9 = vp9_highbd_sad8x16_sse2;
1002 const SadMxNVp9Func highbd_sad16x8_sse2_vp9 = vp9_highbd_sad16x8_sse2;
1003 const SadMxNVp9Func highbd_sad16x16_sse2_vp9 = vp9_highbd_sad16x16_sse2;
1004 const SadMxNVp9Func highbd_sad16x32_sse2_vp9 = vp9_highbd_sad16x32_sse2;
1005 const SadMxNVp9Func highbd_sad32x16_sse2_vp9 = vp9_highbd_sad32x16_sse2;
1006 const SadMxNVp9Func highbd_sad32x32_sse2_vp9 = vp9_highbd_sad32x32_sse2;
1007 const SadMxNVp9Func highbd_sad32x64_sse2_vp9 = vp9_highbd_sad32x64_sse2;
1008 const SadMxNVp9Func highbd_sad64x32_sse2_vp9 = vp9_highbd_sad64x32_sse2;
1009 const SadMxNVp9Func highbd_sad64x64_sse2_vp9 = vp9_highbd_sad64x64_sse2;
1011 INSTANTIATE_TEST_CASE_P(SSE2, SADVP9Test, ::testing::Values(
1012 make_tuple(64, 64, sad_64x64_sse2_vp9, -1),
1013 make_tuple(64, 32, sad_64x32_sse2_vp9, -1),
1014 make_tuple(32, 64, sad_32x64_sse2_vp9, -1),
1015 make_tuple(32, 32, sad_32x32_sse2_vp9, -1),
1016 make_tuple(32, 16, sad_32x16_sse2_vp9, -1),
1017 make_tuple(16, 32, sad_16x32_sse2_vp9, -1),
1018 make_tuple(16, 16, sad_16x16_sse2_vp9, -1),
1019 make_tuple(16, 8, sad_16x8_sse2_vp9, -1),
1020 make_tuple(8, 16, sad_8x16_sse2_vp9, -1),
1021 make_tuple(8, 8, sad_8x8_sse2_vp9, -1),
1022 make_tuple(8, 4, sad_8x4_sse2_vp9, -1),
1023 make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 8),
1024 make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 8),
1025 make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 8),
1026 make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 8),
1027 make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 8),
1028 make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 8),
1029 make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 8),
1030 make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 8),
1031 make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 8),
1032 make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 8),
1033 make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 8),
1034 make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 10),
1035 make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 10),
1036 make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 10),
1037 make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 10),
1038 make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 10),
1039 make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 10),
1040 make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 10),
1041 make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 10),
1042 make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 10),
1043 make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 10),
1044 make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 10),
1045 make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 12),
1046 make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 12),
1047 make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 12),
1048 make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 12),
1049 make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 12),
1050 make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 12),
1051 make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 12),
1052 make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 12),
1053 make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 12),
1054 make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 12),
1055 make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 12)));
1057 const SadMxNAvgVp9Func highbd_sad8x4_avg_sse2_vp9 = vp9_highbd_sad8x4_avg_sse2;
1058 const SadMxNAvgVp9Func highbd_sad8x8_avg_sse2_vp9 = vp9_highbd_sad8x8_avg_sse2;
1059 const SadMxNAvgVp9Func highbd_sad8x16_avg_sse2_vp9 =
1060 vp9_highbd_sad8x16_avg_sse2;
1061 const SadMxNAvgVp9Func highbd_sad16x8_avg_sse2_vp9 =
1062 vp9_highbd_sad16x8_avg_sse2;
1063 const SadMxNAvgVp9Func highbd_sad16x16_avg_sse2_vp9 =
1064 vp9_highbd_sad16x16_avg_sse2;
1065 const SadMxNAvgVp9Func highbd_sad16x32_avg_sse2_vp9 =
1066 vp9_highbd_sad16x32_avg_sse2;
1067 const SadMxNAvgVp9Func highbd_sad32x16_avg_sse2_vp9 =
1068 vp9_highbd_sad32x16_avg_sse2;
1069 const SadMxNAvgVp9Func highbd_sad32x32_avg_sse2_vp9 =
1070 vp9_highbd_sad32x32_avg_sse2;
1071 const SadMxNAvgVp9Func highbd_sad32x64_avg_sse2_vp9 =
1072 vp9_highbd_sad32x64_avg_sse2;
1073 const SadMxNAvgVp9Func highbd_sad64x32_avg_sse2_vp9 =
1074 vp9_highbd_sad64x32_avg_sse2;
1075 const SadMxNAvgVp9Func highbd_sad64x64_avg_sse2_vp9 =
1076 vp9_highbd_sad64x64_avg_sse2;
1078 INSTANTIATE_TEST_CASE_P(SSE2, SADavgVP9Test, ::testing::Values(
1079 make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 8),
1080 make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 8),
1081 make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 8),
1082 make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 8),
1083 make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 8),
1084 make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 8),
1085 make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 8),
1086 make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 8),
1087 make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 8),
1088 make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 8),
1089 make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 8),
1090 make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 10),
1091 make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 10),
1092 make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 10),
1093 make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 10),
1094 make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 10),
1095 make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 10),
1096 make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 10),
1097 make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 10),
1098 make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 10),
1099 make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 10),
1100 make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 10),
1101 make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 12),
1102 make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 12),
1103 make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 12),
1104 make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 12),
1105 make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 12),
1106 make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 12),
1107 make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 12),
1108 make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 12),
1109 make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 12),
1110 make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 12),
1111 make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 12)));
1113 const SadMxNx4Func highbd_sad_64x64x4d_sse2 = vp9_highbd_sad64x64x4d_sse2;
1114 const SadMxNx4Func highbd_sad_64x32x4d_sse2 = vp9_highbd_sad64x32x4d_sse2;
1115 const SadMxNx4Func highbd_sad_32x64x4d_sse2 = vp9_highbd_sad32x64x4d_sse2;
1116 const SadMxNx4Func highbd_sad_32x32x4d_sse2 = vp9_highbd_sad32x32x4d_sse2;
1117 const SadMxNx4Func highbd_sad_32x16x4d_sse2 = vp9_highbd_sad32x16x4d_sse2;
1118 const SadMxNx4Func highbd_sad_16x32x4d_sse2 = vp9_highbd_sad16x32x4d_sse2;
1119 const SadMxNx4Func highbd_sad_16x16x4d_sse2 = vp9_highbd_sad16x16x4d_sse2;
1120 const SadMxNx4Func highbd_sad_16x8x4d_sse2 = vp9_highbd_sad16x8x4d_sse2;
1121 const SadMxNx4Func highbd_sad_8x16x4d_sse2 = vp9_highbd_sad8x16x4d_sse2;
1122 const SadMxNx4Func highbd_sad_8x8x4d_sse2 = vp9_highbd_sad8x8x4d_sse2;
1123 const SadMxNx4Func highbd_sad_8x4x4d_sse2 = vp9_highbd_sad8x4x4d_sse2;
1124 const SadMxNx4Func highbd_sad_4x8x4d_sse2 = vp9_highbd_sad4x8x4d_sse2;
1125 const SadMxNx4Func highbd_sad_4x4x4d_sse2 = vp9_highbd_sad4x4x4d_sse2;
1127 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
1128 make_tuple(64, 64, sad_64x64x4d_sse2, -1),
1129 make_tuple(64, 32, sad_64x32x4d_sse2, -1),
1130 make_tuple(32, 64, sad_32x64x4d_sse2, -1),
1131 make_tuple(32, 32, sad_32x32x4d_sse2, -1),
1132 make_tuple(32, 16, sad_32x16x4d_sse2, -1),
1133 make_tuple(16, 32, sad_16x32x4d_sse2, -1),
1134 make_tuple(16, 16, sad_16x16x4d_sse2, -1),
1135 make_tuple(16, 8, sad_16x8x4d_sse2, -1),
1136 make_tuple(8, 16, sad_8x16x4d_sse2, -1),
1137 make_tuple(8, 8, sad_8x8x4d_sse2, -1),
1138 make_tuple(8, 4, sad_8x4x4d_sse2, -1),
1139 make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 8),
1140 make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 8),
1141 make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 8),
1142 make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 8),
1143 make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 8),
1144 make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 8),
1145 make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 8),
1146 make_tuple(16, 8, highbd_sad_16x8x4d_sse2, 8),
1147 make_tuple(8, 16, highbd_sad_8x16x4d_sse2, 8),
1148 make_tuple(8, 8, highbd_sad_8x8x4d_sse2, 8),
1149 make_tuple(8, 4, highbd_sad_8x4x4d_sse2, 8),
1150 make_tuple(4, 8, highbd_sad_4x8x4d_sse2, 8),
1151 make_tuple(4, 4, highbd_sad_4x4x4d_sse2, 8),
1152 make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 10),
1153 make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 10),
1154 make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 10),
1155 make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 10),
1156 make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 10),
1157 make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 10),
1158 make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 10),
1159 make_tuple(16, 8, highbd_sad_16x8x4d_sse2, 10),
1160 make_tuple(8, 16, highbd_sad_8x16x4d_sse2, 10),
1161 make_tuple(8, 8, highbd_sad_8x8x4d_sse2, 10),
1162 make_tuple(8, 4, highbd_sad_8x4x4d_sse2, 10),
1163 make_tuple(4, 8, highbd_sad_4x8x4d_sse2, 10),
1164 make_tuple(4, 4, highbd_sad_4x4x4d_sse2, 10),
1165 make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 12),
1166 make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 12),
1167 make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 12),
1168 make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 12),
1169 make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 12),
1170 make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 12),
1171 make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 12),
1172 make_tuple(16, 8, highbd_sad_16x8x4d_sse2, 12),
1173 make_tuple(8, 16, highbd_sad_8x16x4d_sse2, 12),
1174 make_tuple(8, 8, highbd_sad_8x8x4d_sse2, 12),
1175 make_tuple(8, 4, highbd_sad_8x4x4d_sse2, 12),
1176 make_tuple(4, 8, highbd_sad_4x8x4d_sse2, 12),
1177 make_tuple(4, 4, highbd_sad_4x4x4d_sse2, 12)));
1179 INSTANTIATE_TEST_CASE_P(SSE2, SADVP9Test, ::testing::Values(
1180 make_tuple(64, 64, sad_64x64_sse2_vp9, -1),
1181 make_tuple(64, 32, sad_64x32_sse2_vp9, -1),
1182 make_tuple(32, 64, sad_32x64_sse2_vp9, -1),
1183 make_tuple(32, 32, sad_32x32_sse2_vp9, -1),
1184 make_tuple(32, 16, sad_32x16_sse2_vp9, -1),
1185 make_tuple(16, 32, sad_16x32_sse2_vp9, -1),
1186 make_tuple(16, 16, sad_16x16_sse2_vp9, -1),
1187 make_tuple(16, 8, sad_16x8_sse2_vp9, -1),
1188 make_tuple(8, 16, sad_8x16_sse2_vp9, -1),
1189 make_tuple(8, 8, sad_8x8_sse2_vp9, -1),
1190 make_tuple(8, 4, sad_8x4_sse2_vp9, -1)));
1192 INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
1193 make_tuple(64, 64, sad_64x64x4d_sse2, -1),
1194 make_tuple(64, 32, sad_64x32x4d_sse2, -1),
1195 make_tuple(32, 64, sad_32x64x4d_sse2, -1),
1196 make_tuple(32, 32, sad_32x32x4d_sse2, -1),
1197 make_tuple(32, 16, sad_32x16x4d_sse2, -1),
1198 make_tuple(16, 32, sad_16x32x4d_sse2, -1),
1199 make_tuple(16, 16, sad_16x16x4d_sse2, -1),
1200 make_tuple(16, 8, sad_16x8x4d_sse2, -1),
1201 make_tuple(8, 16, sad_8x16x4d_sse2, -1),
1202 make_tuple(8, 8, sad_8x8x4d_sse2, -1),
1203 make_tuple(8, 4, sad_8x4x4d_sse2, -1)));
1204 #endif // CONFIG_VP9_HIGHBITDEPTH
1205 #endif // CONFIG_USE_X86INC
1206 #endif // CONFIG_VP9_ENCODER
1210 #if CONFIG_VP8_ENCODER
1211 const SadMxNx4Func sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
1212 const SadMxNx4Func sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
1213 const SadMxNx4Func sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
1214 const SadMxNx4Func sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
1215 const SadMxNx4Func sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
1216 INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values(
1217 make_tuple(16, 16, sad_16x16x4d_sse3, -1),
1218 make_tuple(16, 8, sad_16x8x4d_sse3, -1),
1219 make_tuple(8, 16, sad_8x16x4d_sse3, -1),
1220 make_tuple(8, 8, sad_8x8x4d_sse3, -1),
1221 make_tuple(4, 4, sad_4x4x4d_sse3, -1)));
1222 #endif // CONFIG_VP8_ENCODER
1226 #if CONFIG_USE_X86INC
1227 #if CONFIG_VP8_ENCODER
1228 const SadMxNFunc sad_16x16_sse3 = vp8_sad16x16_sse3;
1229 INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
1230 make_tuple(16, 16, sad_16x16_sse3, -1)));
1231 #endif // CONFIG_VP8_ENCODER
1232 #endif // CONFIG_USE_X86INC
1233 #endif // HAVE_SSSE3
1236 #if CONFIG_VP9_ENCODER
1237 const SadMxNx4Func sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2;
1238 const SadMxNx4Func sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2;
1239 INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::Values(
1240 make_tuple(32, 32, sad_32x32x4d_avx2, -1),
1241 make_tuple(64, 64, sad_64x64x4d_avx2, -1)));
1242 #endif // CONFIG_VP9_ENCODER