sad_test.cc 40.9 KB
Newer Older
Johann's avatar
Johann committed
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 <string.h>
#include <limits.h>
#include <stdio.h>

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

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

clang-format's avatar
clang-format committed
27
template <typename Function>
skal's avatar
skal committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
struct TestParams {
  TestParams(int w, int h, Function f, int bd = -1)
      : width(w), height(h), bit_depth(bd), func(f) {}
  int width, height, bit_depth;
  Function func;
};

typedef unsigned int (*SadMxNFunc)(const uint8_t *src_ptr, int src_stride,
                                   const uint8_t *ref_ptr, int ref_stride);
typedef TestParams<SadMxNFunc> SadMxNParam;

typedef unsigned int (*SadMxNAvgFunc)(const uint8_t *src_ptr, int src_stride,
                                      const uint8_t *ref_ptr, int ref_stride,
                                      const uint8_t *second_pred);
typedef TestParams<SadMxNAvgFunc> SadMxNAvgParam;

typedef void (*SadMxNx4Func)(const uint8_t *src_ptr, int src_stride,
                             const uint8_t *const ref_ptr[], int ref_stride,
                             unsigned int *sad_array);
typedef TestParams<SadMxNx4Func> SadMxNx4Param;
48

Johann's avatar
Johann committed
49 50 51
using libvpx_test::ACMRandom;

