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 #include <stdlib.h> 11 #include <new> 12 13 #include "third_party/googletest/src/include/gtest/gtest.h" 14 15 #include "test/clear_system_state.h" 16 #include "test/register_state_check.h" 17 18 #include "vpx/vpx_integer.h" 19 #include "./vpx_config.h" 20 extern "C" { 21 #include "vpx_mem/vpx_mem.h" 22 #if CONFIG_VP8_ENCODER 23 # include "vp8/common/variance.h" 24 # include "./vp8_rtcd.h" 25 #endif 26 #if CONFIG_VP9_ENCODER 27 # include "vp9/encoder/vp9_variance.h" 28 # include "./vp9_rtcd.h" 29 #endif 30 } 31 #include "test/acm_random.h" 32 33 namespace { 34 35 using ::std::tr1::get; 36 using ::std::tr1::make_tuple; 37 using ::std::tr1::tuple; 38 using libvpx_test::ACMRandom; 39 40 static unsigned int variance_ref(const uint8_t *ref, const uint8_t *src, 41 int l2w, int l2h, unsigned int *sse_ptr) { 42 int se = 0; 43 unsigned int sse = 0; 44 const int w = 1 << l2w, h = 1 << l2h; 45 for (int y = 0; y < h; y++) { 46 for (int x = 0; x < w; x++) { 47 int diff = ref[w * y + x] - src[w * y + x]; 48 se += diff; 49 sse += diff * diff; 50 } 51 } 52 *sse_ptr = sse; 53 return sse - (((int64_t) se * se) >> (l2w + l2h)); 54 } 55 56 static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src, 57 int l2w, int l2h, int xoff, int yoff, 58 unsigned int *sse_ptr) { 59 int se = 0; 60 unsigned int sse = 0; 61 const int w = 1 << l2w, h = 1 << l2h; 62 for (int y = 0; y < h; y++) { 63 for (int x = 0; x < w; x++) { 64 // bilinear interpolation at a 16th pel step 65 const int a1 = ref[(w + 1) * (y + 0) + x + 0]; 66 const int a2 = ref[(w + 1) * (y + 0) + x + 1]; 67 const int b1 = ref[(w + 1) * (y + 1) + x + 0]; 68 const int b2 = ref[(w + 1) * (y + 1) + x + 1]; 69 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4); 70 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4); 71 const int r = a + (((b - a) * yoff + 8) >> 4); 72 int diff = r - src[w * y + x]; 73 se += diff; 74 sse += diff * diff; 75 } 76 } 77 *sse_ptr = sse; 78 return sse - (((int64_t) se * se) >> (l2w + l2h)); 79 } 80 81 static unsigned int subpel_avg_variance_ref(const uint8_t *ref, 82 const uint8_t *src, 83 const uint8_t *second_pred, 84 int l2w, int l2h, 85 int xoff, int yoff, 86 unsigned int *sse_ptr) { 87 int se = 0; 88 unsigned int sse = 0; 89 const int w = 1 << l2w, h = 1 << l2h; 90 for (int y = 0; y < h; y++) { 91 for (int x = 0; x < w; x++) { 92 // bilinear interpolation at a 16th pel step 93 const int a1 = ref[(w + 1) * (y + 0) + x + 0]; 94 const int a2 = ref[(w + 1) * (y + 0) + x + 1]; 95 const int b1 = ref[(w + 1) * (y + 1) + x + 0]; 96 const int b2 = ref[(w + 1) * (y + 1) + x + 1]; 97 const int a = a1 + (((a2 - a1) * xoff + 8) >> 4); 98 const int b = b1 + (((b2 - b1) * xoff + 8) >> 4); 99 const int r = a + (((b - a) * yoff + 8) >> 4); 100 int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x]; 101 se += diff; 102 sse += diff * diff; 103 } 104 } 105 *sse_ptr = sse; 106 return sse - (((int64_t) se * se) >> (l2w + l2h)); 107 } 108 109 template<typename VarianceFunctionType> 110 class VarianceTest 111 : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > { 112 public: 113 virtual void SetUp() { 114 const tuple<int, int, VarianceFunctionType>& params = this->GetParam(); 115 log2width_ = get<0>(params); 116 width_ = 1 << log2width_; 117 log2height_ = get<1>(params); 118 height_ = 1 << log2height_; 119 variance_ = get<2>(params); 120 121 rnd(ACMRandom::DeterministicSeed()); 122 block_size_ = width_ * height_; 123 src_ = new uint8_t[block_size_]; 124 ref_ = new uint8_t[block_size_]; 125 ASSERT_TRUE(src_ != NULL); 126 ASSERT_TRUE(ref_ != NULL); 127 } 128 129 virtual void TearDown() { 130 delete[] src_; 131 delete[] ref_; 132 libvpx_test::ClearSystemState(); 133 } 134 135 protected: 136 void ZeroTest(); 137 void RefTest(); 138 void OneQuarterTest(); 139 140 ACMRandom rnd; 141 uint8_t* src_; 142 uint8_t* ref_; 143 int width_, log2width_; 144 int height_, log2height_; 145 int block_size_; 146 VarianceFunctionType variance_; 147 }; 148 149 template<typename VarianceFunctionType> 150 void VarianceTest<VarianceFunctionType>::ZeroTest() { 151 for (int i = 0; i <= 255; ++i) { 152 memset(src_, i, block_size_); 153 for (int j = 0; j <= 255; ++j) { 154 memset(ref_, j, block_size_); 155 unsigned int sse; 156 unsigned int var; 157 REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); 158 EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j; 159 } 160 } 161 } 162 163 template<typename VarianceFunctionType> 164 void VarianceTest<VarianceFunctionType>::RefTest() { 165 for (int i = 0; i < 10; ++i) { 166 for (int j = 0; j < block_size_; j++) { 167 src_[j] = rnd.Rand8(); 168 ref_[j] = rnd.Rand8(); 169 } 170 unsigned int sse1, sse2; 171 unsigned int var1; 172 REGISTER_STATE_CHECK(var1 = variance_(src_, width_, ref_, width_, &sse1)); 173 const unsigned int var2 = variance_ref(src_, ref_, log2width_, 174 log2height_, &sse2); 175 EXPECT_EQ(sse1, sse2); 176 EXPECT_EQ(var1, var2); 177 } 178 } 179 180 template<typename VarianceFunctionType> 181 void VarianceTest<VarianceFunctionType>::OneQuarterTest() { 182 memset(src_, 255, block_size_); 183 const int half = block_size_ / 2; 184 memset(ref_, 255, half); 185 memset(ref_ + half, 0, half); 186 unsigned int sse; 187 unsigned int var; 188 REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); 189 const unsigned int expected = block_size_ * 255 * 255 / 4; 190 EXPECT_EQ(expected, var); 191 } 192 193 template<typename SubpelVarianceFunctionType> 194 class SubpelVarianceTest 195 : public ::testing::TestWithParam<tuple<int, int, 196 SubpelVarianceFunctionType> > { 197 public: 198 virtual void SetUp() { 199 const tuple<int, int, SubpelVarianceFunctionType>& params = 200 this->GetParam(); 201 log2width_ = get<0>(params); 202 width_ = 1 << log2width_; 203 log2height_ = get<1>(params); 204 height_ = 1 << log2height_; 205 subpel_variance_ = get<2>(params); 206 207 rnd(ACMRandom::DeterministicSeed()); 208 block_size_ = width_ * height_; 209 src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_)); 210 sec_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size_)); 211 ref_ = new uint8_t[block_size_ + width_ + height_ + 1]; 212 ASSERT_TRUE(src_ != NULL); 213 ASSERT_TRUE(sec_ != NULL); 214 ASSERT_TRUE(ref_ != NULL); 215 } 216 217 virtual void TearDown() { 218 vpx_free(src_); 219 delete[] ref_; 220 vpx_free(sec_); 221 libvpx_test::ClearSystemState(); 222 } 223 224 protected: 225 void RefTest(); 226 227 ACMRandom rnd; 228 uint8_t *src_; 229 uint8_t *ref_; 230 uint8_t *sec_; 231 int width_, log2width_; 232 int height_, log2height_; 233 int block_size_; 234 SubpelVarianceFunctionType subpel_variance_; 235 }; 236 237 template<typename SubpelVarianceFunctionType> 238 void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() { 239 for (int x = 0; x < 16; ++x) { 240 for (int y = 0; y < 16; ++y) { 241 for (int j = 0; j < block_size_; j++) { 242 src_[j] = rnd.Rand8(); 243 } 244 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) { 245 ref_[j] = rnd.Rand8(); 246 } 247 unsigned int sse1, sse2; 248 unsigned int var1; 249 REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y, 250 src_, width_, &sse1)); 251 const unsigned int var2 = subpel_variance_ref(ref_, src_, log2width_, 252 log2height_, x, y, &sse2); 253 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; 254 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; 255 } 256 } 257 } 258 259 template<> 260 void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() { 261 for (int x = 0; x < 16; ++x) { 262 for (int y = 0; y < 16; ++y) { 263 for (int j = 0; j < block_size_; j++) { 264 src_[j] = rnd.Rand8(); 265 sec_[j] = rnd.Rand8(); 266 } 267 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) { 268 ref_[j] = rnd.Rand8(); 269 } 270 unsigned int sse1, sse2; 271 unsigned int var1; 272 REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y, 273 src_, width_, &sse1, sec_)); 274 const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_, 275 log2width_, log2height_, 276 x, y, &sse2); 277 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; 278 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; 279 } 280 } 281 } 282 283 // ----------------------------------------------------------------------------- 284 // VP8 test cases. 285 286 namespace vp8 { 287 288 #if CONFIG_VP8_ENCODER 289 typedef VarianceTest<vp8_variance_fn_t> VP8VarianceTest; 290 291 TEST_P(VP8VarianceTest, Zero) { ZeroTest(); } 292 TEST_P(VP8VarianceTest, Ref) { RefTest(); } 293 TEST_P(VP8VarianceTest, OneQuarter) { OneQuarterTest(); } 294 295 const vp8_variance_fn_t variance4x4_c = vp8_variance4x4_c; 296 const vp8_variance_fn_t variance8x8_c = vp8_variance8x8_c; 297 const vp8_variance_fn_t variance8x16_c = vp8_variance8x16_c; 298 const vp8_variance_fn_t variance16x8_c = vp8_variance16x8_c; 299 const vp8_variance_fn_t variance16x16_c = vp8_variance16x16_c; 300 INSTANTIATE_TEST_CASE_P( 301 C, VP8VarianceTest, 302 ::testing::Values(make_tuple(2, 2, variance4x4_c), 303 make_tuple(3, 3, variance8x8_c), 304 make_tuple(3, 4, variance8x16_c), 305 make_tuple(4, 3, variance16x8_c), 306 make_tuple(4, 4, variance16x16_c))); 307 308 #if HAVE_MMX 309 const vp8_variance_fn_t variance4x4_mmx = vp8_variance4x4_mmx; 310 const vp8_variance_fn_t variance8x8_mmx = vp8_variance8x8_mmx; 311 const vp8_variance_fn_t variance8x16_mmx = vp8_variance8x16_mmx; 312 const vp8_variance_fn_t variance16x8_mmx = vp8_variance16x8_mmx; 313 const vp8_variance_fn_t variance16x16_mmx = vp8_variance16x16_mmx; 314 INSTANTIATE_TEST_CASE_P( 315 MMX, VP8VarianceTest, 316 ::testing::Values(make_tuple(2, 2, variance4x4_mmx), 317 make_tuple(3, 3, variance8x8_mmx), 318 make_tuple(3, 4, variance8x16_mmx), 319 make_tuple(4, 3, variance16x8_mmx), 320 make_tuple(4, 4, variance16x16_mmx))); 321 #endif 322 323 #if HAVE_SSE2 324 const vp8_variance_fn_t variance4x4_wmt = vp8_variance4x4_wmt; 325 const vp8_variance_fn_t variance8x8_wmt = vp8_variance8x8_wmt; 326 const vp8_variance_fn_t variance8x16_wmt = vp8_variance8x16_wmt; 327 const vp8_variance_fn_t variance16x8_wmt = vp8_variance16x8_wmt; 328 const vp8_variance_fn_t variance16x16_wmt = vp8_variance16x16_wmt; 329 INSTANTIATE_TEST_CASE_P( 330 SSE2, VP8VarianceTest, 331 ::testing::Values(make_tuple(2, 2, variance4x4_wmt), 332 make_tuple(3, 3, variance8x8_wmt), 333 make_tuple(3, 4, variance8x16_wmt), 334 make_tuple(4, 3, variance16x8_wmt), 335 make_tuple(4, 4, variance16x16_wmt))); 336 #endif 337 #endif // CONFIG_VP8_ENCODER 338 339 } // namespace vp8 340 341 // ----------------------------------------------------------------------------- 342 // VP9 test cases. 343 344 namespace vp9 { 345 346 #if CONFIG_VP9_ENCODER 347 typedef VarianceTest<vp9_variance_fn_t> VP9VarianceTest; 348 typedef SubpelVarianceTest<vp9_subpixvariance_fn_t> VP9SubpelVarianceTest; 349 typedef SubpelVarianceTest<vp9_subp_avg_variance_fn_t> VP9SubpelAvgVarianceTest; 350 351 TEST_P(VP9VarianceTest, Zero) { ZeroTest(); } 352 TEST_P(VP9VarianceTest, Ref) { RefTest(); } 353 TEST_P(VP9SubpelVarianceTest, Ref) { RefTest(); } 354 TEST_P(VP9SubpelAvgVarianceTest, Ref) { RefTest(); } 355 TEST_P(VP9VarianceTest, OneQuarter) { OneQuarterTest(); } 356 357 const vp9_variance_fn_t variance4x4_c = vp9_variance4x4_c; 358 const vp9_variance_fn_t variance4x8_c = vp9_variance4x8_c; 359 const vp9_variance_fn_t variance8x4_c = vp9_variance8x4_c; 360 const vp9_variance_fn_t variance8x8_c = vp9_variance8x8_c; 361 const vp9_variance_fn_t variance8x16_c = vp9_variance8x16_c; 362 const vp9_variance_fn_t variance16x8_c = vp9_variance16x8_c; 363 const vp9_variance_fn_t variance16x16_c = vp9_variance16x16_c; 364 const vp9_variance_fn_t variance16x32_c = vp9_variance16x32_c; 365 const vp9_variance_fn_t variance32x16_c = vp9_variance32x16_c; 366 const vp9_variance_fn_t variance32x32_c = vp9_variance32x32_c; 367 const vp9_variance_fn_t variance32x64_c = vp9_variance32x64_c; 368 const vp9_variance_fn_t variance64x32_c = vp9_variance64x32_c; 369 const vp9_variance_fn_t variance64x64_c = vp9_variance64x64_c; 370 INSTANTIATE_TEST_CASE_P( 371 C, VP9VarianceTest, 372 ::testing::Values(make_tuple(2, 2, variance4x4_c), 373 make_tuple(2, 3, variance4x8_c), 374 make_tuple(3, 2, variance8x4_c), 375 make_tuple(3, 3, variance8x8_c), 376 make_tuple(3, 4, variance8x16_c), 377 make_tuple(4, 3, variance16x8_c), 378 make_tuple(4, 4, variance16x16_c), 379 make_tuple(4, 5, variance16x32_c), 380 make_tuple(5, 4, variance32x16_c), 381 make_tuple(5, 5, variance32x32_c), 382 make_tuple(5, 6, variance32x64_c), 383 make_tuple(6, 5, variance64x32_c), 384 make_tuple(6, 6, variance64x64_c))); 385 386 const vp9_subpixvariance_fn_t subpel_variance4x4_c = 387 vp9_sub_pixel_variance4x4_c; 388 const vp9_subpixvariance_fn_t subpel_variance4x8_c = 389 vp9_sub_pixel_variance4x8_c; 390 const vp9_subpixvariance_fn_t subpel_variance8x4_c = 391 vp9_sub_pixel_variance8x4_c; 392 const vp9_subpixvariance_fn_t subpel_variance8x8_c = 393 vp9_sub_pixel_variance8x8_c; 394 const vp9_subpixvariance_fn_t subpel_variance8x16_c = 395 vp9_sub_pixel_variance8x16_c; 396 const vp9_subpixvariance_fn_t subpel_variance16x8_c = 397 vp9_sub_pixel_variance16x8_c; 398 const vp9_subpixvariance_fn_t subpel_variance16x16_c = 399 vp9_sub_pixel_variance16x16_c; 400 const vp9_subpixvariance_fn_t subpel_variance16x32_c = 401 vp9_sub_pixel_variance16x32_c; 402 const vp9_subpixvariance_fn_t subpel_variance32x16_c = 403 vp9_sub_pixel_variance32x16_c; 404 const vp9_subpixvariance_fn_t subpel_variance32x32_c = 405 vp9_sub_pixel_variance32x32_c; 406 const vp9_subpixvariance_fn_t subpel_variance32x64_c = 407 vp9_sub_pixel_variance32x64_c; 408 const vp9_subpixvariance_fn_t subpel_variance64x32_c = 409 vp9_sub_pixel_variance64x32_c; 410 const vp9_subpixvariance_fn_t subpel_variance64x64_c = 411 vp9_sub_pixel_variance64x64_c; 412 INSTANTIATE_TEST_CASE_P( 413 C, VP9SubpelVarianceTest, 414 ::testing::Values(make_tuple(2, 2, subpel_variance4x4_c), 415 make_tuple(2, 3, subpel_variance4x8_c), 416 make_tuple(3, 2, subpel_variance8x4_c), 417 make_tuple(3, 3, subpel_variance8x8_c), 418 make_tuple(3, 4, subpel_variance8x16_c), 419 make_tuple(4, 3, subpel_variance16x8_c), 420 make_tuple(4, 4, subpel_variance16x16_c), 421 make_tuple(4, 5, subpel_variance16x32_c), 422 make_tuple(5, 4, subpel_variance32x16_c), 423 make_tuple(5, 5, subpel_variance32x32_c), 424 make_tuple(5, 6, subpel_variance32x64_c), 425 make_tuple(6, 5, subpel_variance64x32_c), 426 make_tuple(6, 6, subpel_variance64x64_c))); 427 428 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_c = 429 vp9_sub_pixel_avg_variance4x4_c; 430 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_c = 431 vp9_sub_pixel_avg_variance4x8_c; 432 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_c = 433 vp9_sub_pixel_avg_variance8x4_c; 434 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_c = 435 vp9_sub_pixel_avg_variance8x8_c; 436 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_c = 437 vp9_sub_pixel_avg_variance8x16_c; 438 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_c = 439 vp9_sub_pixel_avg_variance16x8_c; 440 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_c = 441 vp9_sub_pixel_avg_variance16x16_c; 442 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_c = 443 vp9_sub_pixel_avg_variance16x32_c; 444 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_c = 445 vp9_sub_pixel_avg_variance32x16_c; 446 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_c = 447 vp9_sub_pixel_avg_variance32x32_c; 448 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_c = 449 vp9_sub_pixel_avg_variance32x64_c; 450 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_c = 451 vp9_sub_pixel_avg_variance64x32_c; 452 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_c = 453 vp9_sub_pixel_avg_variance64x64_c; 454 INSTANTIATE_TEST_CASE_P( 455 C, VP9SubpelAvgVarianceTest, 456 ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_c), 457 make_tuple(2, 3, subpel_avg_variance4x8_c), 458 make_tuple(3, 2, subpel_avg_variance8x4_c), 459 make_tuple(3, 3, subpel_avg_variance8x8_c), 460 make_tuple(3, 4, subpel_avg_variance8x16_c), 461 make_tuple(4, 3, subpel_avg_variance16x8_c), 462 make_tuple(4, 4, subpel_avg_variance16x16_c), 463 make_tuple(4, 5, subpel_avg_variance16x32_c), 464 make_tuple(5, 4, subpel_avg_variance32x16_c), 465 make_tuple(5, 5, subpel_avg_variance32x32_c), 466 make_tuple(5, 6, subpel_avg_variance32x64_c), 467 make_tuple(6, 5, subpel_avg_variance64x32_c), 468 make_tuple(6, 6, subpel_avg_variance64x64_c))); 469 470 #if HAVE_MMX 471 const vp9_variance_fn_t variance4x4_mmx = vp9_variance4x4_mmx; 472 const vp9_variance_fn_t variance8x8_mmx = vp9_variance8x8_mmx; 473 const vp9_variance_fn_t variance8x16_mmx = vp9_variance8x16_mmx; 474 const vp9_variance_fn_t variance16x8_mmx = vp9_variance16x8_mmx; 475 const vp9_variance_fn_t variance16x16_mmx = vp9_variance16x16_mmx; 476 INSTANTIATE_TEST_CASE_P( 477 MMX, VP9VarianceTest, 478 ::testing::Values(make_tuple(2, 2, variance4x4_mmx), 479 make_tuple(3, 3, variance8x8_mmx), 480 make_tuple(3, 4, variance8x16_mmx), 481 make_tuple(4, 3, variance16x8_mmx), 482 make_tuple(4, 4, variance16x16_mmx))); 483 #endif 484 485 #if HAVE_SSE2 486 #if CONFIG_USE_X86INC 487 const vp9_variance_fn_t variance4x4_sse2 = vp9_variance4x4_sse2; 488 const vp9_variance_fn_t variance4x8_sse2 = vp9_variance4x8_sse2; 489 const vp9_variance_fn_t variance8x4_sse2 = vp9_variance8x4_sse2; 490 const vp9_variance_fn_t variance8x8_sse2 = vp9_variance8x8_sse2; 491 const vp9_variance_fn_t variance8x16_sse2 = vp9_variance8x16_sse2; 492 const vp9_variance_fn_t variance16x8_sse2 = vp9_variance16x8_sse2; 493 const vp9_variance_fn_t variance16x16_sse2 = vp9_variance16x16_sse2; 494 const vp9_variance_fn_t variance16x32_sse2 = vp9_variance16x32_sse2; 495 const vp9_variance_fn_t variance32x16_sse2 = vp9_variance32x16_sse2; 496 const vp9_variance_fn_t variance32x32_sse2 = vp9_variance32x32_sse2; 497 const vp9_variance_fn_t variance32x64_sse2 = vp9_variance32x64_sse2; 498 const vp9_variance_fn_t variance64x32_sse2 = vp9_variance64x32_sse2; 499 const vp9_variance_fn_t variance64x64_sse2 = vp9_variance64x64_sse2; 500 INSTANTIATE_TEST_CASE_P( 501 SSE2, VP9VarianceTest, 502 ::testing::Values(make_tuple(2, 2, variance4x4_sse2), 503 make_tuple(2, 3, variance4x8_sse2), 504 make_tuple(3, 2, variance8x4_sse2), 505 make_tuple(3, 3, variance8x8_sse2), 506 make_tuple(3, 4, variance8x16_sse2), 507 make_tuple(4, 3, variance16x8_sse2), 508 make_tuple(4, 4, variance16x16_sse2), 509 make_tuple(4, 5, variance16x32_sse2), 510 make_tuple(5, 4, variance32x16_sse2), 511 make_tuple(5, 5, variance32x32_sse2), 512 make_tuple(5, 6, variance32x64_sse2), 513 make_tuple(6, 5, variance64x32_sse2), 514 make_tuple(6, 6, variance64x64_sse2))); 515 516 const vp9_subpixvariance_fn_t subpel_variance4x4_sse = 517 vp9_sub_pixel_variance4x4_sse; 518 const vp9_subpixvariance_fn_t subpel_variance4x8_sse = 519 vp9_sub_pixel_variance4x8_sse; 520 const vp9_subpixvariance_fn_t subpel_variance8x4_sse2 = 521 vp9_sub_pixel_variance8x4_sse2; 522 const vp9_subpixvariance_fn_t subpel_variance8x8_sse2 = 523 vp9_sub_pixel_variance8x8_sse2; 524 const vp9_subpixvariance_fn_t subpel_variance8x16_sse2 = 525 vp9_sub_pixel_variance8x16_sse2; 526 const vp9_subpixvariance_fn_t subpel_variance16x8_sse2 = 527 vp9_sub_pixel_variance16x8_sse2; 528 const vp9_subpixvariance_fn_t subpel_variance16x16_sse2 = 529 vp9_sub_pixel_variance16x16_sse2; 530 const vp9_subpixvariance_fn_t subpel_variance16x32_sse2 = 531 vp9_sub_pixel_variance16x32_sse2; 532 const vp9_subpixvariance_fn_t subpel_variance32x16_sse2 = 533 vp9_sub_pixel_variance32x16_sse2; 534 const vp9_subpixvariance_fn_t subpel_variance32x32_sse2 = 535 vp9_sub_pixel_variance32x32_sse2; 536 const vp9_subpixvariance_fn_t subpel_variance32x64_sse2 = 537 vp9_sub_pixel_variance32x64_sse2; 538 const vp9_subpixvariance_fn_t subpel_variance64x32_sse2 = 539 vp9_sub_pixel_variance64x32_sse2; 540 const vp9_subpixvariance_fn_t subpel_variance64x64_sse2 = 541 vp9_sub_pixel_variance64x64_sse2; 542 INSTANTIATE_TEST_CASE_P( 543 SSE2, VP9SubpelVarianceTest, 544 ::testing::Values(make_tuple(2, 2, subpel_variance4x4_sse), 545 make_tuple(2, 3, subpel_variance4x8_sse), 546 make_tuple(3, 2, subpel_variance8x4_sse2), 547 make_tuple(3, 3, subpel_variance8x8_sse2), 548 make_tuple(3, 4, subpel_variance8x16_sse2), 549 make_tuple(4, 3, subpel_variance16x8_sse2), 550 make_tuple(4, 4, subpel_variance16x16_sse2), 551 make_tuple(4, 5, subpel_variance16x32_sse2), 552 make_tuple(5, 4, subpel_variance32x16_sse2), 553 make_tuple(5, 5, subpel_variance32x32_sse2), 554 make_tuple(5, 6, subpel_variance32x64_sse2), 555 make_tuple(6, 5, subpel_variance64x32_sse2), 556 make_tuple(6, 6, subpel_variance64x64_sse2))); 557 558 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_sse = 559 vp9_sub_pixel_avg_variance4x4_sse; 560 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_sse = 561 vp9_sub_pixel_avg_variance4x8_sse; 562 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_sse2 = 563 vp9_sub_pixel_avg_variance8x4_sse2; 564 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_sse2 = 565 vp9_sub_pixel_avg_variance8x8_sse2; 566 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_sse2 = 567 vp9_sub_pixel_avg_variance8x16_sse2; 568 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_sse2 = 569 vp9_sub_pixel_avg_variance16x8_sse2; 570 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_sse2 = 571 vp9_sub_pixel_avg_variance16x16_sse2; 572 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_sse2 = 573 vp9_sub_pixel_avg_variance16x32_sse2; 574 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_sse2 = 575 vp9_sub_pixel_avg_variance32x16_sse2; 576 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_sse2 = 577 vp9_sub_pixel_avg_variance32x32_sse2; 578 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_sse2 = 579 vp9_sub_pixel_avg_variance32x64_sse2; 580 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_sse2 = 581 vp9_sub_pixel_avg_variance64x32_sse2; 582 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_sse2 = 583 vp9_sub_pixel_avg_variance64x64_sse2; 584 INSTANTIATE_TEST_CASE_P( 585 SSE2, VP9SubpelAvgVarianceTest, 586 ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_sse), 587 make_tuple(2, 3, subpel_avg_variance4x8_sse), 588 make_tuple(3, 2, subpel_avg_variance8x4_sse2), 589 make_tuple(3, 3, subpel_avg_variance8x8_sse2), 590 make_tuple(3, 4, subpel_avg_variance8x16_sse2), 591 make_tuple(4, 3, subpel_avg_variance16x8_sse2), 592 make_tuple(4, 4, subpel_avg_variance16x16_sse2), 593 make_tuple(4, 5, subpel_avg_variance16x32_sse2), 594 make_tuple(5, 4, subpel_avg_variance32x16_sse2), 595 make_tuple(5, 5, subpel_avg_variance32x32_sse2), 596 make_tuple(5, 6, subpel_avg_variance32x64_sse2), 597 make_tuple(6, 5, subpel_avg_variance64x32_sse2), 598 make_tuple(6, 6, subpel_avg_variance64x64_sse2))); 599 #endif 600 #endif 601 602 #if HAVE_SSSE3 603 #if CONFIG_USE_X86INC 604 605 const vp9_subpixvariance_fn_t subpel_variance4x4_ssse3 = 606 vp9_sub_pixel_variance4x4_ssse3; 607 const vp9_subpixvariance_fn_t subpel_variance4x8_ssse3 = 608 vp9_sub_pixel_variance4x8_ssse3; 609 const vp9_subpixvariance_fn_t subpel_variance8x4_ssse3 = 610 vp9_sub_pixel_variance8x4_ssse3; 611 const vp9_subpixvariance_fn_t subpel_variance8x8_ssse3 = 612 vp9_sub_pixel_variance8x8_ssse3; 613 const vp9_subpixvariance_fn_t subpel_variance8x16_ssse3 = 614 vp9_sub_pixel_variance8x16_ssse3; 615 const vp9_subpixvariance_fn_t subpel_variance16x8_ssse3 = 616 vp9_sub_pixel_variance16x8_ssse3; 617 const vp9_subpixvariance_fn_t subpel_variance16x16_ssse3 = 618 vp9_sub_pixel_variance16x16_ssse3; 619 const vp9_subpixvariance_fn_t subpel_variance16x32_ssse3 = 620 vp9_sub_pixel_variance16x32_ssse3; 621 const vp9_subpixvariance_fn_t subpel_variance32x16_ssse3 = 622 vp9_sub_pixel_variance32x16_ssse3; 623 const vp9_subpixvariance_fn_t subpel_variance32x32_ssse3 = 624 vp9_sub_pixel_variance32x32_ssse3; 625 const vp9_subpixvariance_fn_t subpel_variance32x64_ssse3 = 626 vp9_sub_pixel_variance32x64_ssse3; 627 const vp9_subpixvariance_fn_t subpel_variance64x32_ssse3 = 628 vp9_sub_pixel_variance64x32_ssse3; 629 const vp9_subpixvariance_fn_t subpel_variance64x64_ssse3 = 630 vp9_sub_pixel_variance64x64_ssse3; 631 INSTANTIATE_TEST_CASE_P( 632 SSSE3, VP9SubpelVarianceTest, 633 ::testing::Values(make_tuple(2, 2, subpel_variance4x4_ssse3), 634 make_tuple(2, 3, subpel_variance4x8_ssse3), 635 make_tuple(3, 2, subpel_variance8x4_ssse3), 636 make_tuple(3, 3, subpel_variance8x8_ssse3), 637 make_tuple(3, 4, subpel_variance8x16_ssse3), 638 make_tuple(4, 3, subpel_variance16x8_ssse3), 639 make_tuple(4, 4, subpel_variance16x16_ssse3), 640 make_tuple(4, 5, subpel_variance16x32_ssse3), 641 make_tuple(5, 4, subpel_variance32x16_ssse3), 642 make_tuple(5, 5, subpel_variance32x32_ssse3), 643 make_tuple(5, 6, subpel_variance32x64_ssse3), 644 make_tuple(6, 5, subpel_variance64x32_ssse3), 645 make_tuple(6, 6, subpel_variance64x64_ssse3))); 646 647 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x4_ssse3 = 648 vp9_sub_pixel_avg_variance4x4_ssse3; 649 const vp9_subp_avg_variance_fn_t subpel_avg_variance4x8_ssse3 = 650 vp9_sub_pixel_avg_variance4x8_ssse3; 651 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x4_ssse3 = 652 vp9_sub_pixel_avg_variance8x4_ssse3; 653 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x8_ssse3 = 654 vp9_sub_pixel_avg_variance8x8_ssse3; 655 const vp9_subp_avg_variance_fn_t subpel_avg_variance8x16_ssse3 = 656 vp9_sub_pixel_avg_variance8x16_ssse3; 657 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x8_ssse3 = 658 vp9_sub_pixel_avg_variance16x8_ssse3; 659 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x16_ssse3 = 660 vp9_sub_pixel_avg_variance16x16_ssse3; 661 const vp9_subp_avg_variance_fn_t subpel_avg_variance16x32_ssse3 = 662 vp9_sub_pixel_avg_variance16x32_ssse3; 663 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x16_ssse3 = 664 vp9_sub_pixel_avg_variance32x16_ssse3; 665 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x32_ssse3 = 666 vp9_sub_pixel_avg_variance32x32_ssse3; 667 const vp9_subp_avg_variance_fn_t subpel_avg_variance32x64_ssse3 = 668 vp9_sub_pixel_avg_variance32x64_ssse3; 669 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x32_ssse3 = 670 vp9_sub_pixel_avg_variance64x32_ssse3; 671 const vp9_subp_avg_variance_fn_t subpel_avg_variance64x64_ssse3 = 672 vp9_sub_pixel_avg_variance64x64_ssse3; 673 INSTANTIATE_TEST_CASE_P( 674 SSSE3, VP9SubpelAvgVarianceTest, 675 ::testing::Values(make_tuple(2, 2, subpel_avg_variance4x4_ssse3), 676 make_tuple(2, 3, subpel_avg_variance4x8_ssse3), 677 make_tuple(3, 2, subpel_avg_variance8x4_ssse3), 678 make_tuple(3, 3, subpel_avg_variance8x8_ssse3), 679 make_tuple(3, 4, subpel_avg_variance8x16_ssse3), 680 make_tuple(4, 3, subpel_avg_variance16x8_ssse3), 681 make_tuple(4, 4, subpel_avg_variance16x16_ssse3), 682 make_tuple(4, 5, subpel_avg_variance16x32_ssse3), 683 make_tuple(5, 4, subpel_avg_variance32x16_ssse3), 684 make_tuple(5, 5, subpel_avg_variance32x32_ssse3), 685 make_tuple(5, 6, subpel_avg_variance32x64_ssse3), 686 make_tuple(6, 5, subpel_avg_variance64x32_ssse3), 687 make_tuple(6, 6, subpel_avg_variance64x64_ssse3))); 688 #endif 689 #endif 690 #endif // CONFIG_VP9_ENCODER 691 692 } // namespace vp9 693 694 } // namespace 695