variance_test.cc 36.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 *  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 <stdlib.h>
#include <new>

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

15
#include "test/clear_system_state.h"
16
#include "test/register_state_check.h"
17

James Zern's avatar
James Zern committed
18
#include "vpx/vpx_integer.h"
Yaowu Xu's avatar
Yaowu Xu committed
19
#include "./vpx_config.h"
20
#include "vpx_mem/vpx_mem.h"
James Zern's avatar
James Zern committed
21
#if CONFIG_VP8_ENCODER
Yaowu Xu's avatar
Yaowu Xu committed
22
# include "./vp8_rtcd.h"
23
# include "vp8/common/variance.h"
James Zern's avatar
James Zern committed
24 25
#endif
#if CONFIG_VP9_ENCODER
Yaowu Xu's avatar
Yaowu Xu committed
26
# include "./vp9_rtcd.h"
27
# include "vp9/encoder/vp9_variance.h"
James Zern's avatar
James Zern committed
28
#endif
29
#include "test/acm_random.h"
30 31 32 33 34 35

namespace {

using ::std::tr1::get;
using ::std::tr1::make_tuple;
using ::std::tr1::tuple;
36 37
using libvpx_test::ACMRandom;

38 39 40 41 42 43 44 45
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;
}

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
static unsigned int variance_ref(const uint8_t *ref, const uint8_t *src,
                                 int l2w, int l2h, unsigned int *sse_ptr) {
  int se = 0;
  unsigned int sse = 0;
  const int w = 1 << l2w, h = 1 << l2h;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      int diff = ref[w * y + x] - src[w * y + x];
      se += diff;
      sse += diff * diff;
    }
  }
  *sse_ptr = sse;
  return sse - (((int64_t) se * se) >> (l2w + l2h));
}

static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
                                        int l2w, int l2h, int xoff, int yoff,
                                        unsigned int *sse_ptr) {
  int se = 0;
  unsigned int sse = 0;
  const int w = 1 << l2w, h = 1 << l2h;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      // bilinear interpolation at a 16th pel step
      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);
      int diff = r - src[w * y + x];
      se += diff;
      sse += diff * diff;
    }
  }
  *sse_ptr = sse;
  return sse - (((int64_t) se * se) >> (l2w + l2h));
}
86

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);

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
131
template<typename VarianceFunctionType>
Yaowu Xu's avatar
Yaowu Xu committed
132 133
class VarianceTest
    : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > {
134 135
 public:
  virtual void SetUp() {
James Zern's avatar
James Zern committed
136
    const tuple<int, int, VarianceFunctionType>& params = this->GetParam();
137 138 139 140
    log2width_  = get<0>(params);
    width_ = 1 << log2width_;
    log2height_ = get<1>(params);
    height_ = 1 << log2height_;
141 142
    variance_ = get<2>(params);

143
    rnd_.Reset(ACMRandom::DeterministicSeed());
144
    block_size_ = width_ * height_;
145
    src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
146 147 148 149 150 151
    ref_ = new uint8_t[block_size_];
    ASSERT_TRUE(src_ != NULL);
    ASSERT_TRUE(ref_ != NULL);
  }

  virtual void TearDown() {
152
    vpx_free(src_);
153
    delete[] ref_;
154
    libvpx_test::ClearSystemState();
155 156 157
  }

 protected:
James Zern's avatar
James Zern committed
158
  void ZeroTest();
159
  void RefTest();
James Zern's avatar
James Zern committed
160 161
  void OneQuarterTest();

162
  ACMRandom rnd_;
163 164
  uint8_t* src_;
  uint8_t* ref_;
165 166
  int width_, log2width_;
  int height_, log2height_;
167
  int block_size_;
James Zern's avatar
James Zern committed
168
  VarianceFunctionType variance_;
169 170
};

James Zern's avatar
James Zern committed
171 172
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::ZeroTest() {
173 174 175 176 177
  for (int i = 0; i <= 255; ++i) {
    memset(src_, i, block_size_);
    for (int j = 0; j <= 255; ++j) {
      memset(ref_, j, block_size_);
      unsigned int sse;
178
      unsigned int var;
179 180
      ASM_REGISTER_STATE_CHECK(
          var = variance_(src_, width_, ref_, width_, &sse));
181 182 183 184 185
      EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j;
    }
  }
}

186 187 188 189
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::RefTest() {
  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < block_size_; j++) {
190 191
      src_[j] = rnd_.Rand8();
      ref_[j] = rnd_.Rand8();
192 193
    }
    unsigned int sse1, sse2;
194
    unsigned int var1;
195 196
    ASM_REGISTER_STATE_CHECK(
        var1 = variance_(src_, width_, ref_, width_, &sse1));
197 198 199 200 201 202 203
    const unsigned int var2 = variance_ref(src_, ref_, log2width_,
                                           log2height_, &sse2);
    EXPECT_EQ(sse1, sse2);
    EXPECT_EQ(var1, var2);
  }
}

