sad_test.cc 52.3 KB
Newer Older
Johann's avatar
Johann committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */


#include <string.h>
#include <limits.h>
#include <stdio.h>

#include "./vpx_config.h"
17
#if CONFIG_VP8_ENCODER
18
#include "./vp8_rtcd.h"
19 20 21 22
#endif
#if CONFIG_VP9_ENCODER
#include "./vp9_rtcd.h"
#endif
23
#include "vpx_mem/vpx_mem.h"
Johann's avatar
Johann committed
24 25

#include "test/acm_random.h"
26
#include "test/clear_system_state.h"
27
#include "test/register_state_check.h"
Johann's avatar
Johann committed
28 29
#include "test/util.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
30
#include "vpx/vpx_codec.h"
Johann's avatar
Johann committed
31 32


33
#if CONFIG_VP8_ENCODER
34 35 36 37 38
typedef unsigned int (*SadMxNFunc)(const unsigned char *source_ptr,
                                   int source_stride,
                                   const unsigned char *reference_ptr,
                                   int reference_stride,
                                   unsigned int max_sad);
39
typedef std::tr1::tuple<int, int, SadMxNFunc, int> SadMxNParam;
40 41
#endif
#if CONFIG_VP9_ENCODER
42 43 44 45
typedef unsigned int (*SadMxNVp9Func)(const unsigned char *source_ptr,
                                      int source_stride,
                                      const unsigned char *reference_ptr,
                                      int reference_stride);
46 47 48 49 50 51 52
typedef std::tr1::tuple<int, int, SadMxNVp9Func, int> SadMxNVp9Param;
typedef uint32_t (*SadMxNAvgVp9Func)(const uint8_t *source_ptr,
                                     int source_stride,
                                     const uint8_t *reference_ptr,
                                     int reference_stride,
                                     const uint8_t *second_pred);
typedef std::tr1::tuple<int, int, SadMxNAvgVp9Func, int> SadMxNAvgVp9Param;
53
#endif
Johann's avatar
Johann committed
54

55 56
typedef void (*SadMxNx4Func)(const uint8_t *src_ptr,
                             int src_stride,
57
                             const uint8_t *const ref_ptr[],
58
                             int ref_stride,
59 60
                             uint32_t *sad_array);
typedef std::tr1::tuple<int, int, SadMxNx4Func, int> SadMxNx4Param;
61

Johann's avatar
Johann committed
62 63 64
using libvpx_test::ACMRandom;

namespace {
65
class SADTestBase : public ::testing::Test {
66
 public:
67 68
  SADTestBase(int width, int height, int bit_depth) :
      width_(width), height_(height), bd_(bit_depth) {}
69

70
  static void SetUpTestCase() {
71 72 73 74 75 76 77 78 79 80 81 82 83 84
#if CONFIG_VP9_HIGHBITDEPTH
    source_data8_ = reinterpret_cast<uint8_t*>(
        vpx_memalign(kDataAlignment, kDataBlockSize));
    reference_data8_ = reinterpret_cast<uint8_t*>(
        vpx_memalign(kDataAlignment, kDataBufferSize));
    second_pred8_ = reinterpret_cast<uint8_t*>(
        vpx_memalign(kDataAlignment, 64*64));
    source_data16_ = reinterpret_cast<uint16_t*>(
        vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));
    reference_data16_ = reinterpret_cast<uint16_t*>(
        vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));
    second_pred16_ = reinterpret_cast<uint16_t*>(
        vpx_memalign(kDataAlignment, 64*64*sizeof(uint16_t)));
#else
85
    source_data_ = reinterpret_cast<uint8_t*>(
86
        vpx_memalign(kDataAlignment, kDataBlockSize));
87 88
    reference_data_ = reinterpret_cast<uint8_t*>(
        vpx_memalign(kDataAlignment, kDataBufferSize));
89 90 91
    second_pred_ = reinterpret_cast<uint8_t*>(
        vpx_memalign(kDataAlignment, 64*64));
#endif
92 93 94
  }

  static void TearDownTestCase() {
95 96 97 98 99 100 101 102 103 104 105 106 107 108
#if CONFIG_VP9_HIGHBITDEPTH
    vpx_free(source_data8_);
    source_data8_ = NULL;
    vpx_free(reference_data8_);
    reference_data8_ = NULL;
    vpx_free(second_pred8_);
    second_pred8_ = NULL;
    vpx_free(source_data16_);
    source_data16_ = NULL;
    vpx_free(reference_data16_);
    reference_data16_ = NULL;
    vpx_free(second_pred16_);
    second_pred16_ = NULL;
#else
109 110 111 112
    vpx_free(source_data_);
    source_data_ = NULL;
    vpx_free(reference_data_);
    reference_data_ = NULL;
113 114 115
    vpx_free(second_pred_);
    second_pred_ = NULL;
#endif
116 117
  }

118 119 120 121
  virtual void TearDown() {
    libvpx_test::ClearSystemState();
  }

122
 protected:
123
  // Handle blocks up to 4 blocks 64x64 with stride up to 128
124
  static const int kDataAlignment = 16;
125 126
  static const int kDataBlockSize = 64 * 128;
  static const int kDataBufferSize = 4 * kDataBlockSize;
127

Johann's avatar
Johann committed
128
  virtual void SetUp() {
129 130 131 132 133 134 135 136 137 138 139 140 141 142
#if CONFIG_VP9_HIGHBITDEPTH
    if (bd_ == -1) {
      use_high_bit_depth_ = false;
      bit_depth_ = VPX_BITS_8;
      source_data_ = source_data8_;
      reference_data_ = reference_data8_;
      second_pred_ = second_pred8_;
    } else {
      use_high_bit_depth_ = true;
      bit_depth_ = static_cast<vpx_bit_depth_t>(bd_);
      source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
      reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
      second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
    }
143 144
#else
    bit_depth_ = VPX_BITS_8;
145 146
#endif
    mask_ = (1 << bit_depth_) - 1;
147
    source_stride_ = (width_ + 31) & ~31;
Johann's avatar
Johann committed
148 149 150 151
    reference_stride_ = width_ * 2;
    rnd_.Reset(ACMRandom::DeterministicSeed());
  }

152 153 154 155 156 157 158 159 160
  virtual uint8_t *GetReference(int block_idx) {
#if CONFIG_VP9_HIGHBITDEPTH
    if (!use_high_bit_depth_) {
      return reference_data_ + block_idx * kDataBlockSize;
    } else {
      return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
                                block_idx * kDataBlockSize);
    }
#else
161
    return reference_data_ + block_idx * kDataBlockSize;
162
#endif
Johann's avatar
Johann committed
163 164 165 166
  }

  // Sum of Absolute Differences. Given two blocks, calculate the absolute
  // difference between two pixels in the same relative location; accumulate.
167
  unsigned int ReferenceSAD(unsigned int max_sad, int block_idx) {
Johann's avatar
Johann committed
168
    unsigned int sad = 0;
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
#if CONFIG_VP9_HIGHBITDEPTH
      const uint8_t *const reference8 = GetReference(block_idx);
      const uint8_t *const source8 = source_data_;
      const uint16_t *const reference16 =
          CONVERT_TO_SHORTPTR(GetReference(block_idx));
      const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
#else
    const uint8_t *const reference = GetReference(block_idx);
    const uint8_t *const source = source_data_;
#endif
    for (int h = 0; h < height_; ++h) {
      for (int w = 0; w < width_; ++w) {
#if CONFIG_VP9_HIGHBITDEPTH
        if (!use_high_bit_depth_) {
          sad +=
              abs(source8[h * source_stride_ + w] -
                  reference8[h * reference_stride_ + w]);
        } else {
          sad +=
              abs(source16[h * source_stride_ + w] -
                  reference16[h * reference_stride_ + w]);
        }
#else
        sad +=
            abs(source[h * source_stride_ + w] -
                reference[h * reference_stride_ + w]);
#endif
      }
      if (sad > max_sad) {
        break;
      }
    }
    return sad;
  }
Johann's avatar
Johann committed
203

