variance_test.cc 60.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
/*
 *  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.
 */

11 12
#include <cstdlib>
#include <new>
13

14
#include "third_party/googletest/src/include/gtest/gtest.h"
15

Yaowu Xu's avatar
Yaowu Xu committed
16
#include "./vpx_config.h"
17 18 19 20
#include "./vpx_dsp_rtcd.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
21 22
#include "vpx/vpx_codec.h"
#include "vpx/vpx_integer.h"
23
#include "vpx_mem/vpx_mem.h"
24
#include "vpx_ports/mem.h"
25 26 27

namespace {

28 29 30
typedef unsigned int (*VarianceMxNFunc)(const uint8_t *a, int a_stride,
                                        const uint8_t *b, int b_stride,
                                        unsigned int *sse);
Johann's avatar
Johann committed
31 32 33 34
typedef unsigned int (*SubpixVarMxNFunc)(const uint8_t *a, int a_stride,
                                         int xoffset, int yoffset,
                                         const uint8_t *b, int b_stride,
                                         unsigned int *sse);
35 36 37 38 39
typedef unsigned int (*SubpixAvgVarMxNFunc)(const uint8_t *a, int a_stride,
                                            int xoffset, int yoffset,
                                            const uint8_t *b, int b_stride,
                                            uint32_t *sse,
                                            const uint8_t *second_pred);
Johann's avatar
Johann committed
40
typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
41
                                      const uint8_t *b, int b_stride);
42 43
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);

44

45 46 47
using ::std::tr1::get;
using ::std::tr1::make_tuple;
using ::std::tr1::tuple;
48 49
using libvpx_test::ACMRandom;

50 51 52 53 54 55 56
// Truncate high bit depth results by downshifting (with rounding) by:
// 2 * (bit_depth - 8) for sse
// (bit_depth - 8) for se
static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
  switch (bit_depth) {
    case VPX_BITS_12:
      *sse = (*sse + 128) >> 8;
57
      *se = (*se + 8) >> 4;
58 59 60
      break;
    case VPX_BITS_10:
      *sse = (*sse + 8) >> 4;
61
      *se = (*se + 2) >> 2;
62 63 64 65 66 67 68
      break;
    case VPX_BITS_8:
    default:
      break;
  }
}

69 70 71 72 73 74 75 76
static unsigned int mb_ss_ref(const int16_t *src) {
  unsigned int res = 0;
  for (int i = 0; i < 256; ++i) {
    res += src[i] * src[i];
  }
  return res;
}

77 78 79 80
/* Note:
 *  Our codebase calculates the "diff" value in the variance algorithm by
 *  (src - ref).
 */
81 82 83 84 85
static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,
                             int l2w, int l2h, int src_stride_coeff,
                             int ref_stride_coeff, uint32_t *sse_ptr,
                             bool use_high_bit_depth_,
                             vpx_bit_depth_t bit_depth) {
86 87 88 89 90 91 92 93
  int64_t se = 0;
  uint64_t sse = 0;
  const int w = 1 << l2w;
  const int h = 1 << l2h;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      int diff;
      if (!use_high_bit_depth_) {
94 95
        diff = src[w * y * src_stride_coeff + x] -
               ref[w * y * ref_stride_coeff + x];
96 97
        se += diff;
        sse += diff * diff;
98
#if CONFIG_VP9_HIGHBITDEPTH
99
      } else {
100 101
        diff = CONVERT_TO_SHORTPTR(src)[w * y * src_stride_coeff + x] -
               CONVERT_TO_SHORTPTR(ref)[w * y * ref_stride_coeff + x];
102 103
        se += diff;
        sse += diff * diff;
104
#endif  // CONFIG_VP9_HIGHBITDEPTH
105 106 107
      }
    }
  }
108
  RoundHighBitDepth(bit_depth, &se, &sse);
109 110 111 112
  *sse_ptr = static_cast<uint32_t>(sse);
  return static_cast<uint32_t>(sse -
                               ((static_cast<int64_t>(se) * se) >>
                                (l2w + l2h)));
113 114
}

Johann's avatar
Johann committed
115 116 117 118 119 120
/* The subpel reference functions differ from the codec version in one aspect:
 * they calculate the bilinear factors directly instead of using a lookup table
 * and therefore upshift xoff and yoff by 1. Only every other calculated value
 * is used so the codec version shrinks the table to save space and maintain
 * compatibility with vp8.
 */
121 122 123 124 125
static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
                                    int l2w, int l2h, int xoff, int yoff,
                                    uint32_t *sse_ptr,
                                    bool use_high_bit_depth_,
                                    vpx_bit_depth_t bit_depth) {
126 127 128 129
  int64_t se = 0;
  uint64_t sse = 0;
  const int w = 1 << l2w;
  const int h = 1 << l2h;
Johann's avatar
Johann committed
130 131 132 133

  xoff <<= 1;
  yoff <<= 1;

134 135 136 137 138 139 140 141 142 143 144 145 146 147
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      // Bilinear interpolation at a 16th pel step.
      if (!use_high_bit_depth_) {
        const int a1 = ref[(w + 1) * (y + 0) + x + 0];
        const int a2 = ref[(w + 1) * (y + 0) + x + 1];
        const int b1 = ref[(w + 1) * (y + 1) + x + 0];
        const int b2 = ref[(w + 1) * (y + 1) + x + 1];
        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
        const int r = a + (((b - a) * yoff + 8) >> 4);
        const int diff = r - src[w * y + x];
        se += diff;
        sse += diff * diff;
148
#if CONFIG_VP9_HIGHBITDEPTH
149 150 151 152 153 154 155 156 157 158 159 160 161
      } else {
        uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
        uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
        const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
        const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
        const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
        const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
        const int r = a + (((b - a) * yoff + 8) >> 4);
        const int diff = r - src16[w * y + x];
        se += diff;
        sse += diff * diff;
162
#endif  // CONFIG_VP9_HIGHBITDEPTH
163 164 165
      }
    }
  }
166
  RoundHighBitDepth(bit_depth, &se, &sse);
167 168 169 170
  *sse_ptr = static_cast<uint32_t>(sse);
  return static_cast<uint32_t>(sse -
                               ((static_cast<int64_t>(se) * se) >>
                                (l2w + l2h)));
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 203 204 205 206 207 208 209 210 211 212 213 214
class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
 public:
  SumOfSquaresTest() : func_(GetParam()) {}

  virtual ~SumOfSquaresTest() {
    libvpx_test::ClearSystemState();
  }

 protected:
  void ConstTest();
  void RefTest();

  SumOfSquaresFunction func_;
  ACMRandom rnd_;
};

void SumOfSquaresTest::ConstTest() {
  int16_t mem[256];
  unsigned int res;
  for (int v = 0; v < 256; ++v) {
    for (int i = 0; i < 256; ++i) {
      mem[i] = v;
    }
    ASM_REGISTER_STATE_CHECK(res = func_(mem));
    EXPECT_EQ(256u * (v * v), res);
  }
}