James Zern's avatar
James Zern committed
204 205
template<typename VarianceFunctionType>
void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
206 207 208 209 210
  memset(src_, 255, block_size_);
  const int half = block_size_ / 2;
  memset(ref_, 255, half);
  memset(ref_ + half, 0, half);
  unsigned int sse;
211
  unsigned int var;
212
  ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
213 214 215 216
  const unsigned int expected = block_size_ * 255 * 255 / 4;
  EXPECT_EQ(expected, var);
}

217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
#if CONFIG_VP8_ENCODER
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;
    ASM_REGISTER_STATE_CHECK(mse_(src_, width_, ref_, width_, &sse1));
    variance_ref(src_, ref_, log2width_, log2height_, &sse2);
    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;
    ASM_REGISTER_STATE_CHECK(
        var1 = mse_(src_, width_, ref_, width_));
    variance_ref(src_, ref_, log2width_, log2height_, &sse2);
    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);
}
#endif

James Zern's avatar
James Zern committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339
#if CONFIG_VP9_ENCODER

unsigned int 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,
                                     unsigned int *sse_ptr) {
  int se = 0;
  unsigned int sse = 0;
  const int w = 1 << l2w, h = 1 << l2h;
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      // bilinear interpolation at a 16th pel step
      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);
      int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
      se += diff;
      sse += diff * diff;
    }
  }
  *sse_ptr = sse;
  return sse - (((int64_t) se * se) >> (l2w + l2h));
}

340
template<typename SubpelVarianceFunctionType>
Yaowu Xu's avatar
Yaowu Xu committed
341 342 343
class SubpelVarianceTest
    : public ::testing::TestWithParam<tuple<int, int,
                                            SubpelVarianceFunctionType> > {
344 345 346 347 348 349 350 351 352 353
 public:
  virtual void SetUp() {
    const tuple<int, int, SubpelVarianceFunctionType>& params =
        this->GetParam();
    log2width_  = get<0>(params);
    width_ = 1 << log2width_;
    log2height_ = get<1>(params);
    height_ = 1 << log2height_;
    subpel_variance_ = get<2>(params);

354
    rnd_.Reset(ACMRandom::DeterministicSeed());
355
    block_size_ = width_ * height_;
356 357
    src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
    sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
358 359
    ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
    ASSERT_TRUE(src_ != NULL);
360
    ASSERT_TRUE(sec_ != NULL);
361 362 363 364
    ASSERT_TRUE(ref_ != NULL);
  }

  virtual void TearDown() {
365
    vpx_free(src_);
366
    delete[] ref_;
367
    vpx_free(sec_);
368
    libvpx_test::ClearSystemState();
369 370 371 372 373
  }

 protected:
  void RefTest();

374
  ACMRandom rnd_;
375 376 377
  uint8_t *src_;
  uint8_t *ref_;
  uint8_t *sec_;
378 379 380 381 382 383 384 385 386 387 388
  int width_, log2width_;
  int height_, log2height_;
  int block_size_;
  SubpelVarianceFunctionType subpel_variance_;
};

template<typename SubpelVarianceFunctionType>
void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
  for (int x = 0; x < 16; ++x) {
    for (int y = 0; y < 16; ++y) {
      for (int j = 0; j < block_size_; j++) {
389
        src_[j] = rnd_.Rand8();
390 391
      }
      for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
392
        ref_[j] = rnd_.Rand8();
393 394
      }
      unsigned int sse1, sse2;
395
      unsigned int var1;
396 397
      ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
                                                       src_, width_, &sse1));
398 399 400 401 402 403 404 405
      const unsigned int var2 = subpel_variance_ref(ref_, src_, log2width_,
                                                    log2height_, x, y, &sse2);
      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
    }
  }
}

406 407 408 409 410
template<>
void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() {
  for (int x = 0; x < 16; ++x) {
    for (int y = 0; y < 16; ++y) {
      for (int j = 0; j < block_size_; j++) {
411 412
        src_[j] = rnd_.Rand8();
        sec_[j] = rnd_.Rand8();
413 414
      }
      for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
415
        ref_[j] = rnd_.Rand8();
416 417
      }
      unsigned int sse1, sse2;
418
      unsigned int var1;
419 420 421
      ASM_REGISTER_STATE_CHECK(
          var1 = subpel_variance_(ref_, width_ + 1, x, y,
                                  src_, width_, &sse1, sec_));
422 423 424 425 426 427 428 429 430
      const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
                                                        log2width_, log2height_,
                                                        x, y, &sse2);
      EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
      EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
    }
  }
}

James Zern's avatar
James Zern committed
431 432
#endif  // CONFIG_VP9_ENCODER

James Zern's avatar
James Zern committed
433 434 435 436 437 438
// -----------------------------------------------------------------------------
// VP8 test cases.