204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
  // Sum of Absolute Differences Average. Given two blocks, and a prediction
  // calculate the absolute difference between one pixel and average of the
  // corresponding and predicted pixels; accumulate.
  unsigned int ReferenceSADavg(unsigned int max_sad, int block_idx) {
    unsigned int sad = 0;
#if CONFIG_VP9_HIGHBITDEPTH
      const uint8_t *const reference8 = GetReference(block_idx);
      const uint8_t *const source8 = source_data_;
      const uint8_t *const second_pred8 = second_pred_;
      const uint16_t *const reference16 =
          CONVERT_TO_SHORTPTR(GetReference(block_idx));
      const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
      const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
#else
    const uint8_t *const reference = GetReference(block_idx);
    const uint8_t *const source = source_data_;
    const uint8_t *const second_pred = second_pred_;
#endif
Johann's avatar
Johann committed
222 223
    for (int h = 0; h < height_; ++h) {
      for (int w = 0; w < width_; ++w) {
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
#if CONFIG_VP9_HIGHBITDEPTH
        if (!use_high_bit_depth_) {
          const int tmp = second_pred8[h * width_ + w] +
              reference8[h * reference_stride_ + w];
          const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
          sad += abs(source8[h * source_stride_ + w] - comp_pred);
        } else {
          const int tmp = second_pred16[h * width_ + w] +
              reference16[h * reference_stride_ + w];
          const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
          sad += abs(source16[h * source_stride_ + w] - comp_pred);
        }
#else
        const int tmp = second_pred[h * width_ + w] +
            reference[h * reference_stride_ + w];
James Zern's avatar
James Zern committed
239
        const uint8_t comp_pred = (tmp + 1) >> 1;
240 241
        sad += abs(source[h * source_stride_ + w] - comp_pred);
#endif
Johann's avatar
Johann committed
242
      }
243 244 245
      if (sad > max_sad) {
        break;
      }
Johann's avatar
Johann committed
246 247 248 249
    }
    return sad;
  }

250 251 252 253 254
  void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) {
#if CONFIG_VP9_HIGHBITDEPTH
    uint8_t *data8 = data;
    uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
#endif
Johann's avatar
Johann committed
255 256
    for (int h = 0; h < height_; ++h) {
      for (int w = 0; w < width_; ++w) {
257 258
#if CONFIG_VP9_HIGHBITDEPTH
        if (!use_high_bit_depth_) {
259
          data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
260 261 262 263
        } else {
          data16[h * stride + w] = fill_constant;
        }
#else
264
        data[h * stride + w] = static_cast<uint8_t>(fill_constant);
265
#endif
Johann's avatar
Johann committed
266 267 268 269 270
      }
    }
  }

  void FillRandom(uint8_t *data, int stride) {
271 272 273 274
#if CONFIG_VP9_HIGHBITDEPTH
    uint8_t *data8 = data;
    uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
#endif
Johann's avatar
Johann committed
275 276
    for (int h = 0; h < height_; ++h) {
      for (int w = 0; w < width_; ++w) {
277 278 279 280 281 282 283
#if CONFIG_VP9_HIGHBITDEPTH
        if (!use_high_bit_depth_) {
          data8[h * stride + w] = rnd_.Rand8();
        } else {
          data16[h * stride + w] = rnd_.Rand16() & mask_;
        }
#else
Johann's avatar
Johann committed
284
        data[h * stride + w] = rnd_.Rand8();
285
#endif
Johann's avatar
Johann committed
286 287 288 289
      }
    }
  }

290 291 292 293 294
  int width_, height_, mask_, bd_;
  vpx_bit_depth_t bit_depth_;
  static uint8_t *source_data_;
  static uint8_t *reference_data_;
  static uint8_t *second_pred_;
295
  int source_stride_;
296 297 298 299 300 301 302 303 304
#if CONFIG_VP9_HIGHBITDEPTH
  bool use_high_bit_depth_;
  static uint8_t *source_data8_;
  static uint8_t *reference_data8_;
  static uint8_t *second_pred8_;
  static uint16_t *source_data16_;
  static uint16_t *reference_data16_;
  static uint16_t *second_pred16_;
#endif
305 306 307 308 309
  int reference_stride_;

  ACMRandom rnd_;
};

310 311
class SADx4Test
    : public SADTestBase,
312
      public ::testing::WithParamInterface<SadMxNx4Param> {
313
 public:
314
  SADx4Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
315 316 317

 protected:
  void SADs(unsigned int *results) {
318
    const uint8_t *refs[] = {GetReference(0), GetReference(1),
319 320
                             GetReference(2), GetReference(3)};

321 322 323
    ASM_REGISTER_STATE_CHECK(GET_PARAM(2)(source_data_, source_stride_,
                                          refs, reference_stride_,
                                          results));
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
  }

  void CheckSADs() {
    unsigned int reference_sad, exp_sad[4];

    SADs(exp_sad);
    for (int block = 0; block < 4; ++block) {
      reference_sad = ReferenceSAD(UINT_MAX, block);

      EXPECT_EQ(reference_sad, exp_sad[block]) << "block " << block;
    }
  }
};

#if CONFIG_VP8_ENCODER
class SADTest
    : public SADTestBase,
341
      public ::testing::WithParamInterface<SadMxNParam> {
342
 public:
343
  SADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
344 345

 protected:
346
  unsigned int SAD(unsigned int max_sad, int block_idx) {
347
    unsigned int ret;
348
    const uint8_t *const reference = GetReference(block_idx);
349

350 351 352
    ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
                                                reference, reference_stride_,
                                                max_sad));
353 354 355
    return ret;
  }

356 357 358
  void CheckSAD(unsigned int max_sad) {
    const unsigned int reference_sad = ReferenceSAD(max_sad, 0);
    const unsigned int exp_sad = SAD(max_sad, 0);
Johann's avatar
Johann committed
359 360 361 362 363 364 365 366

    if (reference_sad <= max_sad) {
      ASSERT_EQ(exp_sad, reference_sad);
    } else {
      // Alternative implementations are not required to check max_sad
      ASSERT_GE(exp_sad, reference_sad);
    }
  }
367
};
368
#endif  // CONFIG_VP8_ENCODER
Johann's avatar
Johann committed
369

370 371 372
#if CONFIG_VP9_ENCODER
class SADVP9Test
    : public SADTestBase,
373
      public ::testing::WithParamInterface<SadMxNVp9Param> {
374
 public:
375
  SADVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
Johann's avatar
Johann committed
376

377
 protected:
378 379
  unsigned int SAD(int block_idx) {
    unsigned int ret;
380
    const uint8_t *const reference = GetReference(block_idx);
381

382 383
    ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
                                                reference, reference_stride_));
384
    return ret;
385 386
  }

387 388 389
  void CheckSAD() {
    const unsigned int reference_sad = ReferenceSAD(UINT_MAX, 0);
    const unsigned int exp_sad = SAD(0);
390

391
    ASSERT_EQ(reference_sad, exp_sad);
392
  }
Johann's avatar
Johann committed
393
};
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418

class SADavgVP9Test
    : public SADTestBase,
      public ::testing::WithParamInterface<SadMxNAvgVp9Param> {
 public:
  SADavgVP9Test() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}

 protected:
  unsigned int SAD_avg(int block_idx) {
    unsigned int ret;
    const uint8_t *const reference = GetReference(block_idx);

    ASM_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
                                                reference, reference_stride_,
                                                second_pred_));
    return ret;
  }

  void CheckSAD() {
    const unsigned int reference_sad = ReferenceSADavg(UINT_MAX, 0);
    const unsigned int exp_sad = SAD_avg(0);

    ASSERT_EQ(reference_sad, exp_sad);
  }
};
419
#endif  // CONFIG_VP9_ENCODER
Johann's avatar
Johann committed
420