void SumOfSquaresTest::RefTest() {
  int16_t mem[256];
  for (int i = 0; i < 100; ++i) {
    for (int j = 0; j < 256; ++j) {
      mem[j] = rnd_.Rand8() - rnd_.Rand8();
    }

    const unsigned int expected = mb_ss_ref(mem);
    unsigned int res;
    ASM_REGISTER_STATE_CHECK(res = func_(mem));
    EXPECT_EQ(expected, res);
  }
}

James Zern's avatar
James Zern committed
215
template<typename VarianceFunctionType>
Yaowu Xu's avatar
Yaowu Xu committed
216
class VarianceTest
217 218
    : public ::testing::TestWithParam<tuple<int, int,
                                            VarianceFunctionType, int> > {
219 220
 public:
  virtual void SetUp() {
221
    const tuple<int, int, VarianceFunctionType, int>& params = this->GetParam();
222 223 224 225
    log2width_  = get<0>(params);
    width_ = 1 << log2width_;
    log2height_ = get<1>(params);
    height_ = 1 << log2height_;
226
    variance_ = get<2>(params);
227 228 229 230 231 232 233 234
    if (get<3>(params)) {
      bit_depth_ = static_cast<vpx_bit_depth_t>(get<3>(params));
      use_high_bit_depth_ = true;
    } else {
      bit_depth_ = VPX_BITS_8;
      use_high_bit_depth_ = false;
    }
    mask_ = (1 << bit_depth_) - 1;
235

236
    rnd_.Reset(ACMRandom::DeterministicSeed());
237
    block_size_ = width_ * height_;
238 239 240
    if (!use_high_bit_depth_) {
      src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_ * 2));
      ref_ = new uint8_t[block_size_ * 2];
241
#if CONFIG_VP9_HIGHBITDEPTH
242 243 244 245
    } else {
      src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
          vpx_memalign(16, block_size_ * 2 * sizeof(uint16_t))));
      ref_ = CONVERT_TO_BYTEPTR(new uint16_t[block_size_ * 2]);
246
#endif  // CONFIG_VP9_HIGHBITDEPTH
247
    }
248 249 250 251 252
    ASSERT_TRUE(src_ != NULL);
    ASSERT_TRUE(ref_ != NULL);
  }

  virtual void TearDown() {
253 254 255
    if (!use_high_bit_depth_) {
      vpx_free(src_);
      delete[] ref_;
256
#if CONFIG_VP9_HIGHBITDEPTH
257 258 259
    } else {
      vpx_free(CONVERT_TO_SHORTPTR(src_));
      delete[] CONVERT_TO_SHORTPTR(ref_);
260
#endif  // CONFIG_VP9_HIGHBITDEPTH
261
    }
262
    libvpx_test::ClearSystemState();
263 264 265
  }

 protected:
James Zern's avatar
James Zern committed
266
  void ZeroTest();
267
  void RefTest();
268
  void RefStrideTest();
James Zern's avatar
James Zern committed
269 270
  void OneQuarterTest();

271
  ACMRandom rnd_;
272 273
  uint8_t *src_;
  uint8_t *ref_;
274 275
  int width_, log2width_;
  int height_, log2height_;
276 277 278
  vpx_bit_depth_t bit_depth_;
  int mask_;
  bool use_high_bit_depth_;
279
  int block_size_;
James Zern's avatar
James Zern committed
280
  VarianceFunctionType variance_;
281 282
};

James Zern's avatar
James Zern committed
283 284
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::ZeroTest() {
285
  for (int i = 0; i <= 255; ++i) {
286 287
    if (!use_high_bit_depth_) {
      memset(src_, i, block_size_);
288
#if CONFIG_VP9_HIGHBITDEPTH
289 290 291
    } else {
      vpx_memset16(CONVERT_TO_SHORTPTR(src_), i << (bit_depth_ - 8),
                   block_size_);
292
#endif  // CONFIG_VP9_HIGHBITDEPTH
293
    }
294
    for (int j = 0; j <= 255; ++j) {
295 296
      if (!use_high_bit_depth_) {
        memset(ref_, j, block_size_);
297
#if CONFIG_VP9_HIGHBITDEPTH
298 299 300
      } else {
        vpx_memset16(CONVERT_TO_SHORTPTR(ref_), j  << (bit_depth_ - 8),
                     block_size_);
301
#endif  // CONFIG_VP9_HIGHBITDEPTH
302
      }
303
      unsigned int sse;
304
      unsigned int var;
305 306
      ASM_REGISTER_STATE_CHECK(
          var = variance_(src_, width_, ref_, width_, &sse));
307
      EXPECT_EQ(0u, var) << "src values: " << i << " ref values: " << j;
308 309 310 311
    }
  }
}

312 313 314 315
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::RefTest() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < block_size_; j++) {
316 317 318
      if (!use_high_bit_depth_) {
        src_[j] = rnd_.Rand8();
        ref_[j] = rnd_.Rand8();
319
#if CONFIG_VP9_HIGHBITDEPTH
320 321 322
      } else {
        CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
        CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
323
#endif  // CONFIG_VP9_HIGHBITDEPTH
324
      }
325 326
    }
    unsigned int sse1, sse2;
327
    unsigned int var1;
328
    const int stride_coeff = 1;
329 330
    ASM_REGISTER_STATE_CHECK(
        var1 = variance_(src_, width_, ref_, width_, &sse1));
331
    const unsigned int var2 = variance_ref(src_, ref_, log2width_,
332 333 334
                                           log2height_, stride_coeff,
                                           stride_coeff, &sse2,
                                           use_high_bit_depth_, bit_depth_);
335 336 337 338
    EXPECT_EQ(sse1, sse2)
        << "Error at test index: " << i;
    EXPECT_EQ(var1, var2)
        << "Error at test index: " << i;
339 340 341 342 343 344 345 346 347 348 349 350 351 352
  }
}

template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::RefStrideTest() {
  for (int i = 0; i < 10; ++i) {
    int ref_stride_coeff = i % 2;
    int src_stride_coeff = (i >> 1) % 2;
    for (int j = 0; j < block_size_; j++) {
      int ref_ind = (j / width_) * ref_stride_coeff * width_ + j % width_;
      int src_ind = (j / width_) * src_stride_coeff * width_ + j % width_;
      if (!use_high_bit_depth_) {
        src_[src_ind] = rnd_.Rand8();
        ref_[ref_ind] = rnd_.Rand8();
353
#if CONFIG_VP9_HIGHBITDEPTH
354
      } else {
355 356
        CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() & mask_;
        CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() & mask_;
357
#endif  // CONFIG_VP9_HIGHBITDEPTH
358 359 360 361 362 363 364 365 366 367 368 369
      }
    }
    unsigned int sse1, sse2;
    unsigned int var1;

    ASM_REGISTER_STATE_CHECK(
        var1 = variance_(src_, width_ * src_stride_coeff,
                         ref_, width_ * ref_stride_coeff, &sse1));
    const unsigned int var2 = variance_ref(src_, ref_, log2width_,
                                           log2height_, src_stride_coeff,
                                           ref_stride_coeff, &sse2,
                                           use_high_bit_depth_, bit_depth_);
370 371 372 373
    EXPECT_EQ(sse1, sse2)
        << "Error at test index: " << i;
    EXPECT_EQ(var1, var2)
        << "Error at test index: " << i;
374 375 376
  }
}