namespace {
clang-format's avatar
clang-format committed
52
template <typename ParamType>
skal's avatar
skal committed
53
class SADTestBase : public ::testing::TestWithParam<ParamType> {
54
 public:
clang-format's avatar
clang-format committed
55
  explicit SADTestBase(const ParamType &params) : params_(params) {}
56

skal's avatar
skal committed
57
  virtual void SetUp() {
clang-format's avatar
clang-format committed
58
    source_data8_ = reinterpret_cast<uint8_t *>(
59
        vpx_memalign(kDataAlignment, kDataBlockSize));
clang-format's avatar
clang-format committed
60
    reference_data8_ = reinterpret_cast<uint8_t *>(
61
        vpx_memalign(kDataAlignment, kDataBufferSize));
clang-format's avatar
clang-format committed
62 63 64 65 66 67 68 69
    second_pred8_ =
        reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
    source_data16_ = reinterpret_cast<uint16_t *>(
        vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
    reference_data16_ = reinterpret_cast<uint16_t *>(
        vpx_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
    second_pred16_ = reinterpret_cast<uint16_t *>(
        vpx_memalign(kDataAlignment, 64 * 64 * sizeof(uint16_t)));
skal's avatar
skal committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

    if (params_.bit_depth == -1) {
      use_high_bit_depth_ = false;
      bit_depth_ = VPX_BITS_8;
      source_data_ = source_data8_;
      reference_data_ = reference_data8_;
      second_pred_ = second_pred8_;
#if CONFIG_VP9_HIGHBITDEPTH
    } else {
      use_high_bit_depth_ = true;
      bit_depth_ = static_cast<vpx_bit_depth_t>(params_.bit_depth);
      source_data_ = CONVERT_TO_BYTEPTR(source_data16_);
      reference_data_ = CONVERT_TO_BYTEPTR(reference_data16_);
      second_pred_ = CONVERT_TO_BYTEPTR(second_pred16_);
#endif  // CONFIG_VP9_HIGHBITDEPTH
    }
    mask_ = (1 << bit_depth_) - 1;
    source_stride_ = (params_.width + 31) & ~31;
    reference_stride_ = params_.width * 2;
    rnd_.Reset(ACMRandom::DeterministicSeed());
90 91
  }

skal's avatar
skal committed
92
  virtual void TearDown() {
93 94 95 96 97 98 99 100 101 102 103 104
    vpx_free(source_data8_);
    source_data8_ = NULL;
    vpx_free(reference_data8_);
    reference_data8_ = NULL;
    vpx_free(second_pred8_);
    second_pred8_ = NULL;
    vpx_free(source_data16_);
    source_data16_ = NULL;
    vpx_free(reference_data16_);
    reference_data16_ = NULL;
    vpx_free(second_pred16_);
    second_pred16_ = NULL;
105

106 107 108
    libvpx_test::ClearSystemState();
  }

109
 protected:
110
  // Handle blocks up to 4 blocks 64x64 with stride up to 128
111
  static const int kDataAlignment = 16;
112 113
  static const int kDataBlockSize = 64 * 128;
  static const int kDataBufferSize = 4 * kDataBlockSize;
114

115
  uint8_t *GetReference(int block_idx) const {
116
#if CONFIG_VP9_HIGHBITDEPTH
117
    if (use_high_bit_depth_) {
118 119
      return CONVERT_TO_BYTEPTR(CONVERT_TO_SHORTPTR(reference_data_) +
                                block_idx * kDataBlockSize);
120
    }
Johann's avatar
Johann committed
121
#endif  // CONFIG_VP9_HIGHBITDEPTH
122
    return reference_data_ + block_idx * kDataBlockSize;
Johann's avatar
Johann committed
123 124 125 126
  }

  // Sum of Absolute Differences. Given two blocks, calculate the absolute
  // difference between two pixels in the same relative location; accumulate.
127
  uint32_t ReferenceSAD(int block_idx) const {
skal's avatar
skal committed
128 129 130
    uint32_t sad = 0;
    const uint8_t *const reference8 = GetReference(block_idx);
    const uint8_t *const source8 = source_data_;
Johann's avatar
Johann committed
131
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
132 133 134
    const uint16_t *const reference16 =
        CONVERT_TO_SHORTPTR(GetReference(block_idx));
    const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
Johann's avatar
Johann committed
135
#endif  // CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
136 137
    for (int h = 0; h < params_.height; ++h) {
      for (int w = 0; w < params_.width; ++w) {
138
        if (!use_high_bit_depth_) {
Johann's avatar
Johann committed
139 140 141
          sad += abs(source8[h * source_stride_ + w] -
                     reference8[h * reference_stride_ + w]);
#if CONFIG_VP9_HIGHBITDEPTH
142
        } else {
Johann's avatar
Johann committed
143 144 145
          sad += abs(source16[h * source_stride_ + w] -
                     reference16[h * reference_stride_ + w]);
#endif  // CONFIG_VP9_HIGHBITDEPTH
146 147 148 149 150
        }
      }
    }
    return sad;
  }
Johann's avatar
Johann committed
151

152 153 154
  // Sum of Absolute Differences Average. Given two blocks, and a prediction
  // calculate the absolute difference between one pixel and average of the
  // corresponding and predicted pixels; accumulate.
155
  unsigned int ReferenceSADavg(int block_idx) const {
156
    unsigned int sad = 0;
Johann's avatar
Johann committed
157 158 159
    const uint8_t *const reference8 = GetReference(block_idx);
    const uint8_t *const source8 = source_data_;
    const uint8_t *const second_pred8 = second_pred_;
160
#if CONFIG_VP9_HIGHBITDEPTH
Johann's avatar
Johann committed
161 162 163 164 165
    const uint16_t *const reference16 =
        CONVERT_TO_SHORTPTR(GetReference(block_idx));
    const uint16_t *const source16 = CONVERT_TO_SHORTPTR(source_data_);
    const uint16_t *const second_pred16 = CONVERT_TO_SHORTPTR(second_pred_);
#endif  // CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
166 167
    for (int h = 0; h < params_.height; ++h) {
      for (int w = 0; w < params_.width; ++w) {
168
        if (!use_high_bit_depth_) {
skal's avatar
skal committed
169
          const int tmp = second_pred8[h * params_.width + w] +
clang-format's avatar
clang-format committed
170
                          reference8[h * reference_stride_ + w];
171 172
          const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
          sad += abs(source8[h * source_stride_ + w] - comp_pred);
Johann's avatar
Johann committed
173
#if CONFIG_VP9_HIGHBITDEPTH
174
        } else {
skal's avatar
skal committed
175
          const int tmp = second_pred16[h * params_.width + w] +
clang-format's avatar
clang-format committed
176
                          reference16[h * reference_stride_ + w];
177 178
          const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
          sad += abs(source16[h * source_stride_ + w] - comp_pred);
Johann's avatar
Johann committed
179
#endif  // CONFIG_VP9_HIGHBITDEPTH
180
        }
181
      }
Johann's avatar
Johann committed
182 183 184 185
    }
    return sad;
  }

186
  void FillConstant(uint8_t *data, int stride, uint16_t fill_constant) const {
187
    uint8_t *data8 = data;
Johann's avatar
Johann committed
188
#if CONFIG_VP9_HIGHBITDEPTH
189
    uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
Johann's avatar
Johann committed
190
#endif  // CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
191 192
    for (int h = 0; h < params_.height; ++h) {
      for (int w = 0; w < params_.width; ++w) {
193
        if (!use_high_bit_depth_) {
194
          data8[h * stride + w] = static_cast<uint8_t>(fill_constant);
Johann's avatar
Johann committed
195
#if CONFIG_VP9_HIGHBITDEPTH
196 197
        } else {
          data16[h * stride + w] = fill_constant;
Johann's avatar
Johann committed
198
#endif  // CONFIG_VP9_HIGHBITDEPTH
199
        }
Johann's avatar
Johann committed
200 201 202 203 204
      }
    }
  }

  void FillRandom(uint8_t *data, int stride) {
205
    uint8_t *data8 = data;
Johann's avatar
Johann committed
206
#if CONFIG_VP9_HIGHBITDEPTH
207
    uint16_t *data16 = CONVERT_TO_SHORTPTR(data);
Johann's avatar
Johann committed
208
#endif  // CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
209 210
    for (int h = 0; h < params_.height; ++h) {
      for (int w = 0; w < params_.width; ++w) {
211 212
        if (!use_high_bit_depth_) {
          data8[h * stride + w] = rnd_.Rand8();
Johann's avatar
Johann committed
213
#if CONFIG_VP9_HIGHBITDEPTH
214 215
        } else {
          data16[h * stride + w] = rnd_.Rand16() & mask_;
Johann's avatar
Johann committed
216
#endif  // CONFIG_VP9_HIGHBITDEPTH
217
        }
Johann's avatar
Johann committed
218 219 220 221
      }
    }
  }

skal's avatar
skal committed
222
  uint32_t mask_;
223
  vpx_bit_depth_t bit_depth_;
224 225
  int source_stride_;
  int reference_stride_;
skal's avatar
skal committed
226 227 228 229 230 231 232 233 234 235 236
  bool use_high_bit_depth_;

  uint8_t *source_data_;
  uint8_t *reference_data_;
  uint8_t *second_pred_;
  uint8_t *source_data8_;
  uint8_t *reference_data8_;
  uint8_t *second_pred8_;
  uint16_t *source_data16_;
  uint16_t *reference_data16_;
  uint16_t *second_pred16_;
237 238

  ACMRandom rnd_;
skal's avatar
skal committed
239
  ParamType params_;
240 241
};

skal's avatar
skal committed
242
class SADx4Test : public SADTestBase<SadMxNx4Param> {
243
 public:
skal's avatar
skal committed
244
  SADx4Test() : SADTestBase(GetParam()) {}
245 246

 protected:
247 248 249
  void SADs(unsigned int *results) const {
    const uint8_t *references[] = { GetReference(0), GetReference(1),
                                    GetReference(2), GetReference(3) };
250

clang-format's avatar
clang-format committed
251 252
    ASM_REGISTER_STATE_CHECK(params_.func(
        source_data_, source_stride_, references, reference_stride_, results));
253 254
  }

255
  void CheckSADs() const {
skal's avatar
skal committed
256
    uint32_t reference_sad, exp_sad[4];
257 258 259

    SADs(exp_sad);
    for (int block = 0; block < 4; ++block) {
Johann's avatar
Johann committed
260
      reference_sad = ReferenceSAD(block);
261 262 263 264 265 266

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

skal's avatar
skal committed
267
class SADTest : public SADTestBase<SadMxNParam> {
268
 public:
skal's avatar
skal committed
269
  SADTest() : SADTestBase(GetParam()) {}
270 271

 protected:
272
  unsigned int SAD(int block_idx) const {
273
    unsigned int ret;
274
    const uint8_t *const reference = GetReference(block_idx);
275

skal's avatar
skal committed
276
    ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
277
                                                reference, reference_stride_));
278
    return ret;
279 280
  }

281
  void CheckSAD() const {
Johann's avatar
Johann committed
282
    const unsigned int reference_sad = ReferenceSAD(0);
283
    const unsigned int exp_sad = SAD(0);
284

285
    ASSERT_EQ(reference_sad, exp_sad);
286
  }
Johann's avatar
Johann committed
287
};
288

skal's avatar
skal committed
289
class SADavgTest : public SADTestBase<SadMxNAvgParam> {
290
 public:
skal's avatar
skal committed
291
  SADavgTest() : SADTestBase(GetParam()) {}
292 293

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

skal's avatar
skal committed
298
    ASM_REGISTER_STATE_CHECK(ret = params_.func(source_data_, source_stride_,
299 300 301 302 303
                                                reference, reference_stride_,
                                                second_pred_));
    return ret;
  }

304
  void CheckSAD() const {
Johann's avatar
Johann committed
305
    const unsigned int reference_sad = ReferenceSADavg(0);
306 307 308 309 310
    const unsigned int exp_sad = SAD_avg(0);

    ASSERT_EQ(reference_sad, exp_sad);
  }
};
Johann's avatar
Johann committed
311 312

TEST_P(SADTest, MaxRef) {
313
  FillConstant(source_data_, source_stride_, 0);
314
  FillConstant(reference_data_, reference_stride_, mask_);
315 316 317
  CheckSAD();
}

Johann's avatar
Johann committed
318
TEST_P(SADTest, MaxSrc) {
319
  FillConstant(source_data_, source_stride_, mask_);
320 321
  FillConstant(reference_data_, reference_stride_, 0);
  CheckSAD();
Johann's avatar
Johann committed
322 323
}

Johann's avatar
Johann committed
324
TEST_P(SADTest, ShortRef) {
325 326 327 328 329 330 331 332
  const int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

Johann's avatar
Johann committed
333
TEST_P(SADTest, UnalignedRef) {
334 335 336 337 338 339 340 341 342 343
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  const int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

Johann's avatar
Johann committed
344
TEST_P(SADTest, ShortSrc) {
345 346 347 348 349 350 351
  const int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  source_stride_ = tmp_stride;
}
352

Johann's avatar
Johann committed
353
TEST_P(SADavgTest, MaxRef) {
354 355
  FillConstant(source_data_, source_stride_, 0);
  FillConstant(reference_data_, reference_stride_, mask_);
skal's avatar
skal committed
356
  FillConstant(second_pred_, params_.width, 0);
357 358
  CheckSAD();
}
Johann's avatar
Johann committed
359
TEST_P(SADavgTest, MaxSrc) {
360 361
  FillConstant(source_data_, source_stride_, mask_);
  FillConstant(reference_data_, reference_stride_, 0);
skal's avatar
skal committed
362
  FillConstant(second_pred_, params_.width, 0);
363 364 365
  CheckSAD();
}

Johann's avatar
Johann committed
366
TEST_P(SADavgTest, ShortRef) {
367 368 369 370
  const int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
skal's avatar
skal committed
371
  FillRandom(second_pred_, params_.width);
372 373 374 375
  CheckSAD();
  reference_stride_ = tmp_stride;
}

Johann's avatar
Johann committed
376
TEST_P(SADavgTest, UnalignedRef) {
377 378 379 380 381 382
  // The reference frame, but not the source frame, may be unaligned for
  // certain types of searches.
  const int tmp_stride = reference_stride_;
  reference_stride_ -= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
skal's avatar
skal committed
383
  FillRandom(second_pred_, params_.width);
384 385 386 387
  CheckSAD();
  reference_stride_ = tmp_stride;
}

Johann's avatar
Johann committed
388
TEST_P(SADavgTest, ShortSrc) {
389 390 391 392
  const int tmp_stride = source_stride_;
  source_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
skal's avatar
skal committed
393
  FillRandom(second_pred_, params_.width);
394 395 396
  CheckSAD();
  source_stride_ = tmp_stride;
}
397

398 399
TEST_P(SADx4Test, MaxRef) {
  FillConstant(source_data_, source_stride_, 0);
400 401 402 403
  FillConstant(GetReference(0), reference_stride_, mask_);
  FillConstant(GetReference(1), reference_stride_, mask_);
  FillConstant(GetReference(2), reference_stride_, mask_);
  FillConstant(GetReference(3), reference_stride_, mask_);
404 405 406 407
  CheckSADs();
}

TEST_P(SADx4Test, MaxSrc) {
408
  FillConstant(source_data_, source_stride_, mask_);
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 448 449 450 451 452 453
  FillConstant(GetReference(0), reference_stride_, 0);
  FillConstant(GetReference(1), reference_stride_, 0);
  FillConstant(GetReference(2), reference_stride_, 0);
  FillConstant(GetReference(3), reference_stride_, 0);
  CheckSADs();
}

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

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

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

454
TEST_P(SADx4Test, SrcAlignedByWidth) {
clang-format's avatar
clang-format committed
455
  uint8_t *tmp_source_data = source_data_;
skal's avatar
skal committed
456
  source_data_ += params_.width;
457 458 459 460 461 462 463 464 465
  FillRandom(source_data_, source_stride_);
  FillRandom(GetReference(0), reference_stride_);
  FillRandom(GetReference(1), reference_stride_);
  FillRandom(GetReference(2), reference_stride_);
  FillRandom(GetReference(3), reference_stride_);
  CheckSADs();
  source_data_ = tmp_source_data;
}

466 467
//------------------------------------------------------------------------------
// C functions
468
const SadMxNParam c_tests[] = {
skal's avatar
skal committed
469 470 471 472 473 474 475 476 477 478 479 480 481
  SadMxNParam(64, 64, &vpx_sad64x64_c),
  SadMxNParam(64, 32, &vpx_sad64x32_c),
  SadMxNParam(32, 64, &vpx_sad32x64_c),
  SadMxNParam(32, 32, &vpx_sad32x32_c),
  SadMxNParam(32, 16, &vpx_sad32x16_c),
  SadMxNParam(16, 32, &vpx_sad16x32_c),
  SadMxNParam(16, 16, &vpx_sad16x16_c),
  SadMxNParam(16, 8, &vpx_sad16x8_c),
  SadMxNParam(8, 16, &vpx_sad8x16_c),
  SadMxNParam(8, 8, &vpx_sad8x8_c),
  SadMxNParam(8, 4, &vpx_sad8x4_c),
  SadMxNParam(4, 8, &vpx_sad4x8_c),
  SadMxNParam(4, 4, &vpx_sad4x4_c),
Johann's avatar
Johann committed
482
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 8),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 8),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 8),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 8),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 8),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 8),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 8),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 8),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 8),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 8),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 8),
  SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 8),
  SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 8),
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 10),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 10),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 10),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 10),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 10),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 10),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 10),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 10),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 10),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 10),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 10),
  SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 10),
  SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 10),
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_c, 12),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_c, 12),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_c, 12),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_c, 12),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_c, 12),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_c, 12),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_c, 12),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_c, 12),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_c, 12),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_c, 12),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_c, 12),
  SadMxNParam(4, 8, &vpx_highbd_sad4x8_c, 12),
  SadMxNParam(4, 4, &vpx_highbd_sad4x4_c, 12),