421 422 423 424 425 426 427 428 429 430 431
uint8_t *SADTestBase::source_data_ = NULL;
uint8_t *SADTestBase::reference_data_ = NULL;
uint8_t *SADTestBase::second_pred_ = NULL;
#if CONFIG_VP9_ENCODER && CONFIG_VP9_HIGHBITDEPTH
uint8_t *SADTestBase::source_data8_ = NULL;
uint8_t *SADTestBase::reference_data8_ = NULL;
uint8_t *SADTestBase::second_pred8_ = NULL;
uint16_t *SADTestBase::source_data16_ = NULL;
uint16_t *SADTestBase::reference_data16_ = NULL;
uint16_t *SADTestBase::second_pred16_ = NULL;
#endif
432

433
#if CONFIG_VP8_ENCODER
Johann's avatar
Johann committed
434 435
TEST_P(SADTest, MaxRef) {
  FillConstant(source_data_, source_stride_, 0);
436
  FillConstant(reference_data_, reference_stride_, mask_);
437 438 439 440
  CheckSAD(UINT_MAX);
}

TEST_P(SADTest, MaxSrc) {
441
  FillConstant(source_data_, source_stride_, mask_);
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
  FillConstant(reference_data_, reference_stride_, 0);
  CheckSAD(UINT_MAX);
}

TEST_P(SADTest, ShortRef) {
  int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD(UINT_MAX);
  reference_stride_ = tmp_stride;
}

TEST_P(SADTest, UnalignedRef) {
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  const int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD(UINT_MAX);
  reference_stride_ = tmp_stride;
}

TEST_P(SADTest, ShortSrc) {
  const int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD(UINT_MAX);
  source_stride_ = tmp_stride;
}

TEST_P(SADTest, MaxSAD) {
  // Verify that, when max_sad is set, the implementation does not return a
  // value lower than the reference.
478
  FillConstant(source_data_, source_stride_, mask_);
479 480 481 482 483 484 485 486
  FillConstant(reference_data_, reference_stride_, 0);
  CheckSAD(128);
}
#endif  // CONFIG_VP8_ENCODER

#if CONFIG_VP9_ENCODER
TEST_P(SADVP9Test, MaxRef) {
  FillConstant(source_data_, source_stride_, 0);
487
  FillConstant(reference_data_, reference_stride_, mask_);
488 489 490 491
  CheckSAD();
}

TEST_P(SADVP9Test, MaxSrc) {
492
  FillConstant(source_data_, source_stride_, mask_);
493 494
  FillConstant(reference_data_, reference_stride_, 0);
  CheckSAD();
Johann's avatar
Johann committed
495 496
}