James Zern's avatar
James Zern committed
377 378
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
379
  const int half = block_size_ / 2;
380 381 382 383
  if (!use_high_bit_depth_) {
    memset(src_, 255, block_size_);
    memset(ref_, 255, half);
    memset(ref_ + half, 0, half);
384
#if CONFIG_VP9_HIGHBITDEPTH
385 386 387 388 389
  } else {
    vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << (bit_depth_ - 8),
                 block_size_);
    vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << (bit_depth_ - 8), half);
    vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
390
#endif  // CONFIG_VP9_HIGHBITDEPTH
391
  }
392
  unsigned int sse;
393
  unsigned int var;
394
  ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
395 396 397 398
  const unsigned int expected = block_size_ * 255 * 255 / 4;
  EXPECT_EQ(expected, var);
}

399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
template<typename MseFunctionType>
class MseTest
    : public ::testing::TestWithParam<tuple<int, int, MseFunctionType> > {
 public:
  virtual void SetUp() {
    const tuple<int, int, MseFunctionType>& params = this->GetParam();
    log2width_  = get<0>(params);
    width_ = 1 << log2width_;
    log2height_ = get<1>(params);
    height_ = 1 << log2height_;
    mse_ = get<2>(params);

    rnd(ACMRandom::DeterministicSeed());
    block_size_ = width_ * height_;
    src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
    ref_ = new uint8_t[block_size_];
    ASSERT_TRUE(src_ != NULL);
    ASSERT_TRUE(ref_ != NULL);
  }

  virtual void TearDown() {
    vpx_free(src_);
    delete[] ref_;
    libvpx_test::ClearSystemState();
  }

 protected:
  void RefTest_mse();
  void RefTest_sse();
  void MaxTest_mse();
  void MaxTest_sse();

  ACMRandom rnd;
  uint8_t* src_;
  uint8_t* ref_;
  int width_, log2width_;
  int height_, log2height_;
  int block_size_;
  MseFunctionType mse_;
};

template<typename MseFunctionType>
void MseTest<MseFunctionType>::RefTest_mse() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < block_size_; j++) {
      src_[j] = rnd.Rand8();
      ref_[j] = rnd.Rand8();
    }
    unsigned int sse1, sse2;
448
    const int stride_coeff = 1;
449
    ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse1));
450 451
    variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
                 stride_coeff, &sse2, false, VPX_BITS_8);
452 453 454 455 456 457 458 459 460 461 462 463 464
    EXPECT_EQ(sse1, sse2);
  }
}

template<typename MseFunctionType>
void MseTest<MseFunctionType>::RefTest_sse() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < block_size_; j++) {
      src_[j] = rnd.Rand8();
      ref_[j] = rnd.Rand8();
    }
    unsigned int sse2;
    unsigned int var1;
465 466 467 468
    const int stride_coeff = 1;
    ASM_REGISTER_STATE_CHECK(var1 = mse_(src_, width_, ref_, width_));
    variance_ref(src_, ref_, log2width_, log2height_, stride_coeff,
                 stride_coeff, &sse2, false, VPX_BITS_8);
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
    EXPECT_EQ(var1, sse2);
  }
}

template<typename MseFunctionType>
void MseTest<MseFunctionType>::MaxTest_mse() {
  memset(src_, 255, block_size_);
  memset(ref_, 0, block_size_);
  unsigned int sse;
  ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse));
  const unsigned int expected = block_size_ * 255 * 255;
  EXPECT_EQ(expected, sse);
}

template<typename MseFunctionType>
void MseTest<MseFunctionType>::MaxTest_sse() {
  memset(src_, 255, block_size_);
  memset(ref_, 0, block_size_);
  unsigned int var;
  ASM_REGISTER_STATE_CHECK(var = mse_(src_, width_, ref_, width_));
  const unsigned int expected = block_size_ * 255 * 255;
  EXPECT_EQ(expected, var);
}

493 494 495 496 497 498 499 500
static uint32_t subpel_avg_variance_ref(const uint8_t *ref,
                                        const uint8_t *src,
                                        const uint8_t *second_pred,
                                        int l2w, int l2h,
                                        int xoff, int yoff,
                                        uint32_t *sse_ptr,
                                        bool use_high_bit_depth,
                                        vpx_bit_depth_t bit_depth) {
501 502 503 504
  int64_t se = 0;
  uint64_t sse = 0;
  const int w = 1 << l2w;
  const int h = 1 << l2h;
Johann's avatar
Johann committed
505 506 507 508

  xoff <<= 1;
  yoff <<= 1;

509 510 511 512 513 514 515 516 517 518 519 520 521 522
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      // bilinear interpolation at a 16th pel step
      if (!use_high_bit_depth) {
        const int a1 = ref[(w + 1) * (y + 0) + x + 0];
        const int a2 = ref[(w + 1) * (y + 0) + x + 1];
        const int b1 = ref[(w + 1) * (y + 1) + x + 0];
        const int b2 = ref[(w + 1) * (y + 1) + x + 1];
        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
        const int r = a + (((b - a) * yoff + 8) >> 4);
        const int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
        se += diff;
        sse += diff * diff;
523
#if CONFIG_VP9_HIGHBITDEPTH
524 525 526 527 528 529 530 531 532 533 534 535 536 537
      } else {
        uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
        uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
        uint16_t *sec16   = CONVERT_TO_SHORTPTR(second_pred);
        const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
        const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
        const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
        const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
        const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
        const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
        const int r = a + (((b - a) * yoff + 8) >> 4);
        const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
        se += diff;
        sse += diff * diff;
538
#endif  // CONFIG_VP9_HIGHBITDEPTH
539 540 541
      }
    }
  }
542
  RoundHighBitDepth(bit_depth, &se, &sse);
543 544 545 546
  *sse_ptr = static_cast<uint32_t>(sse);
  return static_cast<uint32_t>(sse -
                               ((static_cast<int64_t>(se) * se) >>
                                (l2w + l2h)));
James Zern's avatar
James Zern committed
547 548
}

549
template<typename SubpelVarianceFunctionType>
Yaowu Xu's avatar
Yaowu Xu committed
550 551
class SubpelVarianceTest
    : public ::testing::TestWithParam<tuple<int, int,