Johann's avatar
Johann committed
522
#endif  // CONFIG_VP9_HIGHBITDEPTH
523 524
};
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::ValuesIn(c_tests));
525

Johann's avatar
Johann committed
526
const SadMxNAvgParam avg_c_tests[] = {
skal's avatar
skal committed
527 528 529 530 531 532 533 534 535 536 537 538 539
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_c),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_c),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_c),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_c),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_c),
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_c),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_c),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_c),
  SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_c),
  SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_c),
  SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_c),
  SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_c),
  SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_c),
Johann's avatar
Johann committed
540
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 8),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 8),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 8),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 8),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 8),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 8),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 8),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 8),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 8),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 8),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 8),
  SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 8),
  SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 8),
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 10),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 10),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 10),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 10),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 10),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 10),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 10),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 10),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 10),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 10),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 10),
  SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 10),
  SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 10),
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_c, 12),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_c, 12),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_c, 12),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_c, 12),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_c, 12),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_c, 12),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_c, 12),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_c, 12),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_c, 12),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_c, 12),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_c, 12),
  SadMxNAvgParam(4, 8, &vpx_highbd_sad4x8_avg_c, 12),
  SadMxNAvgParam(4, 4, &vpx_highbd_sad4x4_avg_c, 12),
Johann's avatar
Johann committed
580
#endif  // CONFIG_VP9_HIGHBITDEPTH
581
};
Johann's avatar
Johann committed
582 583 584
INSTANTIATE_TEST_CASE_P(C, SADavgTest, ::testing::ValuesIn(avg_c_tests));