497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
TEST_P(SADVP9Test, ShortRef) {
  const int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

TEST_P(SADVP9Test, UnalignedRef) {
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  const int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

TEST_P(SADVP9Test, ShortSrc) {
  const int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  source_stride_ = tmp_stride;
}
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569

TEST_P(SADavgVP9Test, MaxRef) {
  FillConstant(source_data_, source_stride_, 0);
  FillConstant(reference_data_, reference_stride_, mask_);
  FillConstant(second_pred_, width_, 0);
  CheckSAD();
}
TEST_P(SADavgVP9Test, MaxSrc) {
  FillConstant(source_data_, source_stride_, mask_);
  FillConstant(reference_data_, reference_stride_, 0);
  FillConstant(second_pred_, width_, 0);
  CheckSAD();
}

TEST_P(SADavgVP9Test, ShortRef) {
  const int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  FillRandom(second_pred_, width_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

TEST_P(SADavgVP9Test, UnalignedRef) {
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  const int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  FillRandom(second_pred_, width_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

TEST_P(SADavgVP9Test, ShortSrc) {
  const int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  FillRandom(second_pred_, width_);
  CheckSAD();
  source_stride_ = tmp_stride;
}
570 571
#endif  // CONFIG_VP9_ENCODER

572 573
TEST_P(SADx4Test, MaxRef) {
  FillConstant(source_data_, source_stride_, 0);
574 575 576 577
  FillConstant(GetReference(0), reference_stride_, mask_);
  FillConstant(GetReference(1), reference_stride_, mask_);
  FillConstant(GetReference(2), reference_stride_, mask_);
  FillConstant(GetReference(3), reference_stride_, mask_);
578 579 580 581
  CheckSADs();
}

TEST_P(SADx4Test, MaxSrc) {
582
  FillConstant(source_data_, source_stride_, mask_);
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627
  FillConstant(GetReference(0), reference_stride_, 0);
  FillConstant(GetReference(1), reference_stride_, 0);
  FillConstant(GetReference(2), reference_stride_, 0);
  FillConstant(GetReference(3), reference_stride_, 0);
  CheckSADs();
}

TEST_P(SADx4Test, ShortRef) {
  int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(GetReference(0), reference_stride_);
  FillRandom(GetReference(1), reference_stride_);
  FillRandom(GetReference(2), reference_stride_);
  FillRandom(GetReference(3), reference_stride_);
  CheckSADs();
  reference_stride_ = tmp_stride;
}

TEST_P(SADx4Test, UnalignedRef) {
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(GetReference(0), reference_stride_);
  FillRandom(GetReference(1), reference_stride_);
  FillRandom(GetReference(2), reference_stride_);
  FillRandom(GetReference(3), reference_stride_);
  CheckSADs();
  reference_stride_ = tmp_stride;
}

TEST_P(SADx4Test, ShortSrc) {
  int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(GetReference(0), reference_stride_);
  FillRandom(GetReference(1), reference_stride_);
  FillRandom(GetReference(2), reference_stride_);
  FillRandom(GetReference(3), reference_stride_);
  CheckSADs();
  source_stride_ = tmp_stride;
}

628 629 630 631 632 633 634 635 636 637 638 639
TEST_P(SADx4Test, SrcAlignedByWidth) {
  uint8_t * tmp_source_data = source_data_;
  source_data_ += width_;
  FillRandom(source_data_, source_stride_);
  FillRandom(GetReference(0), reference_stride_);
  FillRandom(GetReference(1), reference_stride_);
  FillRandom(GetReference(2), reference_stride_);
  FillRandom(GetReference(3), reference_stride_);
  CheckSADs();
  source_data_ = tmp_source_data;
}

James Zern's avatar
James Zern committed
640 641
using std::tr1::make_tuple;

642 643
//------------------------------------------------------------------------------
// C functions
644
#if CONFIG_VP8_ENCODER
645 646 647 648 649 650
const SadMxNFunc sad_16x16_c = vp8_sad16x16_c;
const SadMxNFunc sad_8x16_c = vp8_sad8x16_c;
const SadMxNFunc sad_16x8_c = vp8_sad16x8_c;
const SadMxNFunc sad_8x8_c = vp8_sad8x8_c;
const SadMxNFunc sad_4x4_c = vp8_sad4x4_c;
const SadMxNParam c_tests[] = {
651 652 653 654 655
  make_tuple(16, 16, sad_16x16_c, -1),
  make_tuple(8, 16, sad_8x16_c, -1),
  make_tuple(16, 8, sad_16x8_c, -1),
  make_tuple(8, 8, sad_8x8_c, -1),
  make_tuple(4, 4, sad_4x4_c, -1),
656 657 658 659
};
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
#endif  // CONFIG_VP8_ENCODER

660
#if CONFIG_VP9_ENCODER
661 662 663 664 665 666 667 668 669 670
const SadMxNVp9Func sad_64x64_c_vp9 = vp9_sad64x64_c;
const SadMxNVp9Func sad_32x32_c_vp9 = vp9_sad32x32_c;
const SadMxNVp9Func sad_16x16_c_vp9 = vp9_sad16x16_c;
const SadMxNVp9Func sad_8x16_c_vp9 = vp9_sad8x16_c;
const SadMxNVp9Func sad_16x8_c_vp9 = vp9_sad16x8_c;
const SadMxNVp9Func sad_8x8_c_vp9 = vp9_sad8x8_c;
const SadMxNVp9Func sad_8x4_c_vp9 = vp9_sad8x4_c;
const SadMxNVp9Func sad_4x8_c_vp9 = vp9_sad4x8_c;
const SadMxNVp9Func sad_4x4_c_vp9 = vp9_sad4x4_c;
const SadMxNVp9Param c_vp9_tests[] = {
671 672 673 674 675 676 677 678 679
  make_tuple(64, 64, sad_64x64_c_vp9, -1),
  make_tuple(32, 32, sad_32x32_c_vp9, -1),
  make_tuple(16, 16, sad_16x16_c_vp9, -1),
  make_tuple(8, 16, sad_8x16_c_vp9, -1),
  make_tuple(16, 8, sad_16x8_c_vp9, -1),
  make_tuple(8, 8, sad_8x8_c_vp9, -1),
  make_tuple(8, 4, sad_8x4_c_vp9, -1),
  make_tuple(4, 8, sad_4x8_c_vp9, -1),
  make_tuple(4, 4, sad_4x4_c_vp9, -1),
James Zern's avatar
James Zern committed
680
};
681
INSTANTIATE_TEST_CASE_P(C, SADVP9Test, ::testing::ValuesIn(c_vp9_tests));
Johann's avatar
Johann committed
682

683 684 685 686 687 688 689 690 691 692 693 694 695
const SadMxNx4Func sad_64x64x4d_c = vp9_sad64x64x4d_c;
const SadMxNx4Func sad_64x32x4d_c = vp9_sad64x32x4d_c;
const SadMxNx4Func sad_32x64x4d_c = vp9_sad32x64x4d_c;
const SadMxNx4Func sad_32x32x4d_c = vp9_sad32x32x4d_c;
const SadMxNx4Func sad_32x16x4d_c = vp9_sad32x16x4d_c;
const SadMxNx4Func sad_16x32x4d_c = vp9_sad16x32x4d_c;
const SadMxNx4Func sad_16x16x4d_c = vp9_sad16x16x4d_c;
const SadMxNx4Func sad_16x8x4d_c = vp9_sad16x8x4d_c;
const SadMxNx4Func sad_8x16x4d_c = vp9_sad8x16x4d_c;
const SadMxNx4Func sad_8x8x4d_c = vp9_sad8x8x4d_c;
const SadMxNx4Func sad_8x4x4d_c = vp9_sad8x4x4d_c;
const SadMxNx4Func sad_4x8x4d_c = vp9_sad4x8x4d_c;
const SadMxNx4Func sad_4x4x4d_c = vp9_sad4x4x4d_c;
696
INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::Values(
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
                        make_tuple(64, 64, sad_64x64x4d_c, -1),
                        make_tuple(64, 32, sad_64x32x4d_c, -1),
                        make_tuple(32, 64, sad_32x64x4d_c, -1),
                        make_tuple(32, 32, sad_32x32x4d_c, -1),
                        make_tuple(32, 16, sad_32x16x4d_c, -1),
                        make_tuple(16, 32, sad_16x32x4d_c, -1),
                        make_tuple(16, 16, sad_16x16x4d_c, -1),
                        make_tuple(16, 8, sad_16x8x4d_c, -1),
                        make_tuple(8, 16, sad_8x16x4d_c, -1),
                        make_tuple(8, 8, sad_8x8x4d_c, -1),
                        make_tuple(8, 4, sad_8x4x4d_c, -1),
                        make_tuple(4, 8, sad_4x8x4d_c, -1),
                        make_tuple(4, 4, sad_4x4x4d_c, -1)));

#if CONFIG_VP9_HIGHBITDEPTH
const SadMxNVp9Func highbd_sad_64x64_c_vp9 = vp9_highbd_sad64x64_c;
const SadMxNVp9Func highbd_sad_32x32_c_vp9 = vp9_highbd_sad32x32_c;
const SadMxNVp9Func highbd_sad_16x16_c_vp9 = vp9_highbd_sad16x16_c;
const SadMxNVp9Func highbd_sad_8x16_c_vp9 = vp9_highbd_sad8x16_c;
const SadMxNVp9Func highbd_sad_16x8_c_vp9 = vp9_highbd_sad16x8_c;
const SadMxNVp9Func highbd_sad_8x8_c_vp9 = vp9_highbd_sad8x8_c;
const SadMxNVp9Func highbd_sad_8x4_c_vp9 = vp9_highbd_sad8x4_c;
const SadMxNVp9Func highbd_sad_4x8_c_vp9 = vp9_highbd_sad4x8_c;
const SadMxNVp9Func highbd_sad_4x4_c_vp9 = vp9_highbd_sad4x4_c;
const SadMxNVp9Param c_vp9_highbd_8_tests[] = {
  make_tuple(64, 64, highbd_sad_64x64_c_vp9, 8),
  make_tuple(32, 32, highbd_sad_32x32_c_vp9, 8),
  make_tuple(16, 16, highbd_sad_16x16_c_vp9, 8),
  make_tuple(8, 16, highbd_sad_8x16_c_vp9, 8),
  make_tuple(16, 8, highbd_sad_16x8_c_vp9, 8),
  make_tuple(8, 8, highbd_sad_8x8_c_vp9, 8),
  make_tuple(8, 4, highbd_sad_8x4_c_vp9, 8),
  make_tuple(4, 8, highbd_sad_4x8_c_vp9, 8),
  make_tuple(4, 4, highbd_sad_4x4_c_vp9, 8),
};
INSTANTIATE_TEST_CASE_P(C_8, SADVP9Test,
                        ::testing::ValuesIn(c_vp9_highbd_8_tests));

const SadMxNVp9Param c_vp9_highbd_10_tests[] = {
  make_tuple(64, 64, highbd_sad_64x64_c_vp9, 10),
  make_tuple(32, 32, highbd_sad_32x32_c_vp9, 10),
  make_tuple(16, 16, highbd_sad_16x16_c_vp9, 10),
  make_tuple(8, 16, highbd_sad_8x16_c_vp9, 10),
  make_tuple(16, 8, highbd_sad_16x8_c_vp9, 10),
  make_tuple(8, 8, highbd_sad_8x8_c_vp9, 10),
  make_tuple(8, 4, highbd_sad_8x4_c_vp9, 10),
  make_tuple(4, 8, highbd_sad_4x8_c_vp9, 10),
  make_tuple(4, 4, highbd_sad_4x4_c_vp9, 10),
};
INSTANTIATE_TEST_CASE_P(C_10, SADVP9Test,
                        ::testing::ValuesIn(c_vp9_highbd_10_tests));

const SadMxNVp9Param c_vp9_highbd_12_tests[] = {
  make_tuple(64, 64, highbd_sad_64x64_c_vp9, 12),
  make_tuple(32, 32, highbd_sad_32x32_c_vp9, 12),
  make_tuple(16, 16, highbd_sad_16x16_c_vp9, 12),
  make_tuple(8, 16, highbd_sad_8x16_c_vp9, 12),
  make_tuple(16, 8, highbd_sad_16x8_c_vp9, 12),
  make_tuple(8, 8, highbd_sad_8x8_c_vp9, 12),
  make_tuple(8, 4, highbd_sad_8x4_c_vp9, 12),
  make_tuple(4, 8, highbd_sad_4x8_c_vp9, 12),
  make_tuple(4, 4, highbd_sad_4x4_c_vp9, 12),
};
INSTANTIATE_TEST_CASE_P(C_12, SADVP9Test,
                        ::testing::ValuesIn(c_vp9_highbd_12_tests));

const SadMxNAvgVp9Func highbd_sad8x4_avg_c_vp9 = vp9_highbd_sad8x4_avg_c;
const SadMxNAvgVp9Func highbd_sad8x8_avg_c_vp9 = vp9_highbd_sad8x8_avg_c;
const SadMxNAvgVp9Func highbd_sad8x16_avg_c_vp9 = vp9_highbd_sad8x16_avg_c;
const SadMxNAvgVp9Func highbd_sad16x8_avg_c_vp9 = vp9_highbd_sad16x8_avg_c;
const SadMxNAvgVp9Func highbd_sad16x16_avg_c_vp9 = vp9_highbd_sad16x16_avg_c;
const SadMxNAvgVp9Func highbd_sad16x32_avg_c_vp9 = vp9_highbd_sad16x32_avg_c;
const SadMxNAvgVp9Func highbd_sad32x16_avg_c_vp9 = vp9_highbd_sad32x16_avg_c;
const SadMxNAvgVp9Func highbd_sad32x32_avg_c_vp9 = vp9_highbd_sad32x32_avg_c;
const SadMxNAvgVp9Func highbd_sad32x64_avg_c_vp9 = vp9_highbd_sad32x64_avg_c;
const SadMxNAvgVp9Func highbd_sad64x32_avg_c_vp9 = vp9_highbd_sad64x32_avg_c;
const SadMxNAvgVp9Func highbd_sad64x64_avg_c_vp9 = vp9_highbd_sad64x64_avg_c;
SadMxNAvgVp9Param avg_c_vp9_highbd_8_tests[] = {
  make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 8),
  make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 8),
  make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 8),
  make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 8),
  make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 8),
  make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 8),
  make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 8),
  make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 8),
  make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 8),
  make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 8),
  make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 8)};