552
                                            SubpelVarianceFunctionType, int> > {
553 554
 public:
  virtual void SetUp() {
555
    const tuple<int, int, SubpelVarianceFunctionType, int>& params =
556 557 558 559 560 561
        this->GetParam();
    log2width_  = get<0>(params);
    width_ = 1 << log2width_;
    log2height_ = get<1>(params);
    height_ = 1 << log2height_;
    subpel_variance_ = get<2>(params);
562 563 564 565 566 567 568 569
    if (get<3>(params)) {
      bit_depth_ = (vpx_bit_depth_t) get<3>(params);
      use_high_bit_depth_ = true;
    } else {
      bit_depth_ = VPX_BITS_8;
      use_high_bit_depth_ = false;
    }
    mask_ = (1 << bit_depth_)-1;
570

571
    rnd_.Reset(ACMRandom::DeterministicSeed());
572
    block_size_ = width_ * height_;
573 574 575 576
    if (!use_high_bit_depth_) {
      src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
      sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
      ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
577
#if CONFIG_VP9_HIGHBITDEPTH
578 579 580 581 582 583 584 585 586 587
    } else {
      src_ = CONVERT_TO_BYTEPTR(
          reinterpret_cast<uint16_t *>(
              vpx_memalign(16, block_size_*sizeof(uint16_t))));
      sec_ = CONVERT_TO_BYTEPTR(
          reinterpret_cast<uint16_t *>(
              vpx_memalign(16, block_size_*sizeof(uint16_t))));
      ref_ = CONVERT_TO_BYTEPTR(
          new uint16_t[block_size_ + width_ + height_ + 1]);
#endif  // CONFIG_VP9_HIGHBITDEPTH
588
    }
589
    ASSERT_TRUE(src_ != NULL);
590
    ASSERT_TRUE(sec_ != NULL);
591 592 593 594
    ASSERT_TRUE(ref_ != NULL);
  }

  virtual void TearDown() {
595 596 597 598
    if (!use_high_bit_depth_) {
      vpx_free(src_);
      delete[] ref_;
      vpx_free(sec_);
599
#if CONFIG_VP9_HIGHBITDEPTH
600 601 602 603
    } else {
      vpx_free(CONVERT_TO_SHORTPTR(src_));
      delete[] CONVERT_TO_SHORTPTR(ref_);
      vpx_free(CONVERT_TO_SHORTPTR(sec_));
604
#endif  // CONFIG_VP9_HIGHBITDEPTH
605
    }
606
    libvpx_test::ClearSystemState();
607 608 609 610
  }

 protected:
  void RefTest();
611
  void ExtremeRefTest();
612

613
  ACMRandom rnd_;
614 615 616
  uint8_t *src_;
  uint8_t *ref_;
  uint8_t *sec_;
617 618
  bool use_high_bit_depth_;
  vpx_bit_depth_t bit_depth_;
619 620
  int width_, log2width_;
  int height_, log2height_;
621
  int block_size_,  mask_;
622 623 624 625 626
  SubpelVarianceFunctionType subpel_variance_;
};

template<typename SubpelVarianceFunctionType>
void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
Johann's avatar
Johann committed
627 628
  for (int x = 0; x < 8; ++x) {
    for (int y = 0; y < 8; ++y) {
629 630 631 632 633 634 635
      if (!use_high_bit_depth_) {
        for (int j = 0; j < block_size_; j++) {
          src_[j] = rnd_.Rand8();
        }
        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
          ref_[j] = rnd_.Rand8();
        }
636
#if CONFIG_VP9_HIGHBITDEPTH
637 638 639 640 641 642 643 644
      } else {
        for (int j = 0; j < block_size_; j++) {
          CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
        }
        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
          CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
        }
#endif  // CONFIG_VP9_HIGHBITDEPTH
645
      }
646
      unsigned int sse1, sse2;
647
      unsigned int var1;
648 649
      ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
                                                       src_, width_, &sse1));
Johann's avatar
Johann committed
650 651 652
      const unsigned int var2 = subpel_variance_ref(ref_, src_,
                                                    log2width_, log2height_,
                                                    x, y, &sse2,
653 654 655 656 657 658 659 660 661 662 663 664 665
                                                    use_high_bit_depth_,
                                                    bit_depth_);
      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
    }
  }
}

template<typename SubpelVarianceFunctionType>
void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
  // Compare against reference.
  // Src: Set the first half of values to 0, the second half to the maximum.
  // Ref: Set the first half of values to the maximum, the second half to 0.
Johann's avatar
Johann committed
666 667
  for (int x = 0; x < 8; ++x) {
    for (int y = 0; y < 8; ++y) {
668 669 670 671 672 673
      const int half = block_size_ / 2;
      if (!use_high_bit_depth_) {
        memset(src_, 0, half);
        memset(src_ + half, 255, half);
        memset(ref_, 255, half);
        memset(ref_ + half, 0, half + width_ + height_ + 1);
674
#if CONFIG_VP9_HIGHBITDEPTH
675 676 677 678 679 680 681
      } else {
        vpx_memset16(CONVERT_TO_SHORTPTR(src_), mask_, half);
        vpx_memset16(CONVERT_TO_SHORTPTR(src_) + half, 0, half);
        vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, half);
        vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, mask_,
                     half + width_ + height_ + 1);
#endif  // CONFIG_VP9_HIGHBITDEPTH
682
      }
683 684 685 686 687
      unsigned int sse1, sse2;
      unsigned int var1;
      ASM_REGISTER_STATE_CHECK(
          var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
      const unsigned int var2 =
Johann's avatar
Johann committed
688 689 690 691
          subpel_variance_ref(ref_, src_, log2width_, log2height_,
                              x, y, &sse2, use_high_bit_depth_, bit_depth_);
      EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
      EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
692 693 694 695
    }
  }
}

696
template<>
697
void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
Johann's avatar
Johann committed
698 699
  for (int x = 0; x < 8; ++x) {
    for (int y = 0; y < 8; ++y) {
700 701 702 703 704 705 706 707
      if (!use_high_bit_depth_) {
        for (int j = 0; j < block_size_; j++) {
          src_[j] = rnd_.Rand8();
          sec_[j] = rnd_.Rand8();
        }
        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
          ref_[j] = rnd_.Rand8();
        }
708
#if CONFIG_VP9_HIGHBITDEPTH
709 710 711 712 713 714 715 716
      } else {
        for (int j = 0; j < block_size_; j++) {
          CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
          CONVERT_TO_SHORTPTR(sec_)[j] = rnd_.Rand16() & mask_;
        }
        for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
          CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
        }
717
#endif  // CONFIG_VP9_HIGHBITDEPTH
718
      }
719
      unsigned int sse1, sse2;
720
      unsigned int var1;
721 722 723
      ASM_REGISTER_STATE_CHECK(
          var1 = subpel_variance_(ref_, width_ + 1, x, y,
                                  src_, width_, &sse1, sec_));
724 725
      const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
                                                        log2width_, log2height_,
726 727 728
                                                        x, y, &sse2,
                                                        use_high_bit_depth_,
                                                        bit_depth_);
729 730 731 732 733
      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
    }
  }
}
James Zern's avatar
James Zern committed
734

Johann's avatar
Johann committed
735
typedef MseTest<Get4x4SseFunc> VpxSseTest;
736 737
typedef MseTest<VarianceMxNFunc> VpxMseTest;
typedef VarianceTest<VarianceMxNFunc> VpxVarianceTest;
738 739
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxSubpelVarianceTest;
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxSubpelAvgVarianceTest;
740 741 742 743 744 745 746 747 748 749 750