const SadMxNx4Param x4d_c_tests[] = {
skal's avatar
skal committed
585 586 587 588 589 590 591 592 593 594 595 596 597
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_c),
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_c),
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_c),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_c),
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_c),
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_c),
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_c),
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_c),
  SadMxNx4Param(8, 16, &vpx_sad8x16x4d_c),
  SadMxNx4Param(8, 8, &vpx_sad8x8x4d_c),
  SadMxNx4Param(8, 4, &vpx_sad8x4x4d_c),
  SadMxNx4Param(4, 8, &vpx_sad4x8x4d_c),
  SadMxNx4Param(4, 4, &vpx_sad4x4x4d_c),
Johann's avatar
Johann committed
598
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 8),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 8),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 8),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 8),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 8),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 8),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 8),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 8),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 8),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 8),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 8),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 8),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 8),
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 10),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 10),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 10),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 10),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 10),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 10),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 10),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 10),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 10),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 10),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 10),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 10),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 10),
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_c, 12),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_c, 12),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_c, 12),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_c, 12),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_c, 12),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_c, 12),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_c, 12),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_c, 12),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_c, 12),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_c, 12),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_c, 12),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_c, 12),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_c, 12),
638
#endif  // CONFIG_VP9_HIGHBITDEPTH
Johann's avatar
Johann committed
639 640
};
INSTANTIATE_TEST_CASE_P(C, SADx4Test, ::testing::ValuesIn(x4d_c_tests));
641