namespace vp8 {

#if CONFIG_VP8_ENCODER
439 440 441 442 443
typedef unsigned int (*vp8_sse_fn_t)(const unsigned char *src_ptr,
    int source_stride, const unsigned char *ref_ptr, int  ref_stride);

typedef MseTest<vp8_sse_fn_t> VP8SseTest;
typedef MseTest<vp8_variance_fn_t> VP8MseTest;
James Zern's avatar
James Zern committed
444 445
typedef VarianceTest<vp8_variance_fn_t> VP8VarianceTest;

446 447 448 449
TEST_P(VP8SseTest, Ref_sse) { RefTest_sse(); }
TEST_P(VP8SseTest, Max_sse) { MaxTest_sse(); }
TEST_P(VP8MseTest, Ref_mse) { RefTest_mse(); }
TEST_P(VP8MseTest, Max_mse) { MaxTest_mse(); }
James Zern's avatar
James Zern committed
450
TEST_P(VP8VarianceTest, Zero) { ZeroTest(); }
451
TEST_P(VP8VarianceTest, Ref) { RefTest(); }
James Zern's avatar
James Zern committed
452 453
TEST_P(VP8VarianceTest, OneQuarter) { OneQuarterTest(); }

454 455 456 457 458 459 460 461 462 463
const vp8_sse_fn_t get4x4sse_cs_c = vp8_get4x4sse_cs_c;
INSTANTIATE_TEST_CASE_P(
    C, VP8SseTest,
    ::testing::Values(make_tuple(2, 2, get4x4sse_cs_c)));

const vp8_variance_fn_t mse16x16_c = vp8_mse16x16_c;
INSTANTIATE_TEST_CASE_P(
    C, VP8MseTest,
    ::testing::Values(make_tuple(4, 4, mse16x16_c)));

464 465 466 467 468
const vp8_variance_fn_t variance4x4_c = vp8_variance4x4_c;
const vp8_variance_fn_t variance8x8_c = vp8_variance8x8_c;
const vp8_variance_fn_t variance8x16_c = vp8_variance8x16_c;
const vp8_variance_fn_t variance16x8_c = vp8_variance16x8_c;
const vp8_variance_fn_t variance16x16_c = vp8_variance16x16_c;
James Zern's avatar
James Zern committed
469 470
INSTANTIATE_TEST_CASE_P(
    C, VP8VarianceTest,
471 472 473 474 475
    ::testing::Values(make_tuple(2, 2, variance4x4_c),
                      make_tuple(3, 3, variance8x8_c),
                      make_tuple(3, 4, variance8x16_c),
                      make_tuple(4, 3, variance16x8_c),
                      make_tuple(4, 4, variance16x16_c)));
James Zern's avatar
James Zern committed
476

477
#if HAVE_NEON
478 479 480 481 482 483 484 485 486 487
const vp8_sse_fn_t get4x4sse_cs_neon = vp8_get4x4sse_cs_neon;
INSTANTIATE_TEST_CASE_P(
    NEON, VP8SseTest,
    ::testing::Values(make_tuple(2, 2, get4x4sse_cs_neon)));

const vp8_variance_fn_t mse16x16_neon = vp8_mse16x16_neon;
INSTANTIATE_TEST_CASE_P(
    NEON, VP8MseTest,
    ::testing::Values(make_tuple(4, 4, mse16x16_neon)));

488 489 490 491
const vp8_variance_fn_t variance8x8_neon = vp8_variance8x8_neon;
const vp8_variance_fn_t variance8x16_neon = vp8_variance8x16_neon;
const vp8_variance_fn_t variance16x8_neon = vp8_variance16x8_neon;
const vp8_variance_fn_t variance16x16_neon = vp8_variance16x16_neon;
492 493
INSTANTIATE_TEST_CASE_P(
    NEON, VP8VarianceTest,
494 495 496 497
    ::testing::Values(make_tuple(3, 3, variance8x8_neon),
                      make_tuple(3, 4, variance8x16_neon),
                      make_tuple(4, 3, variance16x8_neon),
                      make_tuple(4, 4, variance16x16_neon)));
498 499
#endif

500

James Zern's avatar
James Zern committed
501
#if HAVE_MMX
502 503 504 505 506
const vp8_variance_fn_t variance4x4_mmx = vp8_variance4x4_mmx;
const vp8_variance_fn_t variance8x8_mmx = vp8_variance8x8_mmx;
const vp8_variance_fn_t variance8x16_mmx = vp8_variance8x16_mmx;
const vp8_variance_fn_t variance16x8_mmx = vp8_variance16x8_mmx;
const vp8_variance_fn_t variance16x16_mmx = vp8_variance16x16_mmx;
James Zern's avatar
James Zern committed
507 508
INSTANTIATE_TEST_CASE_P(
    MMX, VP8VarianceTest,
509 510 511 512 513
    ::testing::Values(make_tuple(2, 2, variance4x4_mmx),
                      make_tuple(3, 3, variance8x8_mmx),
                      make_tuple(3, 4, variance8x16_mmx),
                      make_tuple(4, 3, variance16x8_mmx),
                      make_tuple(4, 4, variance16x16_mmx)));
James Zern's avatar
James Zern committed
514 515 516
#endif

#if HAVE_SSE2
517 518 519 520 521
const vp8_variance_fn_t variance4x4_wmt = vp8_variance4x4_wmt;
const vp8_variance_fn_t variance8x8_wmt = vp8_variance8x8_wmt;
const vp8_variance_fn_t variance8x16_wmt = vp8_variance8x16_wmt;
const vp8_variance_fn_t variance16x8_wmt = vp8_variance16x8_wmt;
const vp8_variance_fn_t variance16x16_wmt = vp8_variance16x16_wmt;
James Zern's avatar
James Zern committed
522 523
INSTANTIATE_TEST_CASE_P(
    SSE2, VP8VarianceTest,
524 525 526 527 528
    ::testing::Values(make_tuple(2, 2, variance4x4_wmt),
                      make_tuple(3, 3, variance8x8_wmt),
                      make_tuple(3, 4, variance8x16_wmt),
                      make_tuple(4, 3, variance16x8_wmt),
                      make_tuple(4, 4, variance16x16_wmt)));
James Zern's avatar
James Zern committed
529 530 531 532 533 534 535 536 537 538 539
#endif
#endif  // CONFIG_VP8_ENCODER

}  // namespace vp8