TEST_P(VpxSseTest, Ref_sse) { RefTest_sse(); }
TEST_P(VpxSseTest, Max_sse) { MaxTest_sse(); }
TEST_P(VpxMseTest, Ref_mse) { RefTest_mse(); }
TEST_P(VpxMseTest, Max_mse) { MaxTest_mse(); }
TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxVarianceTest, Ref) { RefTest(); }
TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
TEST_P(VpxVarianceTest, OneQuarter) { OneQuarterTest(); }
TEST_P(SumOfSquaresTest, Const) { ConstTest(); }
TEST_P(SumOfSquaresTest, Ref) { RefTest(); }
751 752 753
TEST_P(VpxSubpelVarianceTest, Ref) { RefTest(); }
TEST_P(VpxSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
TEST_P(VpxSubpelAvgVarianceTest, Ref) { RefTest(); }
James Zern's avatar
James Zern committed
754

755 756 757 758
INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
                        ::testing::Values(vpx_get_mb_ss_c));

INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
759 760
                        ::testing::Values(make_tuple(2, 2,
                                                     &vpx_get4x4sse_cs_c)));
761 762

INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
763 764 765 766 767
                        ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_c),
                                          make_tuple(4, 3, &vpx_mse16x8_c),
                                          make_tuple(3, 4, &vpx_mse8x16_c),
                                          make_tuple(3, 3, &vpx_mse8x8_c)));

768
INSTANTIATE_TEST_CASE_P(
769
    C, VpxVarianceTest,
770 771 772 773 774 775 776 777 778 779 780 781 782 783
    ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_c, 0),
                      make_tuple(6, 5, &vpx_variance64x32_c, 0),
                      make_tuple(5, 6, &vpx_variance32x64_c, 0),
                      make_tuple(5, 5, &vpx_variance32x32_c, 0),
                      make_tuple(5, 4, &vpx_variance32x16_c, 0),
                      make_tuple(4, 5, &vpx_variance16x32_c, 0),
                      make_tuple(4, 4, &vpx_variance16x16_c, 0),
                      make_tuple(4, 3, &vpx_variance16x8_c, 0),
                      make_tuple(3, 4, &vpx_variance8x16_c, 0),
                      make_tuple(3, 3, &vpx_variance8x8_c, 0),
                      make_tuple(3, 2, &vpx_variance8x4_c, 0),
                      make_tuple(2, 3, &vpx_variance4x8_c, 0),
                      make_tuple(2, 2, &vpx_variance4x4_c, 0)));

784 785
INSTANTIATE_TEST_CASE_P(
    C, VpxSubpelVarianceTest,
786 787 788 789 790 791 792 793 794 795 796 797 798 799
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_c, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_variance64x32_c, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_variance32x64_c, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_c, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_variance32x16_c, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_variance16x32_c, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_variance16x16_c, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_variance16x8_c, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_variance8x16_c, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_c, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_variance8x4_c, 0),
                      make_tuple(2, 3, &vpx_sub_pixel_variance4x8_c, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_variance4x4_c, 0)));

800 801
INSTANTIATE_TEST_CASE_P(
    C, VpxSubpelAvgVarianceTest,
802 803 804 805 806 807 808 809 810 811 812 813 814
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_c, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_c, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_c, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_c, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_c, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_c, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_c, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_c, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_c, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_c, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_c, 0),
                      make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_c, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_c, 0)));
815

816 817 818
#if CONFIG_VP9_HIGHBITDEPTH
typedef MseTest<VarianceMxNFunc> VpxHBDMseTest;
typedef VarianceTest<VarianceMxNFunc> VpxHBDVarianceTest;
819 820 821
typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
typedef SubpelVarianceTest<SubpixAvgVarMxNFunc>
    VpxHBDSubpelAvgVarianceTest;
822 823 824 825 826 827 828

TEST_P(VpxHBDMseTest, Ref_mse) { RefTest_mse(); }
TEST_P(VpxHBDMseTest, Max_mse) { MaxTest_mse(); }
TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); }
TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); }
TEST_P(VpxHBDVarianceTest, OneQuarter) { OneQuarterTest(); }
829 830 831
TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); }
TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); }
832 833

/* TODO(debargha): This test does not support the highbd version
834
INSTANTIATE_TEST_CASE_P(
835 836 837 838 839 840 841 842 843 844 845 846 847
    C, VpxHBDMseTest,
    ::testing::Values(make_tuple(4, 4, &vpx_highbd_12_mse16x16_c),
                      make_tuple(4, 4, &vpx_highbd_12_mse16x8_c),
                      make_tuple(4, 4, &vpx_highbd_12_mse8x16_c),
                      make_tuple(4, 4, &vpx_highbd_12_mse8x8_c),
                      make_tuple(4, 4, &vpx_highbd_10_mse16x16_c),
                      make_tuple(4, 4, &vpx_highbd_10_mse16x8_c),
                      make_tuple(4, 4, &vpx_highbd_10_mse8x16_c),
                      make_tuple(4, 4, &vpx_highbd_10_mse8x8_c),
                      make_tuple(4, 4, &vpx_highbd_8_mse16x16_c),
                      make_tuple(4, 4, &vpx_highbd_8_mse16x8_c),
                      make_tuple(4, 4, &vpx_highbd_8_mse8x16_c),
                      make_tuple(4, 4, &vpx_highbd_8_mse8x8_c)));
848 849
*/