642 643
//------------------------------------------------------------------------------
// ARM functions
Johann's avatar
Johann committed
644
#if HAVE_NEON
Johann's avatar
Johann committed
645
const SadMxNParam neon_tests[] = {
skal's avatar
skal committed
646
  SadMxNParam(64, 64, &vpx_sad64x64_neon),
647
  SadMxNParam(64, 32, &vpx_sad64x32_neon),
skal's avatar
skal committed
648
  SadMxNParam(32, 32, &vpx_sad32x32_neon),
649
  SadMxNParam(16, 32, &vpx_sad16x32_neon),
skal's avatar
skal committed
650 651 652 653
  SadMxNParam(16, 16, &vpx_sad16x16_neon),
  SadMxNParam(16, 8, &vpx_sad16x8_neon),
  SadMxNParam(8, 16, &vpx_sad8x16_neon),
  SadMxNParam(8, 8, &vpx_sad8x8_neon),
Johann's avatar
Johann committed
654
  SadMxNParam(8, 4, &vpx_sad8x4_neon),
655
  SadMxNParam(4, 8, &vpx_sad4x8_neon),
skal's avatar
skal committed
656
  SadMxNParam(4, 4, &vpx_sad4x4_neon),
Johann's avatar
Johann committed
657 658 659
};
INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::ValuesIn(neon_tests));

Johann's avatar
Johann committed
660
const SadMxNAvgParam avg_neon_tests[] = {
Johann's avatar
Johann committed
661 662
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_neon),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_neon),
Johann's avatar
Johann committed
663 664 665
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_neon),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_neon),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_neon),
Johann's avatar
Johann committed
666 667 668
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_neon),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_neon),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_neon),
Johann's avatar
Johann committed
669 670 671
  SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_neon),
  SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_neon),
  SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_neon),
Johann's avatar
Johann committed
672 673 674 675 676
  SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_neon),
  SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_neon),
};
INSTANTIATE_TEST_CASE_P(NEON, SADavgTest, ::testing::ValuesIn(avg_neon_tests));

Johann's avatar
Johann committed
677
const SadMxNx4Param x4d_neon_tests[] = {
skal's avatar
skal committed
678
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_neon),
Johann's avatar
Johann committed
679
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_neon),
Johann's avatar
Johann committed
680
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_neon),
skal's avatar
skal committed
681
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_neon),
Johann's avatar
Johann committed
682
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_neon),
Johann's avatar
Johann committed
683
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_neon),
skal's avatar
skal committed
684
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_neon),
Johann's avatar
Johann committed
685
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_neon),
Johann's avatar
Johann committed
686 687 688
  SadMxNx4Param(8, 16, &vpx_sad8x16x4d_neon),
  SadMxNx4Param(8, 8, &vpx_sad8x8x4d_neon),
  SadMxNx4Param(8, 4, &vpx_sad8x4x4d_neon),
Johann's avatar
Johann committed
689 690
  SadMxNx4Param(4, 8, &vpx_sad4x8x4d_neon),
  SadMxNx4Param(4, 4, &vpx_sad4x4x4d_neon),
691
};
Johann's avatar
Johann committed
692
INSTANTIATE_TEST_CASE_P(NEON, SADx4Test, ::testing::ValuesIn(x4d_neon_tests));
693
#endif  // HAVE_NEON
Johann's avatar
Johann committed
694

695 696
//------------------------------------------------------------------------------
// x86 functions
Johann's avatar
Johann committed
697
#if HAVE_SSE2
698
const SadMxNParam sse2_tests[] = {
skal's avatar
skal committed
699 700 701 702 703 704 705 706 707 708 709 710 711
  SadMxNParam(64, 64, &vpx_sad64x64_sse2),
  SadMxNParam(64, 32, &vpx_sad64x32_sse2),
  SadMxNParam(32, 64, &vpx_sad32x64_sse2),
  SadMxNParam(32, 32, &vpx_sad32x32_sse2),
  SadMxNParam(32, 16, &vpx_sad32x16_sse2),
  SadMxNParam(16, 32, &vpx_sad16x32_sse2),
  SadMxNParam(16, 16, &vpx_sad16x16_sse2),
  SadMxNParam(16, 8, &vpx_sad16x8_sse2),
  SadMxNParam(8, 16, &vpx_sad8x16_sse2),
  SadMxNParam(8, 8, &vpx_sad8x8_sse2),
  SadMxNParam(8, 4, &vpx_sad8x4_sse2),
  SadMxNParam(4, 8, &vpx_sad4x8_sse2),
  SadMxNParam(4, 4, &vpx_sad4x4_sse2),
Johann's avatar
Johann committed
712
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 8),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 8),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 8),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 8),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 8),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 8),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 8),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 8),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 8),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 8),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 8),
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 10),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 10),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 10),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 10),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 10),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 10),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 10),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 10),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 10),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 10),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 10),
  SadMxNParam(64, 64, &vpx_highbd_sad64x64_sse2, 12),
  SadMxNParam(64, 32, &vpx_highbd_sad64x32_sse2, 12),
  SadMxNParam(32, 64, &vpx_highbd_sad32x64_sse2, 12),
  SadMxNParam(32, 32, &vpx_highbd_sad32x32_sse2, 12),
  SadMxNParam(32, 16, &vpx_highbd_sad32x16_sse2, 12),
  SadMxNParam(16, 32, &vpx_highbd_sad16x32_sse2, 12),
  SadMxNParam(16, 16, &vpx_highbd_sad16x16_sse2, 12),
  SadMxNParam(16, 8, &vpx_highbd_sad16x8_sse2, 12),
  SadMxNParam(8, 16, &vpx_highbd_sad8x16_sse2, 12),
  SadMxNParam(8, 8, &vpx_highbd_sad8x8_sse2, 12),
  SadMxNParam(8, 4, &vpx_highbd_sad8x4_sse2, 12),