// -----------------------------------------------------------------------------
// VP9 test cases.

namespace vp9 {

#if CONFIG_VP9_ENCODER
540 541 542 543 544 545 546

TEST_P(SumOfSquaresTest, Const) { ConstTest(); }
TEST_P(SumOfSquaresTest, Ref) { RefTest(); }

INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
                        ::testing::Values(vp9_get_mb_ss_c));

James Zern's avatar
James Zern committed
547
typedef VarianceTest<vp9_variance_fn_t> VP9VarianceTest;
548
typedef SubpelVarianceTest<vp9_subpixvariance_fn_t> VP9SubpelVarianceTest;
549
typedef SubpelVarianceTest<vp9_subp_avg_variance_fn_t> VP9SubpelAvgVarianceTest;
James Zern's avatar
James Zern committed
550 551

TEST_P(VP9VarianceTest, Zero) { ZeroTest(); }
552 553
TEST_P(VP9VarianceTest, Ref) { RefTest(); }
TEST_P(VP9SubpelVarianceTest, Ref) { RefTest(); }
554
TEST_P(VP9SubpelAvgVarianceTest, Ref) { RefTest(); }
James Zern's avatar
James Zern committed
555 556
TEST_P(VP9VarianceTest, OneQuarter) { OneQuarterTest(); }

557 558 559 560 561 562 563 564 565 566 567 568 569
const vp9_variance_fn_t variance4x4_c = vp9_variance4x4_c;
const vp9_variance_fn_t variance4x8_c = vp9_variance4x8_c;
const vp9_variance_fn_t variance8x4_c = vp9_variance8x4_c;
const vp9_variance_fn_t variance8x8_c = vp9_variance8x8_c;
const vp9_variance_fn_t variance8x16_c = vp9_variance8x16_c;
const vp9_variance_fn_t variance16x8_c = vp9_variance16x8_c;
const vp9_variance_fn_t variance16x16_c = vp9_variance16x16_c;
const vp9_variance_fn_t variance16x32_c = vp9_variance16x32_c;
const vp9_variance_fn_t variance32x16_c = vp9_variance32x16_c;
const vp9_variance_fn_t variance32x32_c = vp9_variance32x32_c;
const vp9_variance_fn_t variance32x64_c = vp9_variance32x64_c;
const vp9_variance_fn_t variance64x32_c = vp9_variance64x32_c;
const vp9_variance_fn_t variance64x64_c = vp9_variance64x64_c;
570 571
INSTANTIATE_TEST_CASE_P(
    C, VP9VarianceTest,
572 573 574 575 576 577 578 579 580 581 582 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
    ::testing::Values(make_tuple(2, 2, variance4x4_c),
                      make_tuple(2, 3, variance4x8_c),
                      make_tuple(3, 2, variance8x4_c),
                      make_tuple(3, 3, variance8x8_c),
                      make_tuple(3, 4, variance8x16_c),
                      make_tuple(4, 3, variance16x8_c),
                      make_tuple(4, 4, variance16x16_c),
                      make_tuple(4, 5, variance16x32_c),
                      make_tuple(5, 4, variance32x16_c),
                      make_tuple(5, 5, variance32x32_c),
                      make_tuple(5, 6, variance32x64_c),
                      make_tuple(6, 5, variance64x32_c),
                      make_tuple(6, 6, variance64x64_c)));

const vp9_subpixvariance_fn_t subpel_variance4x4_c =
    vp9_sub_pixel_variance4x4_c;
const vp9_subpixvariance_fn_t subpel_variance4x8_c =
    vp9_sub_pixel_variance4x8_c;
const vp9_subpixvariance_fn_t subpel_variance8x4_c =
    vp9_sub_pixel_variance8x4_c;
const vp9_subpixvariance_fn_t subpel_variance8x8_c =
    vp9_sub_pixel_variance8x8_c;
const vp9_subpixvariance_fn_t subpel_variance8x16_c =
    vp9_sub_pixel_variance8x16_c;
const vp9_subpixvariance_fn_t subpel_variance16x8_c =
    vp9_sub_pixel_variance16x8_c;
const vp9_subpixvariance_fn_t subpel_variance16x16_c =
    vp9_sub_pixel_variance16x16_c;