850
INSTANTIATE_TEST_CASE_P(
851
    C, VpxHBDVarianceTest,
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 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891
    ::testing::Values(make_tuple(6, 6, &vpx_highbd_12_variance64x64_c, 12),
                      make_tuple(6, 5, &vpx_highbd_12_variance64x32_c, 12),
                      make_tuple(5, 6, &vpx_highbd_12_variance32x64_c, 12),
                      make_tuple(5, 5, &vpx_highbd_12_variance32x32_c, 12),
                      make_tuple(5, 4, &vpx_highbd_12_variance32x16_c, 12),
                      make_tuple(4, 5, &vpx_highbd_12_variance16x32_c, 12),
                      make_tuple(4, 4, &vpx_highbd_12_variance16x16_c, 12),
                      make_tuple(4, 3, &vpx_highbd_12_variance16x8_c, 12),
                      make_tuple(3, 4, &vpx_highbd_12_variance8x16_c, 12),
                      make_tuple(3, 3, &vpx_highbd_12_variance8x8_c, 12),
                      make_tuple(3, 2, &vpx_highbd_12_variance8x4_c, 12),
                      make_tuple(2, 3, &vpx_highbd_12_variance4x8_c, 12),
                      make_tuple(2, 2, &vpx_highbd_12_variance4x4_c, 12),
                      make_tuple(6, 6, &vpx_highbd_10_variance64x64_c, 10),
                      make_tuple(6, 5, &vpx_highbd_10_variance64x32_c, 10),
                      make_tuple(5, 6, &vpx_highbd_10_variance32x64_c, 10),
                      make_tuple(5, 5, &vpx_highbd_10_variance32x32_c, 10),
                      make_tuple(5, 4, &vpx_highbd_10_variance32x16_c, 10),
                      make_tuple(4, 5, &vpx_highbd_10_variance16x32_c, 10),
                      make_tuple(4, 4, &vpx_highbd_10_variance16x16_c, 10),
                      make_tuple(4, 3, &vpx_highbd_10_variance16x8_c, 10),
                      make_tuple(3, 4, &vpx_highbd_10_variance8x16_c, 10),
                      make_tuple(3, 3, &vpx_highbd_10_variance8x8_c, 10),
                      make_tuple(3, 2, &vpx_highbd_10_variance8x4_c, 10),
                      make_tuple(2, 3, &vpx_highbd_10_variance4x8_c, 10),
                      make_tuple(2, 2, &vpx_highbd_10_variance4x4_c, 10),
                      make_tuple(6, 6, &vpx_highbd_8_variance64x64_c, 8),
                      make_tuple(6, 5, &vpx_highbd_8_variance64x32_c, 8),
                      make_tuple(5, 6, &vpx_highbd_8_variance32x64_c, 8),
                      make_tuple(5, 5, &vpx_highbd_8_variance32x32_c, 8),
                      make_tuple(5, 4, &vpx_highbd_8_variance32x16_c, 8),
                      make_tuple(4, 5, &vpx_highbd_8_variance16x32_c, 8),
                      make_tuple(4, 4, &vpx_highbd_8_variance16x16_c, 8),
                      make_tuple(4, 3, &vpx_highbd_8_variance16x8_c, 8),
                      make_tuple(3, 4, &vpx_highbd_8_variance8x16_c, 8),
                      make_tuple(3, 3, &vpx_highbd_8_variance8x8_c, 8),
                      make_tuple(3, 2, &vpx_highbd_8_variance8x4_c, 8),
                      make_tuple(2, 3, &vpx_highbd_8_variance4x8_c, 8),
                      make_tuple(2, 2, &vpx_highbd_8_variance4x4_c, 8)));

892 893
INSTANTIATE_TEST_CASE_P(
    C, VpxHBDSubpelVarianceTest,
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934
    ::testing::Values(
        make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_c, 8),
        make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_c, 8),
        make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_c, 8),
        make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_c, 8),
        make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_c, 8),
        make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_c, 8),
        make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_c, 8),
        make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_c, 8),
        make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_c, 8),
        make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_c, 8),
        make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_c, 8),
        make_tuple(2, 3, &vpx_highbd_8_sub_pixel_variance4x8_c, 8),
        make_tuple(2, 2, &vpx_highbd_8_sub_pixel_variance4x4_c, 8),
        make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_c, 10),
        make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_c, 10),
        make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_c, 10),
        make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_c, 10),
        make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_c, 10),
        make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_c, 10),
        make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_c, 10),
        make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_c, 10),
        make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_c, 10),
        make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_c, 10),
        make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_c, 10),
        make_tuple(2, 3, &vpx_highbd_10_sub_pixel_variance4x8_c, 10),
        make_tuple(2, 2, &vpx_highbd_10_sub_pixel_variance4x4_c, 10),
        make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_c, 12),
        make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_c, 12),
        make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_c, 12),
        make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_c, 12),
        make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_c, 12),
        make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_c, 12),
        make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_c, 12),
        make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_c, 12),
        make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_c, 12),
        make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_c, 12),
        make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_c, 12),
        make_tuple(2, 3, &vpx_highbd_12_sub_pixel_variance4x8_c, 12),
        make_tuple(2, 2, &vpx_highbd_12_sub_pixel_variance4x4_c, 12)));

935 936 937
INSTANTIATE_TEST_CASE_P(
    C, VpxHBDSubpelAvgVarianceTest,
    ::testing::Values(
938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976
        make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_c, 8),
        make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_c, 8),
        make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_c, 8),
        make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_c, 8),
        make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_c, 8),
        make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_c, 8),
        make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_c, 8),
        make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_c, 8),
        make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_c, 8),
        make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_c, 8),
        make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_c, 8),
        make_tuple(2, 3, &vpx_highbd_8_sub_pixel_avg_variance4x8_c, 8),
        make_tuple(2, 2, &vpx_highbd_8_sub_pixel_avg_variance4x4_c, 8),
        make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_c, 10),
        make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_c, 10),
        make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_c, 10),
        make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_c, 10),
        make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_c, 10),
        make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_c, 10),
        make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_c, 10),
        make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_c, 10),
        make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_c, 10),
        make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_c, 10),
        make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_c, 10),
        make_tuple(2, 3, &vpx_highbd_10_sub_pixel_avg_variance4x8_c, 10),
        make_tuple(2, 2, &vpx_highbd_10_sub_pixel_avg_variance4x4_c, 10),
        make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_c, 12),
        make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_c, 12),
        make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_c, 12),
        make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_c, 12),
        make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_c, 12),
        make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_c, 12),
        make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_c, 12),
        make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_c, 12),
        make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_c, 12),
        make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_c, 12),
        make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_c, 12),
        make_tuple(2, 3, &vpx_highbd_12_sub_pixel_avg_variance4x8_c, 12),
        make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12)));
977
#endif  // CONFIG_VP9_HIGHBITDEPTH
978

James Zern's avatar
James Zern committed
979
#if HAVE_MMX
980 981
INSTANTIATE_TEST_CASE_P(
    MMX, VpxSubpelVarianceTest,
982 983 984 985 986
    ::testing::Values(make_tuple(4, 4, &vpx_sub_pixel_variance16x16_mmx, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_variance16x8_mmx, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_variance8x16_mmx, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_mmx, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_variance4x4_mmx, 0)));
987
#endif  // HAVE_MMX
James Zern's avatar
James Zern committed
988 989

#if HAVE_SSE2
990 991 992 993
INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
                        ::testing::Values(vpx_get_mb_ss_sse2));

INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
994 995 996 997 998
                        ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_sse2),
                                          make_tuple(4, 3, &vpx_mse16x8_sse2),
                                          make_tuple(3, 4, &vpx_mse8x16_sse2),
                                          make_tuple(3, 3, &vpx_mse8x8_sse2)));

James Zern's avatar
James Zern committed
999
INSTANTIATE_TEST_CASE_P(
1000
    SSE2, VpxVarianceTest,
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013
    ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_sse2, 0),
                      make_tuple(6, 5, &vpx_variance64x32_sse2, 0),
                      make_tuple(5, 6, &vpx_variance32x64_sse2, 0),
                      make_tuple(5, 5, &vpx_variance32x32_sse2, 0),
                      make_tuple(5, 4, &vpx_variance32x16_sse2, 0),
                      make_tuple(4, 5, &vpx_variance16x32_sse2, 0),
                      make_tuple(4, 4, &vpx_variance16x16_sse2, 0),
                      make_tuple(4, 3, &vpx_variance16x8_sse2, 0),
                      make_tuple(3, 4, &vpx_variance8x16_sse2, 0),
                      make_tuple(3, 3, &vpx_variance8x8_sse2, 0),
                      make_tuple(3, 2, &vpx_variance8x4_sse2, 0),
                      make_tuple(2, 3, &vpx_variance4x8_sse2, 0),
                      make_tuple(2, 2, &vpx_variance4x4_sse2, 0)));