Johann's avatar
Johann committed
746
#endif  // CONFIG_VP9_HIGHBITDEPTH
747 748
};
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::ValuesIn(sse2_tests));
749

Johann's avatar
Johann committed
750
const SadMxNAvgParam avg_sse2_tests[] = {
skal's avatar
skal committed
751 752 753 754 755 756 757 758 759 760 761 762 763
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_sse2),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_sse2),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_sse2),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_sse2),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_sse2),
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_sse2),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_sse2),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_sse2),
  SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_sse2),
  SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_sse2),
  SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_sse2),
  SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_sse2),
  SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_sse2),
Johann's avatar
Johann committed
764
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 8),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 8),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 8),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 8),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 8),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 8),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 8),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 8),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 8),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 8),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 8),
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 10),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 10),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 10),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 10),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 10),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 10),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 10),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 10),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 10),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 10),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 10),
  SadMxNAvgParam(64, 64, &vpx_highbd_sad64x64_avg_sse2, 12),
  SadMxNAvgParam(64, 32, &vpx_highbd_sad64x32_avg_sse2, 12),
  SadMxNAvgParam(32, 64, &vpx_highbd_sad32x64_avg_sse2, 12),
  SadMxNAvgParam(32, 32, &vpx_highbd_sad32x32_avg_sse2, 12),
  SadMxNAvgParam(32, 16, &vpx_highbd_sad32x16_avg_sse2, 12),
  SadMxNAvgParam(16, 32, &vpx_highbd_sad16x32_avg_sse2, 12),
  SadMxNAvgParam(16, 16, &vpx_highbd_sad16x16_avg_sse2, 12),
  SadMxNAvgParam(16, 8, &vpx_highbd_sad16x8_avg_sse2, 12),
  SadMxNAvgParam(8, 16, &vpx_highbd_sad8x16_avg_sse2, 12),
  SadMxNAvgParam(8, 8, &vpx_highbd_sad8x8_avg_sse2, 12),
  SadMxNAvgParam(8, 4, &vpx_highbd_sad8x4_avg_sse2, 12),
Johann's avatar
Johann committed
798 799 800 801 802
#endif  // CONFIG_VP9_HIGHBITDEPTH
};
INSTANTIATE_TEST_CASE_P(SSE2, SADavgTest, ::testing::ValuesIn(avg_sse2_tests));

const SadMxNx4Param x4d_sse2_tests[] = {
skal's avatar
skal committed
803 804 805 806 807 808 809 810 811 812 813 814 815
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_sse2),
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_sse2),
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_sse2),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_sse2),
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_sse2),
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_sse2),
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_sse2),
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_sse2),
  SadMxNx4Param(8, 16, &vpx_sad8x16x4d_sse2),
  SadMxNx4Param(8, 8, &vpx_sad8x8x4d_sse2),
  SadMxNx4Param(8, 4, &vpx_sad8x4x4d_sse2),
  SadMxNx4Param(4, 8, &vpx_sad4x8x4d_sse2),
  SadMxNx4Param(4, 4, &vpx_sad4x4x4d_sse2),
816
#if CONFIG_VP9_HIGHBITDEPTH
skal's avatar
skal committed
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 8),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 8),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 8),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 8),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 8),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 8),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 8),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 8),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 8),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 8),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 8),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 8),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 8),
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 10),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 10),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 10),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 10),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 10),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 10),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 10),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 10),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 10),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 10),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 10),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 10),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 10),
  SadMxNx4Param(64, 64, &vpx_highbd_sad64x64x4d_sse2, 12),
  SadMxNx4Param(64, 32, &vpx_highbd_sad64x32x4d_sse2, 12),
  SadMxNx4Param(32, 64, &vpx_highbd_sad32x64x4d_sse2, 12),
  SadMxNx4Param(32, 32, &vpx_highbd_sad32x32x4d_sse2, 12),
  SadMxNx4Param(32, 16, &vpx_highbd_sad32x16x4d_sse2, 12),
  SadMxNx4Param(16, 32, &vpx_highbd_sad16x32x4d_sse2, 12),
  SadMxNx4Param(16, 16, &vpx_highbd_sad16x16x4d_sse2, 12),
  SadMxNx4Param(16, 8, &vpx_highbd_sad16x8x4d_sse2, 12),
  SadMxNx4Param(8, 16, &vpx_highbd_sad8x16x4d_sse2, 12),
  SadMxNx4Param(8, 8, &vpx_highbd_sad8x8x4d_sse2, 12),
  SadMxNx4Param(8, 4, &vpx_highbd_sad8x4x4d_sse2, 12),
  SadMxNx4Param(4, 8, &vpx_highbd_sad4x8x4d_sse2, 12),
  SadMxNx4Param(4, 4, &vpx_highbd_sad4x4x4d_sse2, 12),