const vp9_subpixvariance_fn_t subpel_variance16x32_c =
    vp9_sub_pixel_variance16x32_c;
const vp9_subpixvariance_fn_t subpel_variance32x16_c =
    vp9_sub_pixel_variance32x16_c;
const vp9_subpixvariance_fn_t subpel_variance32x32_c =
    vp9_sub_pixel_variance32x32_c;
const vp9_subpixvariance_fn_t subpel_variance32x64_c =
    vp9_sub_pixel_variance32x64_c;
const vp9_subpixvariance_fn_t subpel_variance64x32_c =
    vp9_sub_pixel_variance64x32_c;
const vp9_subpixvariance_fn_t subpel_variance64x64_c =
    vp9_sub_pixel_variance64x64_c;
612 613
INSTANTIATE_TEST_CASE_P(
    C, VP9SubpelVarianceTest,
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
    ::testing::Values(make_tuple(2, 2, subpel_variance4x4_c),
                      make_tuple(2, 3, subpel_variance4x8_c),
                      make_tuple(3, 2, subpel_variance8x4_c),
                      make_tuple(3, 3, subpel_variance8x8_c),
                      make_tuple(3, 4, subpel_variance8x16_c),
                      make_tuple(4, 3, subpel_variance16x8_c),
                      make_tuple(4, 4, subpel_variance16x16_c),
                      make_tuple(4, 5, subpel_variance16x32_c),
                      make_tuple(5, 4, subpel_variance32x16_c),
                      make_tuple(5, 5, subpel_variance32x32_c),
                      make_tuple(5, 6, subpel_variance32x64_c),
                      make_tuple(6, 5, subpel_variance64x32_c),
                      make_tuple(6, 6, subpel_variance64x64_c)));

const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_c =
    vp9_sub_pixel_avg_variance4x4_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_c =
    vp9_sub_pixel_avg_variance4x8_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_c =
    vp9_sub_pixel_avg_variance8x4_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_c =
    vp9_sub_pixel_avg_variance8x8_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_c =
    vp9_sub_pixel_avg_variance8x16_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_c =
    vp9_sub_pixel_avg_variance16x8_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_c =
    vp9_sub_pixel_avg_variance16x16_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_c =
    vp9_sub_pixel_avg_variance16x32_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_c =
    vp9_sub_pixel_avg_variance32x16_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_c =
    vp9_sub_pixel_avg_variance32x32_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_c =
    vp9_sub_pixel_avg_variance32x64_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_c =
    vp9_sub_pixel_avg_variance64x32_c;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_c =
    vp9_sub_pixel_avg_variance64x64_c;
654 655
INSTANTIATE_TEST_CASE_P(
    C, VP9SubpelAvgVarianceTest,
656 657 658 659 660 661 662 663 664 665 666 667 668
    ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_c),
                      make_tuple(2, 3, subpel_avg_variance4x8_c),
                      make_tuple(3, 2, subpel_avg_variance8x4_c),
                      make_tuple(3, 3, subpel_avg_variance8x8_c),
                      make_tuple(3, 4, subpel_avg_variance8x16_c),
                      make_tuple(4, 3, subpel_avg_variance16x8_c),
                      make_tuple(4, 4, subpel_avg_variance16x16_c),
                      make_tuple(4, 5, subpel_avg_variance16x32_c),
                      make_tuple(5, 4, subpel_avg_variance32x16_c),
                      make_tuple(5, 5, subpel_avg_variance32x32_c),
                      make_tuple(5, 6, subpel_avg_variance32x64_c),
                      make_tuple(6, 5, subpel_avg_variance64x32_c),
                      make_tuple(6, 6, subpel_avg_variance64x64_c)));
669

670
#if HAVE_SSE2
Jim Bankoski's avatar
Jim Bankoski committed
671
#if CONFIG_USE_X86INC
672 673 674 675

INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
                        ::testing::Values(vp9_get_mb_ss_sse2));

676 677 678 679 680 681 682 683 684 685 686 687 688
const vp9_variance_fn_t variance4x4_sse2 = vp9_variance4x4_sse2;
const vp9_variance_fn_t variance4x8_sse2 = vp9_variance4x8_sse2;
const vp9_variance_fn_t variance8x4_sse2 = vp9_variance8x4_sse2;
const vp9_variance_fn_t variance8x8_sse2 = vp9_variance8x8_sse2;
const vp9_variance_fn_t variance8x16_sse2 = vp9_variance8x16_sse2;
const vp9_variance_fn_t variance16x8_sse2 = vp9_variance16x8_sse2;
const vp9_variance_fn_t variance16x16_sse2 = vp9_variance16x16_sse2;
const vp9_variance_fn_t variance16x32_sse2 = vp9_variance16x32_sse2;
const vp9_variance_fn_t variance32x16_sse2 = vp9_variance32x16_sse2;
const vp9_variance_fn_t variance32x32_sse2 = vp9_variance32x32_sse2;
const vp9_variance_fn_t variance32x64_sse2 = vp9_variance32x64_sse2;
const vp9_variance_fn_t variance64x32_sse2 = vp9_variance64x32_sse2;
const vp9_variance_fn_t variance64x64_sse2 = vp9_variance64x64_sse2;
689 690
INSTANTIATE_TEST_CASE_P(
    SSE2, VP9VarianceTest,
691 692 693 694 695 696 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
    ::testing::Values(make_tuple(2, 2, variance4x4_sse2),
                      make_tuple(2, 3, variance4x8_sse2),
                      make_tuple(3, 2, variance8x4_sse2),
                      make_tuple(3, 3, variance8x8_sse2),
                      make_tuple(3, 4, variance8x16_sse2),
                      make_tuple(4, 3, variance16x8_sse2),
                      make_tuple(4, 4, variance16x16_sse2),
                      make_tuple(4, 5, variance16x32_sse2),
                      make_tuple(5, 4, variance32x16_sse2),
                      make_tuple(5, 5, variance32x32_sse2),
                      make_tuple(5, 6, variance32x64_sse2),
                      make_tuple(6, 5, variance64x32_sse2),
                      make_tuple(6, 6, variance64x64_sse2)));