1014 1015 1016 1017

#if CONFIG_USE_X86INC
INSTANTIATE_TEST_CASE_P(
    SSE2, VpxSubpelVarianceTest,
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_sse2, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_variance64x32_sse2, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_variance32x64_sse2, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_sse2, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_variance32x16_sse2, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_variance16x32_sse2, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_variance16x16_sse2, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_variance16x8_sse2, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_variance8x16_sse2, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_sse2, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_variance8x4_sse2, 0),
1029 1030
                      make_tuple(2, 3, &vpx_sub_pixel_variance4x8_sse2, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_variance4x4_sse2, 0)));
1031

1032 1033 1034
INSTANTIATE_TEST_CASE_P(
    SSE2, VpxSubpelAvgVarianceTest,
    ::testing::Values(
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
        make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_sse2, 0),
        make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_sse2, 0),
        make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_sse2, 0),
        make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_sse2, 0),
        make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_sse2, 0),
        make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_sse2, 0),
        make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_sse2, 0),
        make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_sse2, 0),
        make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_sse2, 0),
        make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_sse2, 0),
        make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_sse2, 0),
1046 1047
        make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_sse2, 0),
        make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_sse2, 0)));
1048 1049
#endif  // CONFIG_USE_X86INC

1050 1051 1052
#if CONFIG_VP9_HIGHBITDEPTH
/* TODO(debargha): This test does not support the highbd version
INSTANTIATE_TEST_CASE_P(
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
    SSE2, VpxHBDMseTest,
    ::testing::Values(make_tuple(4, 4, &vpx_highbd_12_mse16x16_sse2),
                      make_tuple(4, 3, &vpx_highbd_12_mse16x8_sse2),
                      make_tuple(3, 4, &vpx_highbd_12_mse8x16_sse2),
                      make_tuple(3, 3, &vpx_highbd_12_mse8x8_sse2),
                      make_tuple(4, 4, &vpx_highbd_10_mse16x16_sse2),
                      make_tuple(4, 3, &vpx_highbd_10_mse16x8_sse2),
                      make_tuple(3, 4, &vpx_highbd_10_mse8x16_sse2),
                      make_tuple(3, 3, &vpx_highbd_10_mse8x8_sse2),
                      make_tuple(4, 4, &vpx_highbd_8_mse16x16_sse2),
                      make_tuple(4, 3, &vpx_highbd_8_mse16x8_sse2),
                      make_tuple(3, 4, &vpx_highbd_8_mse8x16_sse2),
                      make_tuple(3, 3, &vpx_highbd_8_mse8x8_sse2)));
1066 1067 1068 1069
*/

INSTANTIATE_TEST_CASE_P(
    SSE2, VpxHBDVarianceTest,
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
    ::testing::Values(make_tuple(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
                      make_tuple(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
                      make_tuple(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
                      make_tuple(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
                      make_tuple(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
                      make_tuple(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
                      make_tuple(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
                      make_tuple(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
                      make_tuple(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
                      make_tuple(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
                      make_tuple(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
                      make_tuple(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
                      make_tuple(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
                      make_tuple(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
                      make_tuple(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
                      make_tuple(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
                      make_tuple(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
                      make_tuple(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
                      make_tuple(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
                      make_tuple(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
                      make_tuple(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
                      make_tuple(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
                      make_tuple(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
                      make_tuple(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
                      make_tuple(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
                      make_tuple(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
                      make_tuple(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
                      make_tuple(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
                      make_tuple(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
                      make_tuple(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
Johann's avatar
Johann committed
1100

Jim Bankoski's avatar
Jim Bankoski committed
1101
#if CONFIG_USE_X86INC
1102
INSTANTIATE_TEST_CASE_P(
1103
    SSE2, VpxHBDSubpelVarianceTest,
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
    ::testing::Values(
        make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_sse2, 12),
        make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_sse2, 12),
        make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_sse2, 12),
        make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_sse2, 12),
        make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_sse2, 12),
        make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_sse2, 12),
        make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_sse2, 12),
        make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_sse2, 12),
        make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_sse2, 12),
        make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_sse2, 12),
        make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_sse2, 12),
        make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_sse2, 10),
        make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_sse2, 10),
        make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_sse2, 10),
        make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_sse2, 10),
        make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_sse2, 10),
        make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_sse2, 10),
        make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_sse2, 10),
        make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_sse2, 10),
        make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_sse2, 10),
        make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_sse2, 10),
        make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_sse2, 10),
        make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_sse2, 8),
        make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_sse2, 8),
        make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_sse2, 8),
        make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_sse2, 8),
        make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_sse2, 8),
        make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_sse2, 8),
        make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_sse2, 8),
        make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_sse2, 8),
        make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_sse2, 8),
        make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_sse2, 8),
        make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_sse2, 8)));

1139
INSTANTIATE_TEST_CASE_P(
1140
    SSE2, VpxHBDSubpelAvgVarianceTest,
1141
    ::testing::Values(
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
        make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_sse2, 12),
        make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_sse2, 12),
        make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_sse2, 12),
        make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_sse2, 12),
        make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_sse2, 12),
        make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_sse2, 12),
        make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_sse2, 12),
        make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_sse2, 12),
        make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_sse2, 12),
        make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_sse2, 12),
        make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_sse2, 12),
        make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_sse2, 10),
        make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_sse2, 10),
        make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_sse2, 10),
        make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_sse2, 10),
        make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_sse2, 10),
        make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_sse2, 10),
        make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_sse2, 10),
        make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_sse2, 10),
        make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_sse2, 10),
        make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_sse2, 10),
        make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_sse2, 10),
        make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_sse2, 8),
        make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_sse2, 8),
        make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_sse2, 8),
        make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_sse2, 8),
        make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_sse2, 8),
        make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_sse2, 8),
        make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_sse2, 8),
        make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_sse2, 8),
        make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_sse2, 8),
        make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_sse2, 8),
        make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_sse2, 8)));
1175
#endif  // CONFIG_USE_X86INC
1176
#endif  // CONFIG_VP9_HIGHBITDEPTH
1177
#endif  // HAVE_SSE2
Johann's avatar
Johann committed
1178

1179
#if HAVE_SSSE3
Jim Bankoski's avatar
Jim Bankoski committed
1180
#if CONFIG_USE_X86INC
1181
INSTANTIATE_TEST_CASE_P(
1182
    SSSE3, VpxSubpelVarianceTest,
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_ssse3, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_variance64x32_ssse3, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_variance32x64_ssse3, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_ssse3, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_variance32x16_ssse3, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_variance16x32_ssse3, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_variance16x16_ssse3, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_variance16x8_ssse3, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_variance8x16_ssse3, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_ssse3, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_variance8x4_ssse3, 0),
                      make_tuple(2, 3, &vpx_sub_pixel_variance4x8_ssse3, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_variance4x4_ssse3, 0)));