INSTANTIATE_TEST_CASE_P(C_8, SADavgVP9Test,
                        ::testing::ValuesIn(avg_c_vp9_highbd_8_tests));

SadMxNAvgVp9Param avg_c_vp9_highbd_10_tests[] = {
  make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 10),
  make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 10),
  make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 10),
  make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 10),
  make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 10),
  make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 10),
  make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 10),
  make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 10),
  make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 10),
  make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 10),
  make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 10)};
INSTANTIATE_TEST_CASE_P(C_10, SADavgVP9Test,
                        ::testing::ValuesIn(avg_c_vp9_highbd_10_tests));

SadMxNAvgVp9Param avg_c_vp9_highbd_12_tests[] = {
  make_tuple(8, 4, highbd_sad8x4_avg_c_vp9, 12),
  make_tuple(8, 8, highbd_sad8x8_avg_c_vp9, 12),
  make_tuple(8, 16, highbd_sad8x16_avg_c_vp9, 12),
  make_tuple(16, 8, highbd_sad16x8_avg_c_vp9, 12),
  make_tuple(16, 16, highbd_sad16x16_avg_c_vp9, 12),
  make_tuple(16, 32, highbd_sad16x32_avg_c_vp9, 12),
  make_tuple(32, 16, highbd_sad32x16_avg_c_vp9, 12),
  make_tuple(32, 32, highbd_sad32x32_avg_c_vp9, 12),
  make_tuple(32, 64, highbd_sad32x64_avg_c_vp9, 12),
  make_tuple(64, 32, highbd_sad64x32_avg_c_vp9, 12),
  make_tuple(64, 64, highbd_sad64x64_avg_c_vp9, 12)};
INSTANTIATE_TEST_CASE_P(C_12, SADavgVP9Test,
                        ::testing::ValuesIn(avg_c_vp9_highbd_12_tests));

const SadMxNx4Func highbd_sad_64x64x4d_c = vp9_highbd_sad64x64x4d_c;
const SadMxNx4Func highbd_sad_64x32x4d_c = vp9_highbd_sad64x32x4d_c;
const SadMxNx4Func highbd_sad_32x64x4d_c = vp9_highbd_sad32x64x4d_c;
const SadMxNx4Func highbd_sad_32x32x4d_c = vp9_highbd_sad32x32x4d_c;
const SadMxNx4Func highbd_sad_32x16x4d_c = vp9_highbd_sad32x16x4d_c;
const SadMxNx4Func highbd_sad_16x32x4d_c = vp9_highbd_sad16x32x4d_c;
const SadMxNx4Func highbd_sad_16x16x4d_c = vp9_highbd_sad16x16x4d_c;
const SadMxNx4Func highbd_sad_16x8x4d_c  = vp9_highbd_sad16x8x4d_c;
const SadMxNx4Func highbd_sad_8x16x4d_c  = vp9_highbd_sad8x16x4d_c;
const SadMxNx4Func highbd_sad_8x8x4d_c   = vp9_highbd_sad8x8x4d_c;
const SadMxNx4Func highbd_sad_8x4x4d_c   = vp9_highbd_sad8x4x4d_c;
const SadMxNx4Func highbd_sad_4x8x4d_c   = vp9_highbd_sad4x8x4d_c;
const SadMxNx4Func highbd_sad_4x4x4d_c   = vp9_highbd_sad4x4x4d_c;
INSTANTIATE_TEST_CASE_P(C_8, SADx4Test, ::testing::Values(
                        make_tuple(64, 64, highbd_sad_64x64x4d_c, 8),
                        make_tuple(64, 32, highbd_sad_64x32x4d_c, 8),
                        make_tuple(32, 64, highbd_sad_32x64x4d_c, 8),
                        make_tuple(32, 32, highbd_sad_32x32x4d_c, 8),
                        make_tuple(32, 16, highbd_sad_32x16x4d_c, 8),
                        make_tuple(16, 32, highbd_sad_16x32x4d_c, 8),
                        make_tuple(16, 16, highbd_sad_16x16x4d_c, 8),
                        make_tuple(16, 8,  highbd_sad_16x8x4d_c,  8),
                        make_tuple(8,  16, highbd_sad_8x16x4d_c,  8),
                        make_tuple(8,  8,  highbd_sad_8x8x4d_c,   8),
                        make_tuple(8,  4,  highbd_sad_8x4x4d_c,   8),
                        make_tuple(4,  8,  highbd_sad_4x8x4d_c,   8),
                        make_tuple(4,  4,  highbd_sad_4x4x4d_c,   8)));

INSTANTIATE_TEST_CASE_P(C_10, SADx4Test, ::testing::Values(
                        make_tuple(64, 64, highbd_sad_64x64x4d_c, 10),
                        make_tuple(64, 32, highbd_sad_64x32x4d_c, 10),
                        make_tuple(32, 64, highbd_sad_32x64x4d_c, 10),
                        make_tuple(32, 32, highbd_sad_32x32x4d_c, 10),
                        make_tuple(32, 16, highbd_sad_32x16x4d_c, 10),
                        make_tuple(16, 32, highbd_sad_16x32x4d_c, 10),
                        make_tuple(16, 16, highbd_sad_16x16x4d_c, 10),
                        make_tuple(16, 8,  highbd_sad_16x8x4d_c,  10),
                        make_tuple(8,  16, highbd_sad_8x16x4d_c,  10),
                        make_tuple(8,  8,  highbd_sad_8x8x4d_c,   10),
                        make_tuple(8,  4,  highbd_sad_8x4x4d_c,   10),
                        make_tuple(4,  8,  highbd_sad_4x8x4d_c,   10),
                        make_tuple(4,  4,  highbd_sad_4x4x4d_c,   10)));

INSTANTIATE_TEST_CASE_P(C_12, SADx4Test, ::testing::Values(
                        make_tuple(64, 64, highbd_sad_64x64x4d_c, 12),
                        make_tuple(64, 32, highbd_sad_64x32x4d_c, 12),
                        make_tuple(32, 64, highbd_sad_32x64x4d_c, 12),
                        make_tuple(32, 32, highbd_sad_32x32x4d_c, 12),
                        make_tuple(32, 16, highbd_sad_32x16x4d_c, 12),
                        make_tuple(16, 32, highbd_sad_16x32x4d_c, 12),
                        make_tuple(16, 16, highbd_sad_16x16x4d_c, 12),
                        make_tuple(16, 8,  highbd_sad_16x8x4d_c,  12),
                        make_tuple(8,  16, highbd_sad_8x16x4d_c,  12),
                        make_tuple(8,  8,  highbd_sad_8x8x4d_c,   12),
                        make_tuple(8,  4,  highbd_sad_8x4x4d_c,   12),
                        make_tuple(4,  8,  highbd_sad_4x8x4d_c,   12),
                        make_tuple(4,  4,  highbd_sad_4x4x4d_c,   12)));
#endif  // CONFIG_VP9_HIGHBITDEPTH
877
#endif  // CONFIG_VP9_ENCODER
878