856
#endif  // CONFIG_VP9_HIGHBITDEPTH
Johann's avatar
Johann committed
857 858
};
INSTANTIATE_TEST_CASE_P(SSE2, SADx4Test, ::testing::ValuesIn(x4d_sse2_tests));
859
#endif  // HAVE_SSE2
860 861

#if HAVE_SSE3
Johann's avatar
Johann committed
862
// Only functions are x3, which do not have tests.
863
#endif  // HAVE_SSE3
864

Johann's avatar
Johann committed
865
#if HAVE_SSSE3
Johann's avatar
Johann committed
866
// Only functions are x3, which do not have tests.
867
#endif  // HAVE_SSSE3
Johann's avatar
Johann committed
868

Johann's avatar
Johann committed
869 870 871 872
#if HAVE_SSE4_1
// Only functions are x8, which do not have tests.
#endif  // HAVE_SSE4_1

873
#if HAVE_AVX2
Johann's avatar
Johann committed
874
const SadMxNParam avx2_tests[] = {
skal's avatar
skal committed
875 876 877 878 879
  SadMxNParam(64, 64, &vpx_sad64x64_avx2),
  SadMxNParam(64, 32, &vpx_sad64x32_avx2),
  SadMxNParam(32, 64, &vpx_sad32x64_avx2),
  SadMxNParam(32, 32, &vpx_sad32x32_avx2),
  SadMxNParam(32, 16, &vpx_sad32x16_avx2),
Johann's avatar
Johann committed
880 881 882 883
};
INSTANTIATE_TEST_CASE_P(AVX2, SADTest, ::testing::ValuesIn(avx2_tests));

const SadMxNAvgParam avg_avx2_tests[] = {
skal's avatar
skal committed
884 885 886 887 888
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_avx2),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_avx2),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_avx2),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_avx2),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_avx2),
Johann's avatar
Johann committed
889 890
};
INSTANTIATE_TEST_CASE_P(AVX2, SADavgTest, ::testing::ValuesIn(avg_avx2_tests));
891

Johann's avatar
Johann committed
892
const SadMxNx4Param x4d_avx2_tests[] = {
skal's avatar
skal committed
893 894
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx2),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_avx2),
Johann's avatar
Johann committed
895 896 897
};
INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::ValuesIn(x4d_avx2_tests));
#endif  // HAVE_AVX2
898

899 900 901 902 903 904 905 906
#if HAVE_AVX512
const SadMxNx4Param x4d_avx512_tests[] = {
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_avx512),
};
INSTANTIATE_TEST_CASE_P(AVX512, SADx4Test,
                        ::testing::ValuesIn(x4d_avx512_tests));
#endif  // HAVE_AVX512

907 908 909 910
//------------------------------------------------------------------------------
// MIPS functions
#if HAVE_MSA
const SadMxNParam msa_tests[] = {
skal's avatar
skal committed
911 912 913 914 915 916 917 918 919 920 921 922 923
  SadMxNParam(64, 64, &vpx_sad64x64_msa),
  SadMxNParam(64, 32, &vpx_sad64x32_msa),
  SadMxNParam(32, 64, &vpx_sad32x64_msa),
  SadMxNParam(32, 32, &vpx_sad32x32_msa),
  SadMxNParam(32, 16, &vpx_sad32x16_msa),
  SadMxNParam(16, 32, &vpx_sad16x32_msa),
  SadMxNParam(16, 16, &vpx_sad16x16_msa),
  SadMxNParam(16, 8, &vpx_sad16x8_msa),
  SadMxNParam(8, 16, &vpx_sad8x16_msa),
  SadMxNParam(8, 8, &vpx_sad8x8_msa),
  SadMxNParam(8, 4, &vpx_sad8x4_msa),
  SadMxNParam(4, 8, &vpx_sad4x8_msa),
  SadMxNParam(4, 4, &vpx_sad4x4_msa),
924 925 926 927
};
INSTANTIATE_TEST_CASE_P(MSA, SADTest, ::testing::ValuesIn(msa_tests));

const SadMxNAvgParam avg_msa_tests[] = {
skal's avatar
skal committed
928 929 930 931 932 933 934 935 936 937 938 939 940
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_msa),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_msa),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_msa),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_msa),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_msa),
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_msa),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_msa),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_msa),
  SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_msa),
  SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_msa),
  SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_msa),
  SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_msa),
  SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_msa),
941 942 943 944
};
INSTANTIATE_TEST_CASE_P(MSA, SADavgTest, ::testing::ValuesIn(avg_msa_tests));

const SadMxNx4Param x4d_msa_tests[] = {
skal's avatar
skal committed
945 946 947 948 949 950 951 952 953 954 955 956 957
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_msa),
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_msa),
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_msa),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_msa),
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_msa),
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_msa),
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_msa),
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_msa),
  SadMxNx4Param(8, 16, &vpx_sad8x16x4d_msa),
  SadMxNx4Param(8, 8, &vpx_sad8x8x4d_msa),
  SadMxNx4Param(8, 4, &vpx_sad8x4x4d_msa),
  SadMxNx4Param(4, 8, &vpx_sad4x8x4d_msa),
  SadMxNx4Param(4, 4, &vpx_sad4x4x4d_msa),
958 959 960 961
};
INSTANTIATE_TEST_CASE_P(MSA, SADx4Test, ::testing::ValuesIn(x4d_msa_tests));
#endif  // HAVE_MSA

