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


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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  ACMRandom rnd_;
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

TEST_P(SADVP9Test, MaxSrc) {
490
  FillConstant(source_data_, source_stride_, mask_);
491
492
  FillConstant(reference_data_, reference_stride_, 0);
  CheckSAD();
Johann's avatar
Johann committed
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
522
TEST_P(SADVP9Test, ShortRef) {
  const int tmp_stride = reference_stride_;
  reference_stride_ >>= 1;
  FillRandom(source_data_, source_stride_);
  FillRandom(reference_data_, reference_stride_);
  CheckSAD();
  reference_stride_ = tmp_stride;
}

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

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

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

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

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

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

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

TEST_P(SADx4Test, MaxSrc) {
580
  FillConstant(source_data_, source_stride_, mask_);
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
612
613
614
615
616
617
618
619
620
621
622
623
624
625
  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;
}

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

James Zern's avatar
James Zern committed
638
639
using std::tr1::make_tuple;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#endif  // HAVE_MMX
936
937
938

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

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

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

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

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

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

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

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

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

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

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

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

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

Johann's avatar
Johann committed
1225
#if HAVE_SSSE3
Jim Bankoski's avatar
Jim Bankoski committed
1226
#if CONFIG_USE_X86INC
Yaowu Xu's avatar
Yaowu Xu committed
1227
#if CONFIG_VP8_ENCODER
1228
const SadMxNFunc sad_16x16_sse3 = vp8_sad16x16_sse3;
Johann's avatar
Johann committed
1229
INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
1230
                        make_tuple(16, 16, sad_16x16_sse3, -1)));
1231
1232
1233
#endif  // CONFIG_VP8_ENCODER
#endif  // CONFIG_USE_X86INC
#endif  // HAVE_SSSE3
Johann's avatar
Johann committed
1234

1235
1236
#if HAVE_AVX2
#if CONFIG_VP9_ENCODER
1237
1238
const SadMxNx4Func sad_64x64x4d_avx2 = vp9_sad64x64x4d_avx2;
const SadMxNx4Func sad_32x32x4d_avx2 = vp9_sad32x32x4d_avx2;
levytamar82's avatar
levytamar82 committed
1239
INSTANTIATE_TEST_CASE_P(AVX2, SADx4Test, ::testing::Values(
1240
1241
                        make_tuple(32, 32, sad_32x32x4d_avx2, -1),
                        make_tuple(64, 64, sad_64x64x4d_avx2, -1)));
1242
1243
1244
#endif  // CONFIG_VP9_ENCODER
#endif  // HAVE_AVX2

Johann's avatar
Johann committed
1245
}  // namespace