879 880
//------------------------------------------------------------------------------
// ARM functions
Johann's avatar
Johann committed
881
#if HAVE_MEDIA
882
#if CONFIG_VP8_ENCODER
883
const SadMxNFunc sad_16x16_armv6 = vp8_sad16x16_armv6;
Johann's avatar
Johann committed
884
INSTANTIATE_TEST_CASE_P(MEDIA, SADTest, ::testing::Values(
885
                        make_tuple(16, 16, sad_16x16_armv6, -1)));
886 887
#endif  // CONFIG_VP8_ENCODER
#endif  // HAVE_MEDIA
888

Johann's avatar
Johann committed
889
#if HAVE_NEON
890
#if CONFIG_VP8_ENCODER
891 892 893 894 895
const SadMxNFunc sad_16x16_neon = vp8_sad16x16_neon;
const SadMxNFunc sad_8x16_neon = vp8_sad8x16_neon;
const SadMxNFunc sad_16x8_neon = vp8_sad16x8_neon;
const SadMxNFunc sad_8x8_neon = vp8_sad8x8_neon;
const SadMxNFunc sad_4x4_neon = vp8_sad4x4_neon;
Johann's avatar
Johann committed
896
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
897 898 899 900 901
                        make_tuple(16, 16, sad_16x16_neon, -1),
                        make_tuple(8, 16, sad_8x16_neon, -1),
                        make_tuple(16, 8, sad_16x8_neon, -1),
                        make_tuple(8, 8, sad_8x8_neon, -1),
                        make_tuple(4, 4, sad_4x4_neon, -1)));
902
#endif  // CONFIG_VP8_ENCODER
903
#if CONFIG_VP9_ENCODER
904 905 906
const SadMxNVp9Func sad_64x64_neon_vp9 = vp9_sad64x64_neon;
const SadMxNVp9Func sad_32x32_neon_vp9 = vp9_sad32x32_neon;
const SadMxNVp9Func sad_16x16_neon_vp9 = vp9_sad16x16_neon;
Scott LaVarnway's avatar
Scott LaVarnway committed
907
const SadMxNVp9Func sad_8x8_neon_vp9 = vp9_sad8x8_neon;
908
const SadMxNVp9Param neon_vp9_tests[] = {
909 910 911 912
  make_tuple(64, 64, sad_64x64_neon_vp9, -1),
  make_tuple(32, 32, sad_32x32_neon_vp9, -1),
  make_tuple(16, 16, sad_16x16_neon_vp9, -1),
  make_tuple(8, 8, sad_8x8_neon_vp9, -1),
913 914 915
};
INSTANTIATE_TEST_CASE_P(NEON, SADVP9Test, ::testing::ValuesIn(neon_vp9_tests));
#endif  // CONFIG_VP9_ENCODER
916
#endif  // HAVE_NEON
Johann's avatar
Johann committed
917

918 919
//------------------------------------------------------------------------------
// x86 functions
Johann's avatar
Johann committed
920
#if HAVE_MMX
921
#if CONFIG_VP8_ENCODER
922 923 924 925 926 927
const SadMxNFunc sad_16x16_mmx = vp8_sad16x16_mmx;
const SadMxNFunc sad_8x16_mmx = vp8_sad8x16_mmx;
const SadMxNFunc sad_16x8_mmx = vp8_sad16x8_mmx;
const SadMxNFunc sad_8x8_mmx = vp8_sad8x8_mmx;
const SadMxNFunc sad_4x4_mmx = vp8_sad4x4_mmx;
const SadMxNParam mmx_tests[] = {
928 929 930 931 932
  make_tuple(16, 16, sad_16x16_mmx, -1),
  make_tuple(8, 16, sad_8x16_mmx, -1),
  make_tuple(16, 8, sad_16x8_mmx, -1),
  make_tuple(8, 8, sad_8x8_mmx, -1),
  make_tuple(4, 4, sad_4x4_mmx, -1),
933 934 935 936 937
};
INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::ValuesIn(mmx_tests));
#endif  // CONFIG_VP8_ENCODER

#endif  // HAVE_MMX
938 939 940

#if HAVE_SSE
#if CONFIG_VP9_ENCODER
Jim Bankoski's avatar
Jim Bankoski committed
941
#if CONFIG_USE_X86INC
942 943
const SadMxNVp9Func sad_4x4_sse_vp9 = vp9_sad4x4_sse;
const SadMxNVp9Func sad_4x8_sse_vp9 = vp9_sad4x8_sse;
944
INSTANTIATE_TEST_CASE_P(SSE, SADVP9Test, ::testing::Values(
945 946
                        make_tuple(4, 4, sad_4x4_sse_vp9, -1),
                        make_tuple(4, 8, sad_4x8_sse_vp9, -1)));
947

948 949
const SadMxNx4Func sad_4x8x4d_sse = vp9_sad4x8x4d_sse;
const SadMxNx4Func sad_4x4x4d_sse = vp9_sad4x4x4d_sse;
950
INSTANTIATE_TEST_CASE_P(SSE, SADx4Test, ::testing::Values(
951 952
                        make_tuple(4, 8, sad_4x8x4d_sse, -1),
                        make_tuple(4, 4, sad_4x4x4d_sse, -1)));
953 954 955
#endif  // CONFIG_USE_X86INC
#endif  // CONFIG_VP9_ENCODER
#endif  // HAVE_SSE
956

Johann's avatar
Johann committed
957
#if HAVE_SSE2
958
#if CONFIG_VP8_ENCODER
959 960 961 962 963 964
const SadMxNFunc sad_16x16_wmt = vp8_sad16x16_wmt;
const SadMxNFunc sad_8x16_wmt = vp8_sad8x16_wmt;
const SadMxNFunc sad_16x8_wmt = vp8_sad16x8_wmt;
const SadMxNFunc sad_8x8_wmt = vp8_sad8x8_wmt;
const SadMxNFunc sad_4x4_wmt = vp8_sad4x4_wmt;
const SadMxNParam sse2_tests[] = {
965 966 967 968 969
  make_tuple(16, 16, sad_16x16_wmt, -1),
  make_tuple(8, 16, sad_8x16_wmt, -1),
  make_tuple(16, 8, sad_16x8_wmt, -1),
  make_tuple(8, 8, sad_8x8_wmt, -1),
  make_tuple(4, 4, sad_4x4_wmt, -1),
970 971 972 973
};
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
#endif  // CONFIG_VP8_ENCODER

974
#if CONFIG_VP9_ENCODER
Jim Bankoski's avatar
Jim Bankoski committed
975
#if CONFIG_USE_X86INC
976 977 978 979 980 981 982 983 984 985 986
const SadMxNVp9Func sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
const SadMxNVp9Func sad_64x32_sse2_vp9 = vp9_sad64x32_sse2;
const SadMxNVp9Func sad_32x64_sse2_vp9 = vp9_sad32x64_sse2;
const SadMxNVp9Func sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
const SadMxNVp9Func sad_32x16_sse2_vp9 = vp9_sad32x16_sse2;
const SadMxNVp9Func sad_16x32_sse2_vp9 = vp9_sad16x32_sse2;
const SadMxNVp9Func sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
const SadMxNVp9Func sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
const SadMxNVp9Func sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
const SadMxNVp9Func sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
const SadMxNVp9Func sad_8x4_sse2_vp9 = vp9_sad8x4_sse2;
987

988 989 990 991 992 993 994 995 996 997 998
const SadMxNx4Func sad_64x64x4d_sse2 = vp9_sad64x64x4d_sse2;
const SadMxNx4Func sad_64x32x4d_sse2 = vp9_sad64x32x4d_sse2;
const SadMxNx4Func sad_32x64x4d_sse2 = vp9_sad32x64x4d_sse2;
const SadMxNx4Func sad_32x32x4d_sse2 = vp9_sad32x32x4d_sse2;
const SadMxNx4Func sad_32x16x4d_sse2 = vp9_sad32x16x4d_sse2;
const SadMxNx4Func sad_16x32x4d_sse2 = vp9_sad16x32x4d_sse2;
const SadMxNx4Func sad_16x16x4d_sse2 = vp9_sad16x16x4d_sse2;
const SadMxNx4Func sad_16x8x4d_sse2 = vp9_sad16x8x4d_sse2;
const SadMxNx4Func sad_8x16x4d_sse2 = vp9_sad8x16x4d_sse2;
const SadMxNx4Func sad_8x8x4d_sse2 = vp9_sad8x8x4d_sse2;
const SadMxNx4Func sad_8x4x4d_sse2 = vp9_sad8x4x4d_sse2;
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193