const vp9_subpixvariance_fn_t subpel_variance4x4_sse =
    vp9_sub_pixel_variance4x4_sse;
const vp9_subpixvariance_fn_t subpel_variance4x8_sse =
    vp9_sub_pixel_variance4x8_sse;
const vp9_subpixvariance_fn_t subpel_variance8x4_sse2 =
    vp9_sub_pixel_variance8x4_sse2;
const vp9_subpixvariance_fn_t subpel_variance8x8_sse2 =
    vp9_sub_pixel_variance8x8_sse2;
const vp9_subpixvariance_fn_t subpel_variance8x16_sse2 =
    vp9_sub_pixel_variance8x16_sse2;
const vp9_subpixvariance_fn_t subpel_variance16x8_sse2 =
    vp9_sub_pixel_variance16x8_sse2;
const vp9_subpixvariance_fn_t subpel_variance16x16_sse2 =
    vp9_sub_pixel_variance16x16_sse2;
const vp9_subpixvariance_fn_t subpel_variance16x32_sse2 =
    vp9_sub_pixel_variance16x32_sse2;
const vp9_subpixvariance_fn_t subpel_variance32x16_sse2 =
    vp9_sub_pixel_variance32x16_sse2;
const vp9_subpixvariance_fn_t subpel_variance32x32_sse2 =
    vp9_sub_pixel_variance32x32_sse2;
const vp9_subpixvariance_fn_t subpel_variance32x64_sse2 =
    vp9_sub_pixel_variance32x64_sse2;
const vp9_subpixvariance_fn_t subpel_variance64x32_sse2 =
    vp9_sub_pixel_variance64x32_sse2;
const vp9_subpixvariance_fn_t subpel_variance64x64_sse2 =
    vp9_sub_pixel_variance64x64_sse2;
731 732
INSTANTIATE_TEST_CASE_P(
    SSE2, VP9SubpelVarianceTest,
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
    ::testing::Values(make_tuple(2, 2, subpel_variance4x4_sse),
                      make_tuple(2, 3, subpel_variance4x8_sse),
                      make_tuple(3, 2, subpel_variance8x4_sse2),
                      make_tuple(3, 3, subpel_variance8x8_sse2),
                      make_tuple(3, 4, subpel_variance8x16_sse2),
                      make_tuple(4, 3, subpel_variance16x8_sse2),
                      make_tuple(4, 4, subpel_variance16x16_sse2),
                      make_tuple(4, 5, subpel_variance16x32_sse2),
                      make_tuple(5, 4, subpel_variance32x16_sse2),
                      make_tuple(5, 5, subpel_variance32x32_sse2),
                      make_tuple(5, 6, subpel_variance32x64_sse2),
                      make_tuple(6, 5, subpel_variance64x32_sse2),
                      make_tuple(6, 6, subpel_variance64x64_sse2)));

const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_sse =
    vp9_sub_pixel_avg_variance4x4_sse;
const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_sse =
    vp9_sub_pixel_avg_variance4x8_sse;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_sse2 =
    vp9_sub_pixel_avg_variance8x4_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_sse2 =
    vp9_sub_pixel_avg_variance8x8_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_sse2 =
    vp9_sub_pixel_avg_variance8x16_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_sse2 =
    vp9_sub_pixel_avg_variance16x8_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_sse2 =
    vp9_sub_pixel_avg_variance16x16_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_sse2 =
    vp9_sub_pixel_avg_variance16x32_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_sse2 =
    vp9_sub_pixel_avg_variance32x16_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_sse2 =
    vp9_sub_pixel_avg_variance32x32_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_sse2 =
    vp9_sub_pixel_avg_variance32x64_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_sse2 =
    vp9_sub_pixel_avg_variance64x32_sse2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_sse2 =
    vp9_sub_pixel_avg_variance64x64_sse2;
