1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include <cstdlib>
12 #include <new>
13
14 #include "third_party/googletest/src/include/gtest/gtest.h"
15
16 #include "./vpx_config.h"
17 #include "./vpx_dsp_rtcd.h"
18 #include "test/acm_random.h"
19 #include "test/clear_system_state.h"
20 #include "test/register_state_check.h"
21 #include "vpx/vpx_codec.h"
22 #include "vpx/vpx_integer.h"
23 #include "vpx_mem/vpx_mem.h"
24 #include "vpx_ports/mem.h"
25
26 namespace {
27
28 typedef unsigned int (*VarianceMxNFunc)(const uint8_t *a, int a_stride,
29 const uint8_t *b, int b_stride,
30 unsigned int *sse);
31 typedef unsigned int (*SubpixVarMxNFunc)(const uint8_t *a, int a_stride,
32 int xoffset, int yoffset,
33 const uint8_t *b, int b_stride,
34 unsigned int *sse);
35 typedef unsigned int (*SubpixAvgVarMxNFunc)(const uint8_t *a, int a_stride,
36 int xoffset, int yoffset,
37 const uint8_t *b, int b_stride,
38 uint32_t *sse,
39 const uint8_t *second_pred);
40 typedef unsigned int (*Get4x4SseFunc)(const uint8_t *a, int a_stride,
41 const uint8_t *b, int b_stride);
42 typedef unsigned int (*SumOfSquaresFunction)(const int16_t *src);
43
44 using libvpx_test::ACMRandom;
45
46 // Truncate high bit depth results by downshifting (with rounding) by:
47 // 2 * (bit_depth - 8) for sse
48 // (bit_depth - 8) for se
RoundHighBitDepth(int bit_depth,int64_t * se,uint64_t * sse)49 static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) {
50 switch (bit_depth) {
51 case VPX_BITS_12:
52 *sse = (*sse + 128) >> 8;
53 *se = (*se + 8) >> 4;
54 break;
55 case VPX_BITS_10:
56 *sse = (*sse + 8) >> 4;
57 *se = (*se + 2) >> 2;
58 break;
59 case VPX_BITS_8:
60 default: break;
61 }
62 }
63
mb_ss_ref(const int16_t * src)64 static unsigned int mb_ss_ref(const int16_t *src) {
65 unsigned int res = 0;
66 for (int i = 0; i < 256; ++i) {
67 res += src[i] * src[i];
68 }
69 return res;
70 }
71
72 /* Note:
73 * Our codebase calculates the "diff" value in the variance algorithm by
74 * (src - ref).
75 */
variance_ref(const uint8_t * src,const uint8_t * ref,int l2w,int l2h,int src_stride,int ref_stride,uint32_t * sse_ptr,bool use_high_bit_depth_,vpx_bit_depth_t bit_depth)76 static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
77 int l2h, int src_stride, int ref_stride,
78 uint32_t *sse_ptr, bool use_high_bit_depth_,
79 vpx_bit_depth_t bit_depth) {
80 int64_t se = 0;
81 uint64_t sse = 0;
82 const int w = 1 << l2w;
83 const int h = 1 << l2h;
84 for (int y = 0; y < h; y++) {
85 for (int x = 0; x < w; x++) {
86 int diff;
87 if (!use_high_bit_depth_) {
88 diff = src[y * src_stride + x] - ref[y * ref_stride + x];
89 se += diff;
90 sse += diff * diff;
91 #if CONFIG_VP9_HIGHBITDEPTH
92 } else {
93 diff = CONVERT_TO_SHORTPTR(src)[y * src_stride + x] -
94 CONVERT_TO_SHORTPTR(ref)[y * ref_stride + x];
95 se += diff;
96 sse += diff * diff;
97 #endif // CONFIG_VP9_HIGHBITDEPTH
98 }
99 }
100 }
101 RoundHighBitDepth(bit_depth, &se, &sse);
102 *sse_ptr = static_cast<uint32_t>(sse);
103 return static_cast<uint32_t>(
104 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
105 }
106
107 /* The subpel reference functions differ from the codec version in one aspect:
108 * they calculate the bilinear factors directly instead of using a lookup table
109 * and therefore upshift xoff and yoff by 1. Only every other calculated value
110 * is used so the codec version shrinks the table to save space and maintain
111 * compatibility with vp8.
112 */
subpel_variance_ref(const uint8_t * ref,const uint8_t * src,int l2w,int l2h,int xoff,int yoff,uint32_t * sse_ptr,bool use_high_bit_depth_,vpx_bit_depth_t bit_depth)113 static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
114 int l2w, int l2h, int xoff, int yoff,
115 uint32_t *sse_ptr, bool use_high_bit_depth_,
116 vpx_bit_depth_t bit_depth) {
117 int64_t se = 0;
118 uint64_t sse = 0;
119 const int w = 1 << l2w;
120 const int h = 1 << l2h;
121
122 xoff <<= 1;
123 yoff <<= 1;
124
125 for (int y = 0; y < h; y++) {
126 for (int x = 0; x < w; x++) {
127 // Bilinear interpolation at a 16th pel step.
128 if (!use_high_bit_depth_) {
129 const int a1 = ref[(w + 1) * (y + 0) + x + 0];
130 const int a2 = ref[(w + 1) * (y + 0) + x + 1];
131 const int b1 = ref[(w + 1) * (y + 1) + x + 0];
132 const int b2 = ref[(w + 1) * (y + 1) + x + 1];
133 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
134 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
135 const int r = a + (((b - a) * yoff + 8) >> 4);
136 const int diff = r - src[w * y + x];
137 se += diff;
138 sse += diff * diff;
139 #if CONFIG_VP9_HIGHBITDEPTH
140 } else {
141 uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
142 uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
143 const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
144 const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
145 const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
146 const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
147 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
148 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
149 const int r = a + (((b - a) * yoff + 8) >> 4);
150 const int diff = r - src16[w * y + x];
151 se += diff;
152 sse += diff * diff;
153 #endif // CONFIG_VP9_HIGHBITDEPTH
154 }
155 }
156 }
157 RoundHighBitDepth(bit_depth, &se, &sse);
158 *sse_ptr = static_cast<uint32_t>(sse);
159 return static_cast<uint32_t>(
160 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
161 }
162
subpel_avg_variance_ref(const uint8_t * ref,const uint8_t * src,const uint8_t * second_pred,int l2w,int l2h,int xoff,int yoff,uint32_t * sse_ptr,bool use_high_bit_depth,vpx_bit_depth_t bit_depth)163 static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
164 const uint8_t *second_pred, int l2w,
165 int l2h, int xoff, int yoff,
166 uint32_t *sse_ptr,
167 bool use_high_bit_depth,
168 vpx_bit_depth_t bit_depth) {
169 int64_t se = 0;
170 uint64_t sse = 0;
171 const int w = 1 << l2w;
172 const int h = 1 << l2h;
173
174 xoff <<= 1;
175 yoff <<= 1;
176
177 for (int y = 0; y < h; y++) {
178 for (int x = 0; x < w; x++) {
179 // bilinear interpolation at a 16th pel step
180 if (!use_high_bit_depth) {
181 const int a1 = ref[(w + 1) * (y + 0) + x + 0];
182 const int a2 = ref[(w + 1) * (y + 0) + x + 1];
183 const int b1 = ref[(w + 1) * (y + 1) + x + 0];
184 const int b2 = ref[(w + 1) * (y + 1) + x + 1];
185 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
186 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
187 const int r = a + (((b - a) * yoff + 8) >> 4);
188 const int diff =
189 ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x];
190 se += diff;
191 sse += diff * diff;
192 #if CONFIG_VP9_HIGHBITDEPTH
193 } else {
194 const uint16_t *ref16 = CONVERT_TO_SHORTPTR(ref);
195 const uint16_t *src16 = CONVERT_TO_SHORTPTR(src);
196 const uint16_t *sec16 = CONVERT_TO_SHORTPTR(second_pred);
197 const int a1 = ref16[(w + 1) * (y + 0) + x + 0];
198 const int a2 = ref16[(w + 1) * (y + 0) + x + 1];
199 const int b1 = ref16[(w + 1) * (y + 1) + x + 0];
200 const int b2 = ref16[(w + 1) * (y + 1) + x + 1];
201 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4);
202 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4);
203 const int r = a + (((b - a) * yoff + 8) >> 4);
204 const int diff = ((r + sec16[w * y + x] + 1) >> 1) - src16[w * y + x];
205 se += diff;
206 sse += diff * diff;
207 #endif // CONFIG_VP9_HIGHBITDEPTH
208 }
209 }
210 }
211 RoundHighBitDepth(bit_depth, &se, &sse);
212 *sse_ptr = static_cast<uint32_t>(sse);
213 return static_cast<uint32_t>(
214 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
215 }
216
217 ////////////////////////////////////////////////////////////////////////////////
218
219 class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> {
220 public:
SumOfSquaresTest()221 SumOfSquaresTest() : func_(GetParam()) {}
222
~SumOfSquaresTest()223 virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
224
225 protected:
226 void ConstTest();
227 void RefTest();
228
229 SumOfSquaresFunction func_;
230 ACMRandom rnd_;
231 };
232
ConstTest()233 void SumOfSquaresTest::ConstTest() {
234 int16_t mem[256];
235 unsigned int res;
236 for (int v = 0; v < 256; ++v) {
237 for (int i = 0; i < 256; ++i) {
238 mem[i] = v;
239 }
240 ASM_REGISTER_STATE_CHECK(res = func_(mem));
241 EXPECT_EQ(256u * (v * v), res);
242 }
243 }
244
RefTest()245 void SumOfSquaresTest::RefTest() {
246 int16_t mem[256];
247 for (int i = 0; i < 100; ++i) {
248 for (int j = 0; j < 256; ++j) {
249 mem[j] = rnd_.Rand8() - rnd_.Rand8();
250 }
251
252 const unsigned int expected = mb_ss_ref(mem);
253 unsigned int res;
254 ASM_REGISTER_STATE_CHECK(res = func_(mem));
255 EXPECT_EQ(expected, res);
256 }
257 }
258
259 ////////////////////////////////////////////////////////////////////////////////
260 // Encapsulating struct to store the function to test along with
261 // some testing context.
262 // Can be used for MSE, SSE, Variance, etc.
263
264 template <typename Func>
265 struct TestParams {
TestParams__anon8f76cf060111::TestParams266 TestParams(int log2w = 0, int log2h = 0, Func function = NULL,
267 int bit_depth_value = 0)
268 : log2width(log2w), log2height(log2h), func(function) {
269 use_high_bit_depth = (bit_depth_value > 0);
270 if (use_high_bit_depth) {
271 bit_depth = static_cast<vpx_bit_depth_t>(bit_depth_value);
272 } else {
273 bit_depth = VPX_BITS_8;
274 }
275 width = 1 << log2width;
276 height = 1 << log2height;
277 block_size = width * height;
278 mask = (1u << bit_depth) - 1;
279 }
280
281 int log2width, log2height;
282 int width, height;
283 int block_size;
284 Func func;
285 vpx_bit_depth_t bit_depth;
286 bool use_high_bit_depth;
287 uint32_t mask;
288 };
289
290 template <typename Func>
operator <<(std::ostream & os,const TestParams<Func> & p)291 std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {
292 return os << "log2width/height:" << p.log2width << "/" << p.log2height
293 << " function:" << reinterpret_cast<const void *>(p.func)
294 << " bit-depth:" << p.bit_depth;
295 }
296
297 // Main class for testing a function type
298 template <typename FunctionType>
299 class MainTestClass
300 : public ::testing::TestWithParam<TestParams<FunctionType> > {
301 public:
SetUp()302 virtual void SetUp() {
303 params_ = this->GetParam();
304
305 rnd_.Reset(ACMRandom::DeterministicSeed());
306 const size_t unit =
307 use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
308 src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size() * unit));
309 ref_ = new uint8_t[block_size() * unit];
310 ASSERT_TRUE(src_ != NULL);
311 ASSERT_TRUE(ref_ != NULL);
312 #if CONFIG_VP9_HIGHBITDEPTH
313 if (use_high_bit_depth()) {
314 // TODO(skal): remove!
315 src_ = CONVERT_TO_BYTEPTR(src_);
316 ref_ = CONVERT_TO_BYTEPTR(ref_);
317 }
318 #endif
319 }
320
TearDown()321 virtual void TearDown() {
322 #if CONFIG_VP9_HIGHBITDEPTH
323 if (use_high_bit_depth()) {
324 // TODO(skal): remove!
325 src_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(src_));
326 ref_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(ref_));
327 }
328 #endif
329
330 vpx_free(src_);
331 delete[] ref_;
332 src_ = NULL;
333 ref_ = NULL;
334 libvpx_test::ClearSystemState();
335 }
336
337 protected:
338 // We could sub-class MainTestClass into dedicated class for Variance
339 // and MSE/SSE, but it involves a lot of 'this->xxx' dereferencing
340 // to access top class fields xxx. That's cumbersome, so for now we'll just
341 // implement the testing methods here:
342
343 // Variance tests
344 void ZeroTest();
345 void RefTest();
346 void RefStrideTest();
347 void OneQuarterTest();
348
349 // MSE/SSE tests
350 void RefTestMse();
351 void RefTestSse();
352 void MaxTestMse();
353 void MaxTestSse();
354
355 protected:
356 ACMRandom rnd_;
357 uint8_t *src_;
358 uint8_t *ref_;
359 TestParams<FunctionType> params_;
360
361 // some relay helpers
use_high_bit_depth() const362 bool use_high_bit_depth() const { return params_.use_high_bit_depth; }
byte_shift() const363 int byte_shift() const { return params_.bit_depth - 8; }
block_size() const364 int block_size() const { return params_.block_size; }
width() const365 int width() const { return params_.width; }
mask() const366 uint32_t mask() const { return params_.mask; }
367 };
368
369 ////////////////////////////////////////////////////////////////////////////////
370 // Tests related to variance.
371
372 template <typename VarianceFunctionType>
ZeroTest()373 void MainTestClass<VarianceFunctionType>::ZeroTest() {
374 for (int i = 0; i <= 255; ++i) {
375 if (!use_high_bit_depth()) {
376 memset(src_, i, block_size());
377 } else {
378 uint16_t *const src16 = CONVERT_TO_SHORTPTR(src_);
379 for (int k = 0; k < block_size(); ++k) src16[k] = i << byte_shift();
380 }
381 for (int j = 0; j <= 255; ++j) {
382 if (!use_high_bit_depth()) {
383 memset(ref_, j, block_size());
384 } else {
385 uint16_t *const ref16 = CONVERT_TO_SHORTPTR(ref_);
386 for (int k = 0; k < block_size(); ++k) ref16[k] = j << byte_shift();
387 }
388 unsigned int sse, var;
389 ASM_REGISTER_STATE_CHECK(
390 var = params_.func(src_, width(), ref_, width(), &sse));
391 EXPECT_EQ(0u, var) << "src values: " << i << " ref values: " << j;
392 }
393 }
394 }
395
396 template <typename VarianceFunctionType>
RefTest()397 void MainTestClass<VarianceFunctionType>::RefTest() {
398 for (int i = 0; i < 10; ++i) {
399 for (int j = 0; j < block_size(); j++) {
400 if (!use_high_bit_depth()) {
401 src_[j] = rnd_.Rand8();
402 ref_[j] = rnd_.Rand8();
403 #if CONFIG_VP9_HIGHBITDEPTH
404 } else {
405 CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask();
406 CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask();
407 #endif // CONFIG_VP9_HIGHBITDEPTH
408 }
409 }
410 unsigned int sse1, sse2, var1, var2;
411 const int stride = width();
412 ASM_REGISTER_STATE_CHECK(
413 var1 = params_.func(src_, stride, ref_, stride, &sse1));
414 var2 =
415 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
416 stride, &sse2, use_high_bit_depth(), params_.bit_depth);
417 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
418 EXPECT_EQ(var1, var2) << "Error at test index: " << i;
419 }
420 }
421
422 template <typename VarianceFunctionType>
RefStrideTest()423 void MainTestClass<VarianceFunctionType>::RefStrideTest() {
424 for (int i = 0; i < 10; ++i) {
425 const int ref_stride = (i & 1) * width();
426 const int src_stride = ((i >> 1) & 1) * width();
427 for (int j = 0; j < block_size(); j++) {
428 const int ref_ind = (j / width()) * ref_stride + j % width();
429 const int src_ind = (j / width()) * src_stride + j % width();
430 if (!use_high_bit_depth()) {
431 src_[src_ind] = rnd_.Rand8();
432 ref_[ref_ind] = rnd_.Rand8();
433 #if CONFIG_VP9_HIGHBITDEPTH
434 } else {
435 CONVERT_TO_SHORTPTR(src_)[src_ind] = rnd_.Rand16() & mask();
436 CONVERT_TO_SHORTPTR(ref_)[ref_ind] = rnd_.Rand16() & mask();
437 #endif // CONFIG_VP9_HIGHBITDEPTH
438 }
439 }
440 unsigned int sse1, sse2;
441 unsigned int var1, var2;
442
443 ASM_REGISTER_STATE_CHECK(
444 var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
445 var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
446 src_stride, ref_stride, &sse2, use_high_bit_depth(),
447 params_.bit_depth);
448 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
449 EXPECT_EQ(var1, var2) << "Error at test index: " << i;
450 }
451 }
452
453 template <typename VarianceFunctionType>
OneQuarterTest()454 void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
455 const int half = block_size() / 2;
456 if (!use_high_bit_depth()) {
457 memset(src_, 255, block_size());
458 memset(ref_, 255, half);
459 memset(ref_ + half, 0, half);
460 #if CONFIG_VP9_HIGHBITDEPTH
461 } else {
462 vpx_memset16(CONVERT_TO_SHORTPTR(src_), 255 << byte_shift(), block_size());
463 vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 255 << byte_shift(), half);
464 vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, 0, half);
465 #endif // CONFIG_VP9_HIGHBITDEPTH
466 }
467 unsigned int sse, var, expected;
468 ASM_REGISTER_STATE_CHECK(
469 var = params_.func(src_, width(), ref_, width(), &sse));
470 expected = block_size() * 255 * 255 / 4;
471 EXPECT_EQ(expected, var);
472 }
473
474 ////////////////////////////////////////////////////////////////////////////////
475 // Tests related to MSE / SSE.
476
477 template <typename FunctionType>
RefTestMse()478 void MainTestClass<FunctionType>::RefTestMse() {
479 for (int i = 0; i < 10; ++i) {
480 for (int j = 0; j < block_size(); ++j) {
481 src_[j] = rnd_.Rand8();
482 ref_[j] = rnd_.Rand8();
483 }
484 unsigned int sse1, sse2;
485 const int stride = width();
486 ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
487 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
488 stride, &sse2, false, VPX_BITS_8);
489 EXPECT_EQ(sse1, sse2);
490 }
491 }
492
493 template <typename FunctionType>
RefTestSse()494 void MainTestClass<FunctionType>::RefTestSse() {
495 for (int i = 0; i < 10; ++i) {
496 for (int j = 0; j < block_size(); ++j) {
497 src_[j] = rnd_.Rand8();
498 ref_[j] = rnd_.Rand8();
499 }
500 unsigned int sse2;
501 unsigned int var1;
502 const int stride = width();
503 ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
504 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
505 stride, &sse2, false, VPX_BITS_8);
506 EXPECT_EQ(var1, sse2);
507 }
508 }
509
510 template <typename FunctionType>
MaxTestMse()511 void MainTestClass<FunctionType>::MaxTestMse() {
512 memset(src_, 255, block_size());
513 memset(ref_, 0, block_size());
514 unsigned int sse;
515 ASM_REGISTER_STATE_CHECK(params_.func(src_, width(), ref_, width(), &sse));
516 const unsigned int expected = block_size() * 255 * 255;
517 EXPECT_EQ(expected, sse);
518 }
519
520 template <typename FunctionType>
MaxTestSse()521 void MainTestClass<FunctionType>::MaxTestSse() {
522 memset(src_, 255, block_size());
523 memset(ref_, 0, block_size());
524 unsigned int var;
525 ASM_REGISTER_STATE_CHECK(var = params_.func(src_, width(), ref_, width()));
526 const unsigned int expected = block_size() * 255 * 255;
527 EXPECT_EQ(expected, var);
528 }
529
530 ////////////////////////////////////////////////////////////////////////////////
531
532 using ::std::tr1::get;
533 using ::std::tr1::make_tuple;
534 using ::std::tr1::tuple;
535
536 template <typename SubpelVarianceFunctionType>
537 class SubpelVarianceTest
538 : public ::testing::TestWithParam<
539 tuple<int, int, SubpelVarianceFunctionType, int> > {
540 public:
SetUp()541 virtual void SetUp() {
542 const tuple<int, int, SubpelVarianceFunctionType, int> ¶ms =
543 this->GetParam();
544 log2width_ = get<0>(params);
545 width_ = 1 << log2width_;
546 log2height_ = get<1>(params);
547 height_ = 1 << log2height_;
548 subpel_variance_ = get<2>(params);
549 if (get<3>(params)) {
550 bit_depth_ = (vpx_bit_depth_t)get<3>(params);
551 use_high_bit_depth_ = true;
552 } else {
553 bit_depth_ = VPX_BITS_8;
554 use_high_bit_depth_ = false;
555 }
556 mask_ = (1 << bit_depth_) - 1;
557
558 rnd_.Reset(ACMRandom::DeterministicSeed());
559 block_size_ = width_ * height_;
560 if (!use_high_bit_depth_) {
561 src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
562 sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_));
563 ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
564 #if CONFIG_VP9_HIGHBITDEPTH
565 } else {
566 src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
567 vpx_memalign(16, block_size_ * sizeof(uint16_t))));
568 sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
569 vpx_memalign(16, block_size_ * sizeof(uint16_t))));
570 ref_ =
571 CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
572 #endif // CONFIG_VP9_HIGHBITDEPTH
573 }
574 ASSERT_TRUE(src_ != NULL);
575 ASSERT_TRUE(sec_ != NULL);
576 ASSERT_TRUE(ref_ != NULL);
577 }
578
TearDown()579 virtual void TearDown() {
580 if (!use_high_bit_depth_) {
581 vpx_free(src_);
582 delete[] ref_;
583 vpx_free(sec_);
584 #if CONFIG_VP9_HIGHBITDEPTH
585 } else {
586 vpx_free(CONVERT_TO_SHORTPTR(src_));
587 delete[] CONVERT_TO_SHORTPTR(ref_);
588 vpx_free(CONVERT_TO_SHORTPTR(sec_));
589 #endif // CONFIG_VP9_HIGHBITDEPTH
590 }
591 libvpx_test::ClearSystemState();
592 }
593
594 protected:
595 void RefTest();
596 void ExtremeRefTest();
597
598 ACMRandom rnd_;
599 uint8_t *src_;
600 uint8_t *ref_;
601 uint8_t *sec_;
602 bool use_high_bit_depth_;
603 vpx_bit_depth_t bit_depth_;
604 int width_, log2width_;
605 int height_, log2height_;
606 int block_size_, mask_;
607 SubpelVarianceFunctionType subpel_variance_;
608 };
609
610 template <typename SubpelVarianceFunctionType>
RefTest()611 void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
612 for (int x = 0; x < 8; ++x) {
613 for (int y = 0; y < 8; ++y) {
614 if (!use_high_bit_depth_) {
615 for (int j = 0; j < block_size_; j++) {
616 src_[j] = rnd_.Rand8();
617 }
618 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
619 ref_[j] = rnd_.Rand8();
620 }
621 #if CONFIG_VP9_HIGHBITDEPTH
622 } else {
623 for (int j = 0; j < block_size_; j++) {
624 CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
625 }
626 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
627 CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
628 }
629 #endif // CONFIG_VP9_HIGHBITDEPTH
630 }
631 unsigned int sse1, sse2;
632 unsigned int var1;
633 ASM_REGISTER_STATE_CHECK(
634 var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
635 const unsigned int var2 =
636 subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
637 use_high_bit_depth_, bit_depth_);
638 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
639 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
640 }
641 }
642 }
643
644 template <typename SubpelVarianceFunctionType>
ExtremeRefTest()645 void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
646 // Compare against reference.
647 // Src: Set the first half of values to 0, the second half to the maximum.
648 // Ref: Set the first half of values to the maximum, the second half to 0.
649 for (int x = 0; x < 8; ++x) {
650 for (int y = 0; y < 8; ++y) {
651 const int half = block_size_ / 2;
652 if (!use_high_bit_depth_) {
653 memset(src_, 0, half);
654 memset(src_ + half, 255, half);
655 memset(ref_, 255, half);
656 memset(ref_ + half, 0, half + width_ + height_ + 1);
657 #if CONFIG_VP9_HIGHBITDEPTH
658 } else {
659 vpx_memset16(CONVERT_TO_SHORTPTR(src_), mask_, half);
660 vpx_memset16(CONVERT_TO_SHORTPTR(src_) + half, 0, half);
661 vpx_memset16(CONVERT_TO_SHORTPTR(ref_), 0, half);
662 vpx_memset16(CONVERT_TO_SHORTPTR(ref_) + half, mask_,
663 half + width_ + height_ + 1);
664 #endif // CONFIG_VP9_HIGHBITDEPTH
665 }
666 unsigned int sse1, sse2;
667 unsigned int var1;
668 ASM_REGISTER_STATE_CHECK(
669 var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
670 const unsigned int var2 =
671 subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
672 use_high_bit_depth_, bit_depth_);
673 EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
674 EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
675 }
676 }
677 }
678
679 template <>
RefTest()680 void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
681 for (int x = 0; x < 8; ++x) {
682 for (int y = 0; y < 8; ++y) {
683 if (!use_high_bit_depth_) {
684 for (int j = 0; j < block_size_; j++) {
685 src_[j] = rnd_.Rand8();
686 sec_[j] = rnd_.Rand8();
687 }
688 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
689 ref_[j] = rnd_.Rand8();
690 }
691 #if CONFIG_VP9_HIGHBITDEPTH
692 } else {
693 for (int j = 0; j < block_size_; j++) {
694 CONVERT_TO_SHORTPTR(src_)[j] = rnd_.Rand16() & mask_;
695 CONVERT_TO_SHORTPTR(sec_)[j] = rnd_.Rand16() & mask_;
696 }
697 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
698 CONVERT_TO_SHORTPTR(ref_)[j] = rnd_.Rand16() & mask_;
699 }
700 #endif // CONFIG_VP9_HIGHBITDEPTH
701 }
702 uint32_t sse1, sse2;
703 uint32_t var1, var2;
704 ASM_REGISTER_STATE_CHECK(var1 =
705 subpel_variance_(ref_, width_ + 1, x, y,
706 src_, width_, &sse1, sec_));
707 var2 = subpel_avg_variance_ref(ref_, src_, sec_, log2width_, log2height_,
708 x, y, &sse2, use_high_bit_depth_,
709 static_cast<vpx_bit_depth_t>(bit_depth_));
710 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
711 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
712 }
713 }
714 }
715
716 typedef MainTestClass<Get4x4SseFunc> VpxSseTest;
717 typedef MainTestClass<VarianceMxNFunc> VpxMseTest;
718 typedef MainTestClass<VarianceMxNFunc> VpxVarianceTest;
719 typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxSubpelVarianceTest;
720 typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxSubpelAvgVarianceTest;
721
TEST_P(VpxSseTest,RefSse)722 TEST_P(VpxSseTest, RefSse) { RefTestSse(); }
TEST_P(VpxSseTest,MaxSse)723 TEST_P(VpxSseTest, MaxSse) { MaxTestSse(); }
TEST_P(VpxMseTest,RefMse)724 TEST_P(VpxMseTest, RefMse) { RefTestMse(); }
TEST_P(VpxMseTest,MaxMse)725 TEST_P(VpxMseTest, MaxMse) { MaxTestMse(); }
TEST_P(VpxVarianceTest,Zero)726 TEST_P(VpxVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxVarianceTest,Ref)727 TEST_P(VpxVarianceTest, Ref) { RefTest(); }
TEST_P(VpxVarianceTest,RefStride)728 TEST_P(VpxVarianceTest, RefStride) { RefStrideTest(); }
TEST_P(VpxVarianceTest,OneQuarter)729 TEST_P(VpxVarianceTest, OneQuarter) { OneQuarterTest(); }
TEST_P(SumOfSquaresTest,Const)730 TEST_P(SumOfSquaresTest, Const) { ConstTest(); }
TEST_P(SumOfSquaresTest,Ref)731 TEST_P(SumOfSquaresTest, Ref) { RefTest(); }
TEST_P(VpxSubpelVarianceTest,Ref)732 TEST_P(VpxSubpelVarianceTest, Ref) { RefTest(); }
TEST_P(VpxSubpelVarianceTest,ExtremeRef)733 TEST_P(VpxSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
TEST_P(VpxSubpelAvgVarianceTest,Ref)734 TEST_P(VpxSubpelAvgVarianceTest, Ref) { RefTest(); }
735
736 INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest,
737 ::testing::Values(vpx_get_mb_ss_c));
738
739 typedef TestParams<Get4x4SseFunc> SseParams;
740 INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
741 ::testing::Values(SseParams(2, 2,
742 &vpx_get4x4sse_cs_c)));
743
744 typedef TestParams<VarianceMxNFunc> MseParams;
745 INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
746 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
747 MseParams(4, 3, &vpx_mse16x8_c),
748 MseParams(3, 4, &vpx_mse8x16_c),
749 MseParams(3, 3, &vpx_mse8x8_c)));
750
751 typedef TestParams<VarianceMxNFunc> VarianceParams;
752 INSTANTIATE_TEST_CASE_P(
753 C, VpxVarianceTest,
754 ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_c),
755 VarianceParams(6, 5, &vpx_variance64x32_c),
756 VarianceParams(5, 6, &vpx_variance32x64_c),
757 VarianceParams(5, 5, &vpx_variance32x32_c),
758 VarianceParams(5, 4, &vpx_variance32x16_c),
759 VarianceParams(4, 5, &vpx_variance16x32_c),
760 VarianceParams(4, 4, &vpx_variance16x16_c),
761 VarianceParams(4, 3, &vpx_variance16x8_c),
762 VarianceParams(3, 4, &vpx_variance8x16_c),
763 VarianceParams(3, 3, &vpx_variance8x8_c),
764 VarianceParams(3, 2, &vpx_variance8x4_c),
765 VarianceParams(2, 3, &vpx_variance4x8_c),
766 VarianceParams(2, 2, &vpx_variance4x4_c)));
767
768 INSTANTIATE_TEST_CASE_P(
769 C, VpxSubpelVarianceTest,
770 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_c, 0),
771 make_tuple(6, 5, &vpx_sub_pixel_variance64x32_c, 0),
772 make_tuple(5, 6, &vpx_sub_pixel_variance32x64_c, 0),
773 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_c, 0),
774 make_tuple(5, 4, &vpx_sub_pixel_variance32x16_c, 0),
775 make_tuple(4, 5, &vpx_sub_pixel_variance16x32_c, 0),
776 make_tuple(4, 4, &vpx_sub_pixel_variance16x16_c, 0),
777 make_tuple(4, 3, &vpx_sub_pixel_variance16x8_c, 0),
778 make_tuple(3, 4, &vpx_sub_pixel_variance8x16_c, 0),
779 make_tuple(3, 3, &vpx_sub_pixel_variance8x8_c, 0),
780 make_tuple(3, 2, &vpx_sub_pixel_variance8x4_c, 0),
781 make_tuple(2, 3, &vpx_sub_pixel_variance4x8_c, 0),
782 make_tuple(2, 2, &vpx_sub_pixel_variance4x4_c, 0)));
783
784 INSTANTIATE_TEST_CASE_P(
785 C, VpxSubpelAvgVarianceTest,
786 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_c, 0),
787 make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_c, 0),
788 make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_c, 0),
789 make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_c, 0),
790 make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_c, 0),
791 make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_c, 0),
792 make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_c, 0),
793 make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_c, 0),
794 make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_c, 0),
795 make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_c, 0),
796 make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_c, 0),
797 make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_c, 0),
798 make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_c, 0)));
799
800 #if CONFIG_VP9_HIGHBITDEPTH
801 typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
802 typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
803 typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
804 typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxHBDSubpelAvgVarianceTest;
805
TEST_P(VpxHBDMseTest,RefMse)806 TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
TEST_P(VpxHBDMseTest,MaxMse)807 TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
TEST_P(VpxHBDVarianceTest,Zero)808 TEST_P(VpxHBDVarianceTest, Zero) { ZeroTest(); }
TEST_P(VpxHBDVarianceTest,Ref)809 TEST_P(VpxHBDVarianceTest, Ref) { RefTest(); }
TEST_P(VpxHBDVarianceTest,RefStride)810 TEST_P(VpxHBDVarianceTest, RefStride) { RefStrideTest(); }
TEST_P(VpxHBDVarianceTest,OneQuarter)811 TEST_P(VpxHBDVarianceTest, OneQuarter) { OneQuarterTest(); }
TEST_P(VpxHBDSubpelVarianceTest,Ref)812 TEST_P(VpxHBDSubpelVarianceTest, Ref) { RefTest(); }
TEST_P(VpxHBDSubpelVarianceTest,ExtremeRef)813 TEST_P(VpxHBDSubpelVarianceTest, ExtremeRef) { ExtremeRefTest(); }
TEST_P(VpxHBDSubpelAvgVarianceTest,Ref)814 TEST_P(VpxHBDSubpelAvgVarianceTest, Ref) { RefTest(); }
815
816 /* TODO(debargha): This test does not support the highbd version
817 INSTANTIATE_TEST_CASE_P(
818 C, VpxHBDMseTest,
819 ::testing::Values(make_tuple(4, 4, &vpx_highbd_12_mse16x16_c),
820 make_tuple(4, 4, &vpx_highbd_12_mse16x8_c),
821 make_tuple(4, 4, &vpx_highbd_12_mse8x16_c),
822 make_tuple(4, 4, &vpx_highbd_12_mse8x8_c),
823 make_tuple(4, 4, &vpx_highbd_10_mse16x16_c),
824 make_tuple(4, 4, &vpx_highbd_10_mse16x8_c),
825 make_tuple(4, 4, &vpx_highbd_10_mse8x16_c),
826 make_tuple(4, 4, &vpx_highbd_10_mse8x8_c),
827 make_tuple(4, 4, &vpx_highbd_8_mse16x16_c),
828 make_tuple(4, 4, &vpx_highbd_8_mse16x8_c),
829 make_tuple(4, 4, &vpx_highbd_8_mse8x16_c),
830 make_tuple(4, 4, &vpx_highbd_8_mse8x8_c)));
831 */
832
833 INSTANTIATE_TEST_CASE_P(
834 C, VpxHBDVarianceTest,
835 ::testing::Values(VarianceParams(6, 6, &vpx_highbd_12_variance64x64_c, 12),
836 VarianceParams(6, 5, &vpx_highbd_12_variance64x32_c, 12),
837 VarianceParams(5, 6, &vpx_highbd_12_variance32x64_c, 12),
838 VarianceParams(5, 5, &vpx_highbd_12_variance32x32_c, 12),
839 VarianceParams(5, 4, &vpx_highbd_12_variance32x16_c, 12),
840 VarianceParams(4, 5, &vpx_highbd_12_variance16x32_c, 12),
841 VarianceParams(4, 4, &vpx_highbd_12_variance16x16_c, 12),
842 VarianceParams(4, 3, &vpx_highbd_12_variance16x8_c, 12),
843 VarianceParams(3, 4, &vpx_highbd_12_variance8x16_c, 12),
844 VarianceParams(3, 3, &vpx_highbd_12_variance8x8_c, 12),
845 VarianceParams(3, 2, &vpx_highbd_12_variance8x4_c, 12),
846 VarianceParams(2, 3, &vpx_highbd_12_variance4x8_c, 12),
847 VarianceParams(2, 2, &vpx_highbd_12_variance4x4_c, 12),
848 VarianceParams(6, 6, &vpx_highbd_10_variance64x64_c, 10),
849 VarianceParams(6, 5, &vpx_highbd_10_variance64x32_c, 10),
850 VarianceParams(5, 6, &vpx_highbd_10_variance32x64_c, 10),
851 VarianceParams(5, 5, &vpx_highbd_10_variance32x32_c, 10),
852 VarianceParams(5, 4, &vpx_highbd_10_variance32x16_c, 10),
853 VarianceParams(4, 5, &vpx_highbd_10_variance16x32_c, 10),
854 VarianceParams(4, 4, &vpx_highbd_10_variance16x16_c, 10),
855 VarianceParams(4, 3, &vpx_highbd_10_variance16x8_c, 10),
856 VarianceParams(3, 4, &vpx_highbd_10_variance8x16_c, 10),
857 VarianceParams(3, 3, &vpx_highbd_10_variance8x8_c, 10),
858 VarianceParams(3, 2, &vpx_highbd_10_variance8x4_c, 10),
859 VarianceParams(2, 3, &vpx_highbd_10_variance4x8_c, 10),
860 VarianceParams(2, 2, &vpx_highbd_10_variance4x4_c, 10),
861 VarianceParams(6, 6, &vpx_highbd_8_variance64x64_c, 8),
862 VarianceParams(6, 5, &vpx_highbd_8_variance64x32_c, 8),
863 VarianceParams(5, 6, &vpx_highbd_8_variance32x64_c, 8),
864 VarianceParams(5, 5, &vpx_highbd_8_variance32x32_c, 8),
865 VarianceParams(5, 4, &vpx_highbd_8_variance32x16_c, 8),
866 VarianceParams(4, 5, &vpx_highbd_8_variance16x32_c, 8),
867 VarianceParams(4, 4, &vpx_highbd_8_variance16x16_c, 8),
868 VarianceParams(4, 3, &vpx_highbd_8_variance16x8_c, 8),
869 VarianceParams(3, 4, &vpx_highbd_8_variance8x16_c, 8),
870 VarianceParams(3, 3, &vpx_highbd_8_variance8x8_c, 8),
871 VarianceParams(3, 2, &vpx_highbd_8_variance8x4_c, 8),
872 VarianceParams(2, 3, &vpx_highbd_8_variance4x8_c, 8),
873 VarianceParams(2, 2, &vpx_highbd_8_variance4x4_c, 8)));
874
875 INSTANTIATE_TEST_CASE_P(
876 C, VpxHBDSubpelVarianceTest,
877 ::testing::Values(
878 make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_c, 8),
879 make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_c, 8),
880 make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_c, 8),
881 make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_c, 8),
882 make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_c, 8),
883 make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_c, 8),
884 make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_c, 8),
885 make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_c, 8),
886 make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_c, 8),
887 make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_c, 8),
888 make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_c, 8),
889 make_tuple(2, 3, &vpx_highbd_8_sub_pixel_variance4x8_c, 8),
890 make_tuple(2, 2, &vpx_highbd_8_sub_pixel_variance4x4_c, 8),
891 make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_c, 10),
892 make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_c, 10),
893 make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_c, 10),
894 make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_c, 10),
895 make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_c, 10),
896 make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_c, 10),
897 make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_c, 10),
898 make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_c, 10),
899 make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_c, 10),
900 make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_c, 10),
901 make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_c, 10),
902 make_tuple(2, 3, &vpx_highbd_10_sub_pixel_variance4x8_c, 10),
903 make_tuple(2, 2, &vpx_highbd_10_sub_pixel_variance4x4_c, 10),
904 make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_c, 12),
905 make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_c, 12),
906 make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_c, 12),
907 make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_c, 12),
908 make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_c, 12),
909 make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_c, 12),
910 make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_c, 12),
911 make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_c, 12),
912 make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_c, 12),
913 make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_c, 12),
914 make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_c, 12),
915 make_tuple(2, 3, &vpx_highbd_12_sub_pixel_variance4x8_c, 12),
916 make_tuple(2, 2, &vpx_highbd_12_sub_pixel_variance4x4_c, 12)));
917
918 INSTANTIATE_TEST_CASE_P(
919 C, VpxHBDSubpelAvgVarianceTest,
920 ::testing::Values(
921 make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_c, 8),
922 make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_c, 8),
923 make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_c, 8),
924 make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_c, 8),
925 make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_c, 8),
926 make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_c, 8),
927 make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_c, 8),
928 make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_c, 8),
929 make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_c, 8),
930 make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_c, 8),
931 make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_c, 8),
932 make_tuple(2, 3, &vpx_highbd_8_sub_pixel_avg_variance4x8_c, 8),
933 make_tuple(2, 2, &vpx_highbd_8_sub_pixel_avg_variance4x4_c, 8),
934 make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_c, 10),
935 make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_c, 10),
936 make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_c, 10),
937 make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_c, 10),
938 make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_c, 10),
939 make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_c, 10),
940 make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_c, 10),
941 make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_c, 10),
942 make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_c, 10),
943 make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_c, 10),
944 make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_c, 10),
945 make_tuple(2, 3, &vpx_highbd_10_sub_pixel_avg_variance4x8_c, 10),
946 make_tuple(2, 2, &vpx_highbd_10_sub_pixel_avg_variance4x4_c, 10),
947 make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_c, 12),
948 make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_c, 12),
949 make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_c, 12),
950 make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_c, 12),
951 make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_c, 12),
952 make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_c, 12),
953 make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_c, 12),
954 make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_c, 12),
955 make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_c, 12),
956 make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_c, 12),
957 make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_c, 12),
958 make_tuple(2, 3, &vpx_highbd_12_sub_pixel_avg_variance4x8_c, 12),
959 make_tuple(2, 2, &vpx_highbd_12_sub_pixel_avg_variance4x4_c, 12)));
960 #endif // CONFIG_VP9_HIGHBITDEPTH
961
962 #if HAVE_SSE2
963 INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest,
964 ::testing::Values(vpx_get_mb_ss_sse2));
965
966 INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
967 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
968 MseParams(4, 3, &vpx_mse16x8_sse2),
969 MseParams(3, 4, &vpx_mse8x16_sse2),
970 MseParams(3, 3, &vpx_mse8x8_sse2)));
971
972 INSTANTIATE_TEST_CASE_P(
973 SSE2, VpxVarianceTest,
974 ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_sse2),
975 VarianceParams(6, 5, &vpx_variance64x32_sse2),
976 VarianceParams(5, 6, &vpx_variance32x64_sse2),
977 VarianceParams(5, 5, &vpx_variance32x32_sse2),
978 VarianceParams(5, 4, &vpx_variance32x16_sse2),
979 VarianceParams(4, 5, &vpx_variance16x32_sse2),
980 VarianceParams(4, 4, &vpx_variance16x16_sse2),
981 VarianceParams(4, 3, &vpx_variance16x8_sse2),
982 VarianceParams(3, 4, &vpx_variance8x16_sse2),
983 VarianceParams(3, 3, &vpx_variance8x8_sse2),
984 VarianceParams(3, 2, &vpx_variance8x4_sse2),
985 VarianceParams(2, 3, &vpx_variance4x8_sse2),
986 VarianceParams(2, 2, &vpx_variance4x4_sse2)));
987
988 INSTANTIATE_TEST_CASE_P(
989 SSE2, VpxSubpelVarianceTest,
990 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_sse2, 0),
991 make_tuple(6, 5, &vpx_sub_pixel_variance64x32_sse2, 0),
992 make_tuple(5, 6, &vpx_sub_pixel_variance32x64_sse2, 0),
993 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_sse2, 0),
994 make_tuple(5, 4, &vpx_sub_pixel_variance32x16_sse2, 0),
995 make_tuple(4, 5, &vpx_sub_pixel_variance16x32_sse2, 0),
996 make_tuple(4, 4, &vpx_sub_pixel_variance16x16_sse2, 0),
997 make_tuple(4, 3, &vpx_sub_pixel_variance16x8_sse2, 0),
998 make_tuple(3, 4, &vpx_sub_pixel_variance8x16_sse2, 0),
999 make_tuple(3, 3, &vpx_sub_pixel_variance8x8_sse2, 0),
1000 make_tuple(3, 2, &vpx_sub_pixel_variance8x4_sse2, 0),
1001 make_tuple(2, 3, &vpx_sub_pixel_variance4x8_sse2, 0),
1002 make_tuple(2, 2, &vpx_sub_pixel_variance4x4_sse2, 0)));
1003
1004 INSTANTIATE_TEST_CASE_P(
1005 SSE2, VpxSubpelAvgVarianceTest,
1006 ::testing::Values(
1007 make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_sse2, 0),
1008 make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_sse2, 0),
1009 make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_sse2, 0),
1010 make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_sse2, 0),
1011 make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_sse2, 0),
1012 make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_sse2, 0),
1013 make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_sse2, 0),
1014 make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_sse2, 0),
1015 make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_sse2, 0),
1016 make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_sse2, 0),
1017 make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_sse2, 0),
1018 make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_sse2, 0),
1019 make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_sse2, 0)));
1020
1021 #if CONFIG_VP9_HIGHBITDEPTH
1022 /* TODO(debargha): This test does not support the highbd version
1023 INSTANTIATE_TEST_CASE_P(
1024 SSE2, VpxHBDMseTest,
1025 ::testing::Values(MseParams(4, 4, &vpx_highbd_12_mse16x16_sse2),
1026 MseParams(4, 3, &vpx_highbd_12_mse16x8_sse2),
1027 MseParams(3, 4, &vpx_highbd_12_mse8x16_sse2),
1028 MseParams(3, 3, &vpx_highbd_12_mse8x8_sse2),
1029 MseParams(4, 4, &vpx_highbd_10_mse16x16_sse2),
1030 MseParams(4, 3, &vpx_highbd_10_mse16x8_sse2),
1031 MseParams(3, 4, &vpx_highbd_10_mse8x16_sse2),
1032 MseParams(3, 3, &vpx_highbd_10_mse8x8_sse2),
1033 MseParams(4, 4, &vpx_highbd_8_mse16x16_sse2),
1034 MseParams(4, 3, &vpx_highbd_8_mse16x8_sse2),
1035 MseParams(3, 4, &vpx_highbd_8_mse8x16_sse2),
1036 MseParams(3, 3, &vpx_highbd_8_mse8x8_sse2)));
1037 */
1038
1039 INSTANTIATE_TEST_CASE_P(
1040 SSE2, VpxHBDVarianceTest,
1041 ::testing::Values(
1042 VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
1043 VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
1044 VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
1045 VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
1046 VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
1047 VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
1048 VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
1049 VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
1050 VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
1051 VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
1052 VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
1053 VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
1054 VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
1055 VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
1056 VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
1057 VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
1058 VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
1059 VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
1060 VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
1061 VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
1062 VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
1063 VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
1064 VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
1065 VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
1066 VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
1067 VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
1068 VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
1069 VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
1070 VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
1071 VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
1072
1073 INSTANTIATE_TEST_CASE_P(
1074 SSE2, VpxHBDSubpelVarianceTest,
1075 ::testing::Values(
1076 make_tuple(6, 6, &vpx_highbd_12_sub_pixel_variance64x64_sse2, 12),
1077 make_tuple(6, 5, &vpx_highbd_12_sub_pixel_variance64x32_sse2, 12),
1078 make_tuple(5, 6, &vpx_highbd_12_sub_pixel_variance32x64_sse2, 12),
1079 make_tuple(5, 5, &vpx_highbd_12_sub_pixel_variance32x32_sse2, 12),
1080 make_tuple(5, 4, &vpx_highbd_12_sub_pixel_variance32x16_sse2, 12),
1081 make_tuple(4, 5, &vpx_highbd_12_sub_pixel_variance16x32_sse2, 12),
1082 make_tuple(4, 4, &vpx_highbd_12_sub_pixel_variance16x16_sse2, 12),
1083 make_tuple(4, 3, &vpx_highbd_12_sub_pixel_variance16x8_sse2, 12),
1084 make_tuple(3, 4, &vpx_highbd_12_sub_pixel_variance8x16_sse2, 12),
1085 make_tuple(3, 3, &vpx_highbd_12_sub_pixel_variance8x8_sse2, 12),
1086 make_tuple(3, 2, &vpx_highbd_12_sub_pixel_variance8x4_sse2, 12),
1087 make_tuple(6, 6, &vpx_highbd_10_sub_pixel_variance64x64_sse2, 10),
1088 make_tuple(6, 5, &vpx_highbd_10_sub_pixel_variance64x32_sse2, 10),
1089 make_tuple(5, 6, &vpx_highbd_10_sub_pixel_variance32x64_sse2, 10),
1090 make_tuple(5, 5, &vpx_highbd_10_sub_pixel_variance32x32_sse2, 10),
1091 make_tuple(5, 4, &vpx_highbd_10_sub_pixel_variance32x16_sse2, 10),
1092 make_tuple(4, 5, &vpx_highbd_10_sub_pixel_variance16x32_sse2, 10),
1093 make_tuple(4, 4, &vpx_highbd_10_sub_pixel_variance16x16_sse2, 10),
1094 make_tuple(4, 3, &vpx_highbd_10_sub_pixel_variance16x8_sse2, 10),
1095 make_tuple(3, 4, &vpx_highbd_10_sub_pixel_variance8x16_sse2, 10),
1096 make_tuple(3, 3, &vpx_highbd_10_sub_pixel_variance8x8_sse2, 10),
1097 make_tuple(3, 2, &vpx_highbd_10_sub_pixel_variance8x4_sse2, 10),
1098 make_tuple(6, 6, &vpx_highbd_8_sub_pixel_variance64x64_sse2, 8),
1099 make_tuple(6, 5, &vpx_highbd_8_sub_pixel_variance64x32_sse2, 8),
1100 make_tuple(5, 6, &vpx_highbd_8_sub_pixel_variance32x64_sse2, 8),
1101 make_tuple(5, 5, &vpx_highbd_8_sub_pixel_variance32x32_sse2, 8),
1102 make_tuple(5, 4, &vpx_highbd_8_sub_pixel_variance32x16_sse2, 8),
1103 make_tuple(4, 5, &vpx_highbd_8_sub_pixel_variance16x32_sse2, 8),
1104 make_tuple(4, 4, &vpx_highbd_8_sub_pixel_variance16x16_sse2, 8),
1105 make_tuple(4, 3, &vpx_highbd_8_sub_pixel_variance16x8_sse2, 8),
1106 make_tuple(3, 4, &vpx_highbd_8_sub_pixel_variance8x16_sse2, 8),
1107 make_tuple(3, 3, &vpx_highbd_8_sub_pixel_variance8x8_sse2, 8),
1108 make_tuple(3, 2, &vpx_highbd_8_sub_pixel_variance8x4_sse2, 8)));
1109
1110 INSTANTIATE_TEST_CASE_P(
1111 SSE2, VpxHBDSubpelAvgVarianceTest,
1112 ::testing::Values(
1113 make_tuple(6, 6, &vpx_highbd_12_sub_pixel_avg_variance64x64_sse2, 12),
1114 make_tuple(6, 5, &vpx_highbd_12_sub_pixel_avg_variance64x32_sse2, 12),
1115 make_tuple(5, 6, &vpx_highbd_12_sub_pixel_avg_variance32x64_sse2, 12),
1116 make_tuple(5, 5, &vpx_highbd_12_sub_pixel_avg_variance32x32_sse2, 12),
1117 make_tuple(5, 4, &vpx_highbd_12_sub_pixel_avg_variance32x16_sse2, 12),
1118 make_tuple(4, 5, &vpx_highbd_12_sub_pixel_avg_variance16x32_sse2, 12),
1119 make_tuple(4, 4, &vpx_highbd_12_sub_pixel_avg_variance16x16_sse2, 12),
1120 make_tuple(4, 3, &vpx_highbd_12_sub_pixel_avg_variance16x8_sse2, 12),
1121 make_tuple(3, 4, &vpx_highbd_12_sub_pixel_avg_variance8x16_sse2, 12),
1122 make_tuple(3, 3, &vpx_highbd_12_sub_pixel_avg_variance8x8_sse2, 12),
1123 make_tuple(3, 2, &vpx_highbd_12_sub_pixel_avg_variance8x4_sse2, 12),
1124 make_tuple(6, 6, &vpx_highbd_10_sub_pixel_avg_variance64x64_sse2, 10),
1125 make_tuple(6, 5, &vpx_highbd_10_sub_pixel_avg_variance64x32_sse2, 10),
1126 make_tuple(5, 6, &vpx_highbd_10_sub_pixel_avg_variance32x64_sse2, 10),
1127 make_tuple(5, 5, &vpx_highbd_10_sub_pixel_avg_variance32x32_sse2, 10),
1128 make_tuple(5, 4, &vpx_highbd_10_sub_pixel_avg_variance32x16_sse2, 10),
1129 make_tuple(4, 5, &vpx_highbd_10_sub_pixel_avg_variance16x32_sse2, 10),
1130 make_tuple(4, 4, &vpx_highbd_10_sub_pixel_avg_variance16x16_sse2, 10),
1131 make_tuple(4, 3, &vpx_highbd_10_sub_pixel_avg_variance16x8_sse2, 10),
1132 make_tuple(3, 4, &vpx_highbd_10_sub_pixel_avg_variance8x16_sse2, 10),
1133 make_tuple(3, 3, &vpx_highbd_10_sub_pixel_avg_variance8x8_sse2, 10),
1134 make_tuple(3, 2, &vpx_highbd_10_sub_pixel_avg_variance8x4_sse2, 10),
1135 make_tuple(6, 6, &vpx_highbd_8_sub_pixel_avg_variance64x64_sse2, 8),
1136 make_tuple(6, 5, &vpx_highbd_8_sub_pixel_avg_variance64x32_sse2, 8),
1137 make_tuple(5, 6, &vpx_highbd_8_sub_pixel_avg_variance32x64_sse2, 8),
1138 make_tuple(5, 5, &vpx_highbd_8_sub_pixel_avg_variance32x32_sse2, 8),
1139 make_tuple(5, 4, &vpx_highbd_8_sub_pixel_avg_variance32x16_sse2, 8),
1140 make_tuple(4, 5, &vpx_highbd_8_sub_pixel_avg_variance16x32_sse2, 8),
1141 make_tuple(4, 4, &vpx_highbd_8_sub_pixel_avg_variance16x16_sse2, 8),
1142 make_tuple(4, 3, &vpx_highbd_8_sub_pixel_avg_variance16x8_sse2, 8),
1143 make_tuple(3, 4, &vpx_highbd_8_sub_pixel_avg_variance8x16_sse2, 8),
1144 make_tuple(3, 3, &vpx_highbd_8_sub_pixel_avg_variance8x8_sse2, 8),
1145 make_tuple(3, 2, &vpx_highbd_8_sub_pixel_avg_variance8x4_sse2, 8)));
1146 #endif // CONFIG_VP9_HIGHBITDEPTH
1147 #endif // HAVE_SSE2
1148
1149 #if HAVE_SSSE3
1150 INSTANTIATE_TEST_CASE_P(
1151 SSSE3, VpxSubpelVarianceTest,
1152 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_ssse3, 0),
1153 make_tuple(6, 5, &vpx_sub_pixel_variance64x32_ssse3, 0),
1154 make_tuple(5, 6, &vpx_sub_pixel_variance32x64_ssse3, 0),
1155 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_ssse3, 0),
1156 make_tuple(5, 4, &vpx_sub_pixel_variance32x16_ssse3, 0),
1157 make_tuple(4, 5, &vpx_sub_pixel_variance16x32_ssse3, 0),
1158 make_tuple(4, 4, &vpx_sub_pixel_variance16x16_ssse3, 0),
1159 make_tuple(4, 3, &vpx_sub_pixel_variance16x8_ssse3, 0),
1160 make_tuple(3, 4, &vpx_sub_pixel_variance8x16_ssse3, 0),
1161 make_tuple(3, 3, &vpx_sub_pixel_variance8x8_ssse3, 0),
1162 make_tuple(3, 2, &vpx_sub_pixel_variance8x4_ssse3, 0),
1163 make_tuple(2, 3, &vpx_sub_pixel_variance4x8_ssse3, 0),
1164 make_tuple(2, 2, &vpx_sub_pixel_variance4x4_ssse3, 0)));
1165
1166 INSTANTIATE_TEST_CASE_P(
1167 SSSE3, VpxSubpelAvgVarianceTest,
1168 ::testing::Values(
1169 make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_ssse3, 0),
1170 make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_ssse3, 0),
1171 make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_ssse3, 0),
1172 make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_ssse3, 0),
1173 make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_ssse3, 0),
1174 make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_ssse3, 0),
1175 make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_ssse3, 0),
1176 make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_ssse3, 0),
1177 make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_ssse3, 0),
1178 make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_ssse3, 0),
1179 make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_ssse3, 0),
1180 make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_ssse3, 0),
1181 make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_ssse3, 0)));
1182 #endif // HAVE_SSSE3
1183
1184 #if HAVE_AVX2
1185 INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
1186 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
1187
1188 INSTANTIATE_TEST_CASE_P(
1189 AVX2, VpxVarianceTest,
1190 ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_avx2),
1191 VarianceParams(6, 5, &vpx_variance64x32_avx2),
1192 VarianceParams(5, 5, &vpx_variance32x32_avx2),
1193 VarianceParams(5, 4, &vpx_variance32x16_avx2),
1194 VarianceParams(4, 4, &vpx_variance16x16_avx2)));
1195
1196 INSTANTIATE_TEST_CASE_P(
1197 AVX2, VpxSubpelVarianceTest,
1198 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_avx2, 0),
1199 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_avx2, 0)));
1200
1201 INSTANTIATE_TEST_CASE_P(
1202 AVX2, VpxSubpelAvgVarianceTest,
1203 ::testing::Values(
1204 make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_avx2, 0),
1205 make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_avx2, 0)));
1206 #endif // HAVE_AVX2
1207
1208 #if HAVE_NEON
1209 INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
1210 ::testing::Values(SseParams(2, 2,
1211 &vpx_get4x4sse_cs_neon)));
1212
1213 INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
1214 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
1215
1216 INSTANTIATE_TEST_CASE_P(
1217 NEON, VpxVarianceTest,
1218 ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_neon),
1219 VarianceParams(6, 5, &vpx_variance64x32_neon),
1220 VarianceParams(5, 6, &vpx_variance32x64_neon),
1221 VarianceParams(5, 5, &vpx_variance32x32_neon),
1222 VarianceParams(4, 4, &vpx_variance16x16_neon),
1223 VarianceParams(4, 3, &vpx_variance16x8_neon),
1224 VarianceParams(3, 4, &vpx_variance8x16_neon),
1225 VarianceParams(3, 3, &vpx_variance8x8_neon)));
1226
1227 INSTANTIATE_TEST_CASE_P(
1228 NEON, VpxSubpelVarianceTest,
1229 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_variance64x64_neon, 0),
1230 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_neon, 0),
1231 make_tuple(4, 4, &vpx_sub_pixel_variance16x16_neon, 0),
1232 make_tuple(3, 3, &vpx_sub_pixel_variance8x8_neon, 0)));
1233 #endif // HAVE_NEON
1234
1235 #if HAVE_MSA
1236 INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest,
1237 ::testing::Values(vpx_get_mb_ss_msa));
1238
1239 INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
1240 ::testing::Values(SseParams(2, 2,
1241 &vpx_get4x4sse_cs_msa)));
1242
1243 INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
1244 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
1245 MseParams(4, 3, &vpx_mse16x8_msa),
1246 MseParams(3, 4, &vpx_mse8x16_msa),
1247 MseParams(3, 3, &vpx_mse8x8_msa)));
1248
1249 INSTANTIATE_TEST_CASE_P(
1250 MSA, VpxVarianceTest,
1251 ::testing::Values(VarianceParams(6, 6, &vpx_variance64x64_msa),
1252 VarianceParams(6, 5, &vpx_variance64x32_msa),
1253 VarianceParams(5, 6, &vpx_variance32x64_msa),
1254 VarianceParams(5, 5, &vpx_variance32x32_msa),
1255 VarianceParams(5, 4, &vpx_variance32x16_msa),
1256 VarianceParams(4, 5, &vpx_variance16x32_msa),
1257 VarianceParams(4, 4, &vpx_variance16x16_msa),
1258 VarianceParams(4, 3, &vpx_variance16x8_msa),
1259 VarianceParams(3, 4, &vpx_variance8x16_msa),
1260 VarianceParams(3, 3, &vpx_variance8x8_msa),
1261 VarianceParams(3, 2, &vpx_variance8x4_msa),
1262 VarianceParams(2, 3, &vpx_variance4x8_msa),
1263 VarianceParams(2, 2, &vpx_variance4x4_msa)));
1264
1265 INSTANTIATE_TEST_CASE_P(
1266 MSA, VpxSubpelVarianceTest,
1267 ::testing::Values(make_tuple(2, 2, &vpx_sub_pixel_variance4x4_msa, 0),
1268 make_tuple(2, 3, &vpx_sub_pixel_variance4x8_msa, 0),
1269 make_tuple(3, 2, &vpx_sub_pixel_variance8x4_msa, 0),
1270 make_tuple(3, 3, &vpx_sub_pixel_variance8x8_msa, 0),
1271 make_tuple(3, 4, &vpx_sub_pixel_variance8x16_msa, 0),
1272 make_tuple(4, 3, &vpx_sub_pixel_variance16x8_msa, 0),
1273 make_tuple(4, 4, &vpx_sub_pixel_variance16x16_msa, 0),
1274 make_tuple(4, 5, &vpx_sub_pixel_variance16x32_msa, 0),
1275 make_tuple(5, 4, &vpx_sub_pixel_variance32x16_msa, 0),
1276 make_tuple(5, 5, &vpx_sub_pixel_variance32x32_msa, 0),
1277 make_tuple(5, 6, &vpx_sub_pixel_variance32x64_msa, 0),
1278 make_tuple(6, 5, &vpx_sub_pixel_variance64x32_msa, 0),
1279 make_tuple(6, 6, &vpx_sub_pixel_variance64x64_msa, 0)));
1280
1281 INSTANTIATE_TEST_CASE_P(
1282 MSA, VpxSubpelAvgVarianceTest,
1283 ::testing::Values(make_tuple(6, 6, &vpx_sub_pixel_avg_variance64x64_msa, 0),
1284 make_tuple(6, 5, &vpx_sub_pixel_avg_variance64x32_msa, 0),
1285 make_tuple(5, 6, &vpx_sub_pixel_avg_variance32x64_msa, 0),
1286 make_tuple(5, 5, &vpx_sub_pixel_avg_variance32x32_msa, 0),
1287 make_tuple(5, 4, &vpx_sub_pixel_avg_variance32x16_msa, 0),
1288 make_tuple(4, 5, &vpx_sub_pixel_avg_variance16x32_msa, 0),
1289 make_tuple(4, 4, &vpx_sub_pixel_avg_variance16x16_msa, 0),
1290 make_tuple(4, 3, &vpx_sub_pixel_avg_variance16x8_msa, 0),
1291 make_tuple(3, 4, &vpx_sub_pixel_avg_variance8x16_msa, 0),
1292 make_tuple(3, 3, &vpx_sub_pixel_avg_variance8x8_msa, 0),
1293 make_tuple(3, 2, &vpx_sub_pixel_avg_variance8x4_msa, 0),
1294 make_tuple(2, 3, &vpx_sub_pixel_avg_variance4x8_msa, 0),
1295 make_tuple(2, 2, &vpx_sub_pixel_avg_variance4x4_msa, 0)));
1296 #endif // HAVE_MSA
1297 } // namespace
1298