1197
INSTANTIATE_TEST_CASE_P(
1198
    SSSE3, VpxSubpelAvgVarianceTest,
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
    ::testing::Values(
        make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_ssse3, 0),
        make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_ssse3, 0),
        make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_ssse3, 0),
        make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_ssse3, 0),
        make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_ssse3, 0),
        make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_ssse3, 0),
        make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_ssse3, 0),
        make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_ssse3, 0),
        make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_ssse3, 0),
        make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_ssse3, 0),
        make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_ssse3, 0),
        make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_ssse3, 0),
        make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_ssse3, 0)));
1213 1214
#endif  // CONFIG_USE_X86INC
#endif  // HAVE_SSSE3
Johann's avatar
Johann committed
1215

1216
#if HAVE_AVX2
1217
INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
1218 1219
                        ::testing::Values(make_tuple(4, 4,
                                                     &vpx_mse16x16_avx2)));
1220

1221
INSTANTIATE_TEST_CASE_P(
1222
    AVX2, VpxVarianceTest,
1223 1224 1225 1226 1227 1228
    ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_avx2, 0),
                      make_tuple(6, 5, &vpx_variance64x32_avx2, 0),
                      make_tuple(5, 5, &vpx_variance32x32_avx2, 0),
                      make_tuple(5, 4, &vpx_variance32x16_avx2, 0),
                      make_tuple(4, 4, &vpx_variance16x16_avx2, 0)));

1229
INSTANTIATE_TEST_CASE_P(
1230
    AVX2, VpxSubpelVarianceTest,
1231 1232
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_avx2, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_avx2, 0)));
1233

1234
INSTANTIATE_TEST_CASE_P(
1235
    AVX2, VpxSubpelAvgVarianceTest,
1236 1237 1238
    ::testing::Values(
        make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_avx2, 0),
        make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_avx2, 0)));
1239
#endif  // HAVE_AVX2
1240

Johann's avatar
Johann committed
1241
#if HAVE_MEDIA
1242
INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,
1243 1244
                        ::testing::Values(make_tuple(4, 4,
                                                     &vpx_mse16x16_media)));
1245 1246 1247

INSTANTIATE_TEST_CASE_P(
    MEDIA, VpxVarianceTest,
1248 1249
    ::testing::Values(make_tuple(4, 4, &vpx_variance16x16_media, 0),
                      make_tuple(3, 3, &vpx_variance8x8_media, 0)));
1250

Johann's avatar
Johann committed
1251
INSTANTIATE_TEST_CASE_P(
1252
    MEDIA, VpxSubpelVarianceTest,
1253 1254
    ::testing::Values(make_tuple(4, 4, &vpx_sub_pixel_variance16x16_media, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_media, 0)));
Johann's avatar
Johann committed
1255 1256
#endif  // HAVE_MEDIA

1257
#if HAVE_NEON
1258
INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
1259 1260
                        ::testing::Values(make_tuple(2, 2,
                                                     &vpx_get4x4sse_cs_neon)));
1261 1262

INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
1263 1264 1265
                        ::testing::Values(make_tuple(4, 4,
                                                     &vpx_mse16x16_neon)));

1266
INSTANTIATE_TEST_CASE_P(
1267
    NEON, VpxVarianceTest,
1268 1269 1270 1271 1272 1273 1274 1275 1276
    ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_neon, 0),
                      make_tuple(6, 5, &vpx_variance64x32_neon, 0),
                      make_tuple(5, 6, &vpx_variance32x64_neon, 0),
                      make_tuple(5, 5, &vpx_variance32x32_neon, 0),
                      make_tuple(4, 4, &vpx_variance16x16_neon, 0),
                      make_tuple(4, 3, &vpx_variance16x8_neon, 0),
                      make_tuple(3, 4, &vpx_variance8x16_neon, 0),
                      make_tuple(3, 3, &vpx_variance8x8_neon, 0)));

1277
INSTANTIATE_TEST_CASE_P(
1278
    NEON, VpxSubpelVarianceTest,
1279 1280 1281 1282
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_neon, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_neon, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_variance16x16_neon, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_neon, 0)));
1283
#endif  // HAVE_NEON
James Zern's avatar
James Zern committed
1284

1285 1286 1287 1288 1289
#if HAVE_MSA
INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
                        ::testing::Values(vpx_get_mb_ss_msa));

INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
1290 1291
                        ::testing::Values(make_tuple(2, 2,
                                                     &vpx_get4x4sse_cs_msa)));
1292 1293

INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
1294 1295 1296 1297 1298
                        ::testing::Values(make_tuple(4, 4, &vpx_mse16x16_msa),
                                          make_tuple(4, 3, &vpx_mse16x8_msa),
                                          make_tuple(3, 4, &vpx_mse8x16_msa),
                                          make_tuple(3, 3, &vpx_mse8x8_msa)));

1299 1300
INSTANTIATE_TEST_CASE_P(
    MSA, VpxVarianceTest,
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314
    ::testing::Values(make_tuple(6, 6, &vpx_variance64x64_msa, 0),
                      make_tuple(6, 5, &vpx_variance64x32_msa, 0),
                      make_tuple(5, 6, &vpx_variance32x64_msa, 0),
                      make_tuple(5, 5, &vpx_variance32x32_msa, 0),
                      make_tuple(5, 4, &vpx_variance32x16_msa, 0),
                      make_tuple(4, 5, &vpx_variance16x32_msa, 0),
                      make_tuple(4, 4, &vpx_variance16x16_msa, 0),
                      make_tuple(4, 3, &vpx_variance16x8_msa, 0),
                      make_tuple(3, 4, &vpx_variance8x16_msa, 0),
                      make_tuple(3, 3, &vpx_variance8x8_msa, 0),
                      make_tuple(3, 2, &vpx_variance8x4_msa, 0),
                      make_tuple(2, 3, &vpx_variance4x8_msa, 0),
                      make_tuple(2, 2, &vpx_variance4x4_msa, 0)));

1315
INSTANTIATE_TEST_CASE_P(
1316
    MSA, VpxSubpelVarianceTest,
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330
    ::testing::Values(make_tuple(2, 2, &vpx_sub_pixel_variance4x4_msa, 0),
                      make_tuple(2, 3, &vpx_sub_pixel_variance4x8_msa, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_variance8x4_msa, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_variance8x8_msa, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_variance8x16_msa, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_variance16x8_msa, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_variance16x16_msa, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_variance16x32_msa, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_variance32x16_msa, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_variance32x32_msa, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_variance32x64_msa, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_variance64x32_msa, 0),
                      make_tuple(6, 6, &vpx_sub_pixel_variance64x64_msa, 0)));

1331 1332
INSTANTIATE_TEST_CASE_P(
    MSA, VpxSubpelAvgVarianceTest,
1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
    ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_msa, 0),
                      make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_msa, 0),
                      make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_msa, 0),
                      make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_msa, 0),
                      make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_msa, 0),
                      make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_msa, 0),
                      make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_msa, 0),
                      make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_msa, 0),
                      make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_msa, 0),
                      make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_msa, 0),
                      make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_msa, 0),
                      make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_msa, 0),
                      make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_msa, 0)));
1346
#endif  // HAVE_MSA
1347
}  // namespace