773 774
INSTANTIATE_TEST_CASE_P(
    SSE2, VP9SubpelAvgVarianceTest,
775 776 777 778 779 780 781 782 783 784 785 786 787
    ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_sse),
                      make_tuple(2, 3, subpel_avg_variance4x8_sse),
                      make_tuple(3, 2, subpel_avg_variance8x4_sse2),
                      make_tuple(3, 3, subpel_avg_variance8x8_sse2),
                      make_tuple(3, 4, subpel_avg_variance8x16_sse2),
                      make_tuple(4, 3, subpel_avg_variance16x8_sse2),
                      make_tuple(4, 4, subpel_avg_variance16x16_sse2),
                      make_tuple(4, 5, subpel_avg_variance16x32_sse2),
                      make_tuple(5, 4, subpel_avg_variance32x16_sse2),
                      make_tuple(5, 5, subpel_avg_variance32x32_sse2),
                      make_tuple(5, 6, subpel_avg_variance32x64_sse2),
                      make_tuple(6, 5, subpel_avg_variance64x32_sse2),
                      make_tuple(6, 6, subpel_avg_variance64x64_sse2)));
788
#endif
Jim Bankoski's avatar
Jim Bankoski committed
789
#endif
790 791

#if HAVE_SSSE3
Jim Bankoski's avatar
Jim Bankoski committed
792 793
#if CONFIG_USE_X86INC

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
const vp9_subpixvariance_fn_t subpel_variance4x4_ssse3 =
    vp9_sub_pixel_variance4x4_ssse3;
const vp9_subpixvariance_fn_t subpel_variance4x8_ssse3 =
    vp9_sub_pixel_variance4x8_ssse3;
const vp9_subpixvariance_fn_t subpel_variance8x4_ssse3 =
    vp9_sub_pixel_variance8x4_ssse3;
const vp9_subpixvariance_fn_t subpel_variance8x8_ssse3 =
    vp9_sub_pixel_variance8x8_ssse3;
const vp9_subpixvariance_fn_t subpel_variance8x16_ssse3 =
    vp9_sub_pixel_variance8x16_ssse3;
const vp9_subpixvariance_fn_t subpel_variance16x8_ssse3 =
    vp9_sub_pixel_variance16x8_ssse3;
const vp9_subpixvariance_fn_t subpel_variance16x16_ssse3 =
    vp9_sub_pixel_variance16x16_ssse3;
const vp9_subpixvariance_fn_t subpel_variance16x32_ssse3 =
    vp9_sub_pixel_variance16x32_ssse3;
const vp9_subpixvariance_fn_t subpel_variance32x16_ssse3 =
    vp9_sub_pixel_variance32x16_ssse3;
const vp9_subpixvariance_fn_t subpel_variance32x32_ssse3 =
    vp9_sub_pixel_variance32x32_ssse3;
const vp9_subpixvariance_fn_t subpel_variance32x64_ssse3 =
    vp9_sub_pixel_variance32x64_ssse3;
const vp9_subpixvariance_fn_t subpel_variance64x32_ssse3 =
    vp9_sub_pixel_variance64x32_ssse3;
const vp9_subpixvariance_fn_t subpel_variance64x64_ssse3 =
    vp9_sub_pixel_variance64x64_ssse3;
820 821
INSTANTIATE_TEST_CASE_P(
    SSSE3, VP9SubpelVarianceTest,
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
    ::testing::Values(make_tuple(2, 2, subpel_variance4x4_ssse3),
                      make_tuple(2, 3, subpel_variance4x8_ssse3),
                      make_tuple(3, 2, subpel_variance8x4_ssse3),
                      make_tuple(3, 3, subpel_variance8x8_ssse3),
                      make_tuple(3, 4, subpel_variance8x16_ssse3),
                      make_tuple(4, 3, subpel_variance16x8_ssse3),
                      make_tuple(4, 4, subpel_variance16x16_ssse3),
                      make_tuple(4, 5, subpel_variance16x32_ssse3),
                      make_tuple(5, 4, subpel_variance32x16_ssse3),
                      make_tuple(5, 5, subpel_variance32x32_ssse3),
                      make_tuple(5, 6, subpel_variance32x64_ssse3),
                      make_tuple(6, 5, subpel_variance64x32_ssse3),
                      make_tuple(6, 6, subpel_variance64x64_ssse3)));

const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_ssse3 =
    vp9_sub_pixel_avg_variance4x4_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_ssse3 =
    vp9_sub_pixel_avg_variance4x8_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_ssse3 =
    vp9_sub_pixel_avg_variance8x4_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_ssse3 =
    vp9_sub_pixel_avg_variance8x8_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_ssse3 =
    vp9_sub_pixel_avg_variance8x16_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_ssse3 =
    vp9_sub_pixel_avg_variance16x8_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_ssse3 =
    vp9_sub_pixel_avg_variance16x16_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_ssse3 =
    vp9_sub_pixel_avg_variance16x32_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_ssse3 =
    vp9_sub_pixel_avg_variance32x16_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_ssse3 =
    vp9_sub_pixel_avg_variance32x32_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_ssse3 =
    vp9_sub_pixel_avg_variance32x64_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_ssse3 =
    vp9_sub_pixel_avg_variance64x32_ssse3;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_ssse3 =
    vp9_sub_pixel_avg_variance64x64_ssse3;
862 863
INSTANTIATE_TEST_CASE_P(
    SSSE3, VP9SubpelAvgVarianceTest,
864 865 866 867 868 869 870 871 872 873 874 875 876
    ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_ssse3),
                      make_tuple(2, 3, subpel_avg_variance4x8_ssse3),
                      make_tuple(3, 2, subpel_avg_variance8x4_ssse3),
                      make_tuple(3, 3, subpel_avg_variance8x8_ssse3),
                      make_tuple(3, 4, subpel_avg_variance8x16_ssse3),
                      make_tuple(4, 3, subpel_avg_variance16x8_ssse3),
                      make_tuple(4, 4, subpel_avg_variance16x16_ssse3),
                      make_tuple(4, 5, subpel_avg_variance16x32_ssse3),
                      make_tuple(5, 4, subpel_avg_variance32x16_ssse3),
                      make_tuple(5, 5, subpel_avg_variance32x32_ssse3),
                      make_tuple(5, 6, subpel_avg_variance32x64_ssse3),
                      make_tuple(6, 5, subpel_avg_variance64x32_ssse3),
                      make_tuple(6, 6, subpel_avg_variance64x64_ssse3)));
877
#endif
Jim Bankoski's avatar
Jim Bankoski committed
878
#endif
879 880

#if HAVE_AVX2
levytamar82's avatar
levytamar82 committed
881

882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
const vp9_variance_fn_t variance16x16_avx2 = vp9_variance16x16_avx2;
const vp9_variance_fn_t variance32x16_avx2 = vp9_variance32x16_avx2;
const vp9_variance_fn_t variance32x32_avx2 = vp9_variance32x32_avx2;
const vp9_variance_fn_t variance64x32_avx2 = vp9_variance64x32_avx2;
const vp9_variance_fn_t variance64x64_avx2 = vp9_variance64x64_avx2;
INSTANTIATE_TEST_CASE_P(
    AVX2, VP9VarianceTest,
    ::testing::Values(make_tuple(4, 4, variance16x16_avx2),
                      make_tuple(5, 4, variance32x16_avx2),
                      make_tuple(5, 5, variance32x32_avx2),
                      make_tuple(6, 5, variance64x32_avx2),
                      make_tuple(6, 6, variance64x64_avx2)));

const vp9_subpixvariance_fn_t subpel_variance32x32_avx2 =
    vp9_sub_pixel_variance32x32_avx2;
const vp9_subpixvariance_fn_t subpel_variance64x64_avx2 =
    vp9_sub_pixel_variance64x64_avx2;
INSTANTIATE_TEST_CASE_P(
levytamar82's avatar
levytamar82 committed
900
    AVX2, VP9SubpelVarianceTest,
901 902 903 904 905 906 907 908
    ::testing::Values(make_tuple(5, 5, subpel_variance32x32_avx2),
                      make_tuple(6, 6, subpel_variance64x64_avx2)));

const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_avx2 =
    vp9_sub_pixel_avg_variance32x32_avx2;
const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_avx2 =
    vp9_sub_pixel_avg_variance64x64_avx2;
INSTANTIATE_TEST_CASE_P(
levytamar82's avatar
levytamar82 committed
909
    AVX2, VP9SubpelAvgVarianceTest,
910 911 912
    ::testing::Values(make_tuple(5, 5, subpel_avg_variance32x32_avx2),
                      make_tuple(6, 6, subpel_avg_variance64x64_avx2)));
#endif  // HAVE_AVX2
913
#if HAVE_NEON
914
const vp9_variance_fn_t variance8x8_neon = vp9_variance8x8_neon;
915
const vp9_variance_fn_t variance16x16_neon = vp9_variance16x16_neon;
916
const vp9_variance_fn_t variance32x32_neon = vp9_variance32x32_neon;
917 918
INSTANTIATE_TEST_CASE_P(
    NEON, VP9VarianceTest,
919 920
    ::testing::Values(make_tuple(3, 3, variance8x8_neon),
                      make_tuple(4, 4, variance16x16_neon),
921
                      make_tuple(5, 5, variance32x32_neon)));
922

923 924
const vp9_subpixvariance_fn_t subpel_variance8x8_neon =
    vp9_sub_pixel_variance8x8_neon;
925 926
const vp9_subpixvariance_fn_t subpel_variance16x16_neon =
    vp9_sub_pixel_variance16x16_neon;
927 928
const vp9_subpixvariance_fn_t subpel_variance32x32_neon =
    vp9_sub_pixel_variance32x32_neon;
929 930
INSTANTIATE_TEST_CASE_P(
    NEON, VP9SubpelVarianceTest,
931 932
    ::testing::Values(make_tuple(3, 3, subpel_variance8x8_neon),
                      make_tuple(4, 4, subpel_variance16x16_neon),
933
                      make_tuple(5, 5, subpel_variance32x32_neon)));
934
#endif  // HAVE_NEON
James Zern's avatar
James Zern committed
935 936 937 938
#endif  // CONFIG_VP9_ENCODER

}  // namespace vp9

939
}  // namespace