#if CONFIG_VP9_HIGHBITDEPTH
const SadMxNVp9Func highbd_sad8x4_sse2_vp9 = vp9_highbd_sad8x4_sse2;
const SadMxNVp9Func highbd_sad8x8_sse2_vp9 = vp9_highbd_sad8x8_sse2;
const SadMxNVp9Func highbd_sad8x16_sse2_vp9 = vp9_highbd_sad8x16_sse2;
const SadMxNVp9Func highbd_sad16x8_sse2_vp9 = vp9_highbd_sad16x8_sse2;
const SadMxNVp9Func highbd_sad16x16_sse2_vp9 = vp9_highbd_sad16x16_sse2;
const SadMxNVp9Func highbd_sad16x32_sse2_vp9 = vp9_highbd_sad16x32_sse2;
const SadMxNVp9Func highbd_sad32x16_sse2_vp9 = vp9_highbd_sad32x16_sse2;
const SadMxNVp9Func highbd_sad32x32_sse2_vp9 = vp9_highbd_sad32x32_sse2;
const SadMxNVp9Func highbd_sad32x64_sse2_vp9 = vp9_highbd_sad32x64_sse2;
const SadMxNVp9Func highbd_sad64x32_sse2_vp9 = vp9_highbd_sad64x32_sse2;
const SadMxNVp9Func highbd_sad64x64_sse2_vp9 = vp9_highbd_sad64x64_sse2;

INSTANTIATE_TEST_CASE_P(SSE2, SADVP9Test, ::testing::Values(
                        make_tuple(64, 64, sad_64x64_sse2_vp9, -1),
                        make_tuple(64, 32, sad_64x32_sse2_vp9, -1),
                        make_tuple(32, 64, sad_32x64_sse2_vp9, -1),
                        make_tuple(32, 32, sad_32x32_sse2_vp9, -1),
                        make_tuple(32, 16, sad_32x16_sse2_vp9, -1),
                        make_tuple(16, 32, sad_16x32_sse2_vp9, -1),
                        make_tuple(16, 16, sad_16x16_sse2_vp9, -1),
                        make_tuple(16, 8, sad_16x8_sse2_vp9, -1),
                        make_tuple(8, 16, sad_8x16_sse2_vp9, -1),
                        make_tuple(8, 8, sad_8x8_sse2_vp9, -1),
                        make_tuple(8, 4, sad_8x4_sse2_vp9, -1),
                        make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 8),
                        make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 8),
                        make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 8),
                        make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 8),
                        make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 8),
                        make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 8),
                        make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 8),
                        make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 8),
                        make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 8),
                        make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 8),
                        make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 8),
                        make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 10),
                        make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 10),
                        make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 10),
                        make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 10),
                        make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 10),
                        make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 10),
                        make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 10),
                        make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 10),
                        make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 10),
                        make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 10),
                        make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 10),
                        make_tuple(8, 4, highbd_sad8x4_sse2_vp9, 12),
                        make_tuple(8, 8, highbd_sad8x8_sse2_vp9, 12),
                        make_tuple(8, 16, highbd_sad8x16_sse2_vp9, 12),
                        make_tuple(16, 8, highbd_sad16x8_sse2_vp9, 12),
                        make_tuple(16, 16, highbd_sad16x16_sse2_vp9, 12),
                        make_tuple(16, 32, highbd_sad16x32_sse2_vp9, 12),
                        make_tuple(32, 16, highbd_sad32x16_sse2_vp9, 12),
                        make_tuple(32, 32, highbd_sad32x32_sse2_vp9, 12),
                        make_tuple(32, 64, highbd_sad32x64_sse2_vp9, 12),
                        make_tuple(64, 32, highbd_sad64x32_sse2_vp9, 12),
                        make_tuple(64, 64, highbd_sad64x64_sse2_vp9, 12)));

const SadMxNAvgVp9Func highbd_sad8x4_avg_sse2_vp9 = vp9_highbd_sad8x4_avg_sse2;
const SadMxNAvgVp9Func highbd_sad8x8_avg_sse2_vp9 = vp9_highbd_sad8x8_avg_sse2;
const SadMxNAvgVp9Func highbd_sad8x16_avg_sse2_vp9 =
  vp9_highbd_sad8x16_avg_sse2;
const SadMxNAvgVp9Func highbd_sad16x8_avg_sse2_vp9 =
  vp9_highbd_sad16x8_avg_sse2;
const SadMxNAvgVp9Func highbd_sad16x16_avg_sse2_vp9 =
  vp9_highbd_sad16x16_avg_sse2;
const SadMxNAvgVp9Func highbd_sad16x32_avg_sse2_vp9 =
  vp9_highbd_sad16x32_avg_sse2;
const SadMxNAvgVp9Func highbd_sad32x16_avg_sse2_vp9 =
  vp9_highbd_sad32x16_avg_sse2;
const SadMxNAvgVp9Func highbd_sad32x32_avg_sse2_vp9 =
  vp9_highbd_sad32x32_avg_sse2;
const SadMxNAvgVp9Func highbd_sad32x64_avg_sse2_vp9 =
  vp9_highbd_sad32x64_avg_sse2;
const SadMxNAvgVp9Func highbd_sad64x32_avg_sse2_vp9 =
  vp9_highbd_sad64x32_avg_sse2;
const SadMxNAvgVp9Func highbd_sad64x64_avg_sse2_vp9 =
  vp9_highbd_sad64x64_avg_sse2;

INSTANTIATE_TEST_CASE_P(SSE2, SADavgVP9Test, ::testing::Values(
                        make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 8),
                        make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 8),
                        make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 8),
                        make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 8),
                        make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 8),
                        make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 8),
                        make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 8),
                        make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 8),
                        make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 8),
                        make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 8),
                        make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 8),
                        make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 10),
                        make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 10),
                        make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 10),
                        make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 10),
                        make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 10),
                        make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 10),
                        make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 10),
                        make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 10),
                        make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 10),
                        make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 10),
                        make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 10),
                        make_tuple(8, 4, highbd_sad8x4_avg_sse2_vp9, 12),
                        make_tuple(8, 8, highbd_sad8x8_avg_sse2_vp9, 12),
                        make_tuple(8, 16, highbd_sad8x16_avg_sse2_vp9, 12),
                        make_tuple(16, 8, highbd_sad16x8_avg_sse2_vp9, 12),
                        make_tuple(16, 16, highbd_sad16x16_avg_sse2_vp9, 12),
                        make_tuple(16, 32, highbd_sad16x32_avg_sse2_vp9, 12),
                        make_tuple(32, 16, highbd_sad32x16_avg_sse2_vp9, 12),
                        make_tuple(32, 32, highbd_sad32x32_avg_sse2_vp9, 12),
                        make_tuple(32, 64, highbd_sad32x64_avg_sse2_vp9, 12),
                        make_tuple(64, 32, highbd_sad64x32_avg_sse2_vp9, 12),
                        make_tuple(64, 64, highbd_sad64x64_avg_sse2_vp9, 12)));

const SadMxNx4Func highbd_sad_64x64x4d_sse2 = vp9_highbd_sad64x64x4d_sse2;
const SadMxNx4Func highbd_sad_64x32x4d_sse2 = vp9_highbd_sad64x32x4d_sse2;
const SadMxNx4Func highbd_sad_32x64x4d_sse2 = vp9_highbd_sad32x64x4d_sse2;
const SadMxNx4Func highbd_sad_32x32x4d_sse2 = vp9_highbd_sad32x32x4d_sse2;
const SadMxNx4Func highbd_sad_32x16x4d_sse2 = vp9_highbd_sad32x16x4d_sse2;
const SadMxNx4Func highbd_sad_16x32x4d_sse2 = vp9_highbd_sad16x32x4d_sse2;
const SadMxNx4Func highbd_sad_16x16x4d_sse2 = vp9_highbd_sad16x16x4d_sse2;
const SadMxNx4Func highbd_sad_16x8x4d_sse2 = vp9_highbd_sad16x8x4d_sse2;
const SadMxNx4Func highbd_sad_8x16x4d_sse2 = vp9_highbd_sad8x16x4d_sse2;
const SadMxNx4Func highbd_sad_8x8x4d_sse2 = vp9_highbd_sad8x8x4d_sse2;
const SadMxNx4Func highbd_sad_8x4x4d_sse2 = vp9_highbd_sad8x4x4d_sse2;
const SadMxNx4Func highbd_sad_4x8x4d_sse2 = vp9_highbd_sad4x8x4d_sse2;
const SadMxNx4Func highbd_sad_4x4x4d_sse2 = vp9_highbd_sad4x4x4d_sse2;

INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
                        make_tuple(64, 64, sad_64x64x4d_sse2, -1),
                        make_tuple(64, 32, sad_64x32x4d_sse2, -1),
                        make_tuple(32, 64, sad_32x64x4d_sse2, -1),
                        make_tuple(32, 32, sad_32x32x4d_sse2, -1),
                        make_tuple(32, 16, sad_32x16x4d_sse2, -1),
                        make_tuple(16, 32, sad_16x32x4d_sse2, -1),
                        make_tuple(16, 16, sad_16x16x4d_sse2, -1),
                        make_tuple(16, 8, sad_16x8x4d_sse2,  -1),
                        make_tuple(8, 16, sad_8x16x4d_sse2,  -1),
                        make_tuple(8, 8, sad_8x8x4d_sse2,   -1),
                        make_tuple(8, 4, sad_8x4x4d_sse2,   -1),
                        make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 8),
                        make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 8),
                        make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 8),
                        make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 8),
                        make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 8),
                        make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 8),
                        make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 8),
                        make_tuple(16, 8, highbd_sad_16x8x4d_sse2,  8),
                        make_tuple(8, 16, highbd_sad_8x16x4d_sse2,  8),
                        make_tuple(8, 8, highbd_sad_8x8x4d_sse2,   8),
                        make_tuple(8, 4, highbd_sad_8x4x4d_sse2,   8),
                        make_tuple(4, 8, highbd_sad_4x8x4d_sse2,   8),
                        make_tuple(4, 4, highbd_sad_4x4x4d_sse2,   8),
                        make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 10),
                        make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 10),
                        make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 10),
                        make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 10),
                        make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 10),
                        make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 10),
                        make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 10),
                        make_tuple(16, 8, highbd_sad_16x8x4d_sse2,  10),
                        make_tuple(8, 16, highbd_sad_8x16x4d_sse2,  10),
                        make_tuple(8, 8, highbd_sad_8x8x4d_sse2,   10),
                        make_tuple(8, 4, highbd_sad_8x4x4d_sse2,   10),
                        make_tuple(4, 8, highbd_sad_4x8x4d_sse2,   10),
                        make_tuple(4, 4, highbd_sad_4x4x4d_sse2,   10),
                        make_tuple(64, 64, highbd_sad_64x64x4d_sse2, 12),
                        make_tuple(64, 32, highbd_sad_64x32x4d_sse2, 12),
                        make_tuple(32, 64, highbd_sad_32x64x4d_sse2, 12),
                        make_tuple(32, 32, highbd_sad_32x32x4d_sse2, 12),
                        make_tuple(32, 16, highbd_sad_32x16x4d_sse2, 12),
                        make_tuple(16, 32, highbd_sad_16x32x4d_sse2, 12),
                        make_tuple(16, 16, highbd_sad_16x16x4d_sse2, 12),
                        make_tuple(16, 8, highbd_sad_16x8x4d_sse2,  12),
                        make_tuple(8, 16, highbd_sad_8x16x4d_sse2,  12),
                        make_tuple(8, 8, highbd_sad_8x8x4d_sse2,   12),
                        make_tuple(8, 4, highbd_sad_8x4x4d_sse2,   12),
                        make_tuple(4, 8, highbd_sad_4x8x4d_sse2,   12),
                        make_tuple(4, 4, highbd_sad_4x4x4d_sse2,   12)));
#else
INSTANTIATE_TEST_CASE_P(SSE2, SADVP9Test, ::testing::Values(
                        make_tuple(64, 64, sad_64x64_sse2_vp9, -1),
                        make_tuple(64, 32, sad_64x32_sse2_vp9, -1),
                        make_tuple(32, 64, sad_32x64_sse2_vp9, -1),
                        make_tuple(32, 32, sad_32x32_sse2_vp9, -1),
                        make_tuple(32, 16, sad_32x16_sse2_vp9, -1),
                        make_tuple(16, 32, sad_16x32_sse2_vp9, -1),
                        make_tuple(16, 16, sad_16x16_sse2_vp9, -1),
                        make_tuple(16, 8, sad_16x8_sse2_vp9, -1),
                        make_tuple(8, 16, sad_8x16_sse2_vp9, -1),
                        make_tuple(8, 8, sad_8x8_sse2_vp9, -1),
                        make_tuple(8, 4, sad_8x4_sse2_vp9, -1)));

1194
INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::Values(
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
                        make_tuple(64, 64, sad_64x64x4d_sse2, -1),
                        make_tuple(64, 32, sad_64x32x4d_sse2, -1),
                        make_tuple(32, 64, sad_32x64x4d_sse2, -1),
                        make_tuple(32, 32, sad_32x32x4d_sse2, -1),
                        make_tuple(32, 16, sad_32x16x4d_sse2, -1),
                        make_tuple(16, 32, sad_16x32x4d_sse2, -1),
                        make_tuple(16, 16, sad_16x16x4d_sse2, -1),
                        make_tuple(16, 8, sad_16x8x4d_sse2,  -1),
                        make_tuple(8, 16, sad_8x16x4d_sse2,  -1),
                        make_tuple(8, 8, sad_8x8x4d_sse2,   -1),
                        make_tuple(8, 4, sad_8x4x4d_sse2,   -1)));
#endif  // CONFIG_VP9_HIGHBITDEPTH
1207 1208 1209
#endif  // CONFIG_USE_X86INC
#endif  // CONFIG_VP9_ENCODER
#endif  // HAVE_SSE2
1210 1211 1212

#if HAVE_SSE3
#if CONFIG_VP8_ENCODER
1213 1214 1215 1216 1217
const SadMxNx4Func sad_16x16x4d_sse3 = vp8_sad16x16x4d_sse3;
const SadMxNx4Func sad_16x8x4d_sse3 = vp8_sad16x8x4d_sse3;
const SadMxNx4Func sad_8x16x4d_sse3 = vp8_sad8x16x4d_sse3;
const SadMxNx4Func sad_8x8x4d_sse3 = vp8_sad8x8x4d_sse3;
const SadMxNx4Func sad_4x4x4d_sse3 = vp8_sad4x4x4d_sse3;
1218
INSTANTIATE_TEST_CASE_P(SSE3, SADx4Test, ::testing::Values(
1219 1220 1221 1222 1223
                        make_tuple(16, 16, sad_16x16x4d_sse3, -1),
                        make_tuple(16, 8, sad_16x8x4d_sse3, -1),
                        make_tuple(8, 16, sad_8x16x4d_sse3, -1),
                        make_tuple(8, 8, sad_8x8x4d_sse3, -1),
                        make_tuple(4, 4, sad_4x4x4d_sse3, -1)));
1224 1225
#endif  // CONFIG_VP8_ENCODER
#endif  // HAVE_SSE3
1226

Johann's avatar
Johann committed
1227
#if HAVE_SSSE3
Jim Bankoski's avatar
Jim Bankoski committed
1228
#if CONFIG_USE_X86INC