962 963 964 965
//------------------------------------------------------------------------------
// VSX functions
#if HAVE_VSX
const SadMxNParam vsx_tests[] = {
966 967
  SadMxNParam(64, 64, &vpx_sad64x64_vsx),
  SadMxNParam(64, 32, &vpx_sad64x32_vsx),
968 969 970
  SadMxNParam(32, 64, &vpx_sad32x64_vsx),
  SadMxNParam(32, 32, &vpx_sad32x32_vsx),
  SadMxNParam(32, 16, &vpx_sad32x16_vsx),
971
  SadMxNParam(16, 32, &vpx_sad16x32_vsx),
972 973
  SadMxNParam(16, 16, &vpx_sad16x16_vsx),
  SadMxNParam(16, 8, &vpx_sad16x8_vsx),
974 975
};
INSTANTIATE_TEST_CASE_P(VSX, SADTest, ::testing::ValuesIn(vsx_tests));
976 977 978 979 980 981 982 983 984 985 986 987

const SadMxNAvgParam avg_vsx_tests[] = {
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_vsx),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_vsx),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_vsx),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_vsx),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_vsx),
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_vsx),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_vsx),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADavgTest, ::testing::ValuesIn(avg_vsx_tests));
988 989 990 991 992 993 994 995 996 997 998 999

const SadMxNx4Param x4d_vsx_tests[] = {
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_vsx),
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_vsx),
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_vsx),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_vsx),
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_vsx),
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_vsx),
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_vsx),
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_vsx),
};
INSTANTIATE_TEST_CASE_P(VSX, SADx4Test, ::testing::ValuesIn(x4d_vsx_tests));
1000
#endif  // HAVE_VSX
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055

//------------------------------------------------------------------------------
// Loongson functions
#if HAVE_MMI
const SadMxNParam mmi_tests[] = {
  SadMxNParam(64, 64, &vpx_sad64x64_mmi),
  SadMxNParam(64, 32, &vpx_sad64x32_mmi),
  SadMxNParam(32, 64, &vpx_sad32x64_mmi),
  SadMxNParam(32, 32, &vpx_sad32x32_mmi),
  SadMxNParam(32, 16, &vpx_sad32x16_mmi),
  SadMxNParam(16, 32, &vpx_sad16x32_mmi),
  SadMxNParam(16, 16, &vpx_sad16x16_mmi),
  SadMxNParam(16, 8, &vpx_sad16x8_mmi),
  SadMxNParam(8, 16, &vpx_sad8x16_mmi),
  SadMxNParam(8, 8, &vpx_sad8x8_mmi),
  SadMxNParam(8, 4, &vpx_sad8x4_mmi),
  SadMxNParam(4, 8, &vpx_sad4x8_mmi),
  SadMxNParam(4, 4, &vpx_sad4x4_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADTest, ::testing::ValuesIn(mmi_tests));

const SadMxNAvgParam avg_mmi_tests[] = {
  SadMxNAvgParam(64, 64, &vpx_sad64x64_avg_mmi),
  SadMxNAvgParam(64, 32, &vpx_sad64x32_avg_mmi),
  SadMxNAvgParam(32, 64, &vpx_sad32x64_avg_mmi),
  SadMxNAvgParam(32, 32, &vpx_sad32x32_avg_mmi),
  SadMxNAvgParam(32, 16, &vpx_sad32x16_avg_mmi),
  SadMxNAvgParam(16, 32, &vpx_sad16x32_avg_mmi),
  SadMxNAvgParam(16, 16, &vpx_sad16x16_avg_mmi),
  SadMxNAvgParam(16, 8, &vpx_sad16x8_avg_mmi),
  SadMxNAvgParam(8, 16, &vpx_sad8x16_avg_mmi),
  SadMxNAvgParam(8, 8, &vpx_sad8x8_avg_mmi),
  SadMxNAvgParam(8, 4, &vpx_sad8x4_avg_mmi),
  SadMxNAvgParam(4, 8, &vpx_sad4x8_avg_mmi),
  SadMxNAvgParam(4, 4, &vpx_sad4x4_avg_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADavgTest, ::testing::ValuesIn(avg_mmi_tests));

const SadMxNx4Param x4d_mmi_tests[] = {
  SadMxNx4Param(64, 64, &vpx_sad64x64x4d_mmi),
  SadMxNx4Param(64, 32, &vpx_sad64x32x4d_mmi),
  SadMxNx4Param(32, 64, &vpx_sad32x64x4d_mmi),
  SadMxNx4Param(32, 32, &vpx_sad32x32x4d_mmi),
  SadMxNx4Param(32, 16, &vpx_sad32x16x4d_mmi),
  SadMxNx4Param(16, 32, &vpx_sad16x32x4d_mmi),
  SadMxNx4Param(16, 16, &vpx_sad16x16x4d_mmi),
  SadMxNx4Param(16, 8, &vpx_sad16x8x4d_mmi),
  SadMxNx4Param(8, 16, &vpx_sad8x16x4d_mmi),
  SadMxNx4Param(8, 8, &vpx_sad8x8x4d_mmi),
  SadMxNx4Param(8, 4, &vpx_sad8x4x4d_mmi),
  SadMxNx4Param(4, 8, &vpx_sad4x8x4d_mmi),
  SadMxNx4Param(4, 4, &vpx_sad4x4x4d_mmi),
};
INSTANTIATE_TEST_CASE_P(MMI, SADx4Test, ::testing::ValuesIn(x4d_mmi_tests));
#endif  // HAVE_MMI
Johann's avatar
Johann committed
1056
}  // namespace