| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 UUT_ = GET_PARAM(2); | 214 UUT_ = GET_PARAM(2); |
| 215 /* Set up guard blocks for an inner block centered in the outer block */ | 215 /* Set up guard blocks for an inner block centered in the outer block */ |
| 216 for (int i = 0; i < kOutputBufferSize; ++i) { | 216 for (int i = 0; i < kOutputBufferSize; ++i) { |
| 217 if (IsIndexInBorder(i)) | 217 if (IsIndexInBorder(i)) |
| 218 output_[i] = 255; | 218 output_[i] = 255; |
| 219 else | 219 else |
| 220 output_[i] = 0; | 220 output_[i] = 0; |
| 221 } | 221 } |
| 222 | 222 |
| 223 ::libvpx_test::ACMRandom prng; | 223 ::libvpx_test::ACMRandom prng; |
| 224 for (int i = 0; i < kInputBufferSize; ++i) | 224 for (int i = 0; i < kInputBufferSize; ++i) { |
| 225 input_[i] = prng.Rand8Extremes(); | 225 if (i & 1) |
| 226 input_[i] = 255; |
| 227 else |
| 228 input_[i] = prng.Rand8Extremes(); |
| 229 } |
| 226 } | 230 } |
| 227 | 231 |
| 228 void SetConstantInput(int value) { | 232 void SetConstantInput(int value) { |
| 229 memset(input_, value, kInputBufferSize); | 233 memset(input_, value, kInputBufferSize); |
| 230 } | 234 } |
| 231 | 235 |
| 232 void CheckGuardBlocks() { | 236 void CheckGuardBlocks() { |
| 233 for (int i = 0; i < kOutputBufferSize; ++i) { | 237 for (int i = 0; i < kOutputBufferSize; ++i) { |
| 234 if (IsIndexInBorder(i)) | 238 if (IsIndexInBorder(i)) |
| 235 EXPECT_EQ(255, output_[i]); | 239 EXPECT_EQ(255, output_[i]); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 338 |
| 335 TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { | 339 TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { |
| 336 uint8_t* const in = input(); | 340 uint8_t* const in = input(); |
| 337 uint8_t* const out = output(); | 341 uint8_t* const out = output(); |
| 338 uint8_t ref[kOutputStride * kMaxDimension]; | 342 uint8_t ref[kOutputStride * kMaxDimension]; |
| 339 | 343 |
| 340 | 344 |
| 341 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { | 345 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { |
| 342 const InterpKernel *filters = | 346 const InterpKernel *filters = |
| 343 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); | 347 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); |
| 348 const InterpKernel *const eighttap_smooth = |
| 349 vp9_get_interp_kernel(EIGHTTAP_SMOOTH); |
| 350 |
| 344 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { | 351 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { |
| 345 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { | 352 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { |
| 346 filter_block2d_8_c(in, kInputStride, | 353 filter_block2d_8_c(in, kInputStride, |
| 347 filters[filter_x], filters[filter_y], | 354 filters[filter_x], filters[filter_y], |
| 348 ref, kOutputStride, | 355 ref, kOutputStride, |
| 349 Width(), Height()); | 356 Width(), Height()); |
| 350 | 357 |
| 351 if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y)) | 358 if (filters == eighttap_smooth || (filter_x && filter_y)) |
| 352 REGISTER_STATE_CHECK( | 359 REGISTER_STATE_CHECK( |
| 353 UUT_->hv8_(in, kInputStride, out, kOutputStride, | 360 UUT_->hv8_(in, kInputStride, out, kOutputStride, |
| 354 filters[filter_x], 16, filters[filter_y], 16, | 361 filters[filter_x], 16, filters[filter_y], 16, |
| 355 Width(), Height())); | 362 Width(), Height())); |
| 356 else if (filter_y) | 363 else if (filter_y) |
| 357 REGISTER_STATE_CHECK( | 364 REGISTER_STATE_CHECK( |
| 358 UUT_->v8_(in, kInputStride, out, kOutputStride, | 365 UUT_->v8_(in, kInputStride, out, kOutputStride, |
| 359 kInvalidFilter, 16, filters[filter_y], 16, | 366 kInvalidFilter, 16, filters[filter_y], 16, |
| 360 Width(), Height())); | 367 Width(), Height())); |
| 361 else | 368 else |
| (...skipping 27 matching lines...) Expand all Loading... |
| 389 const uint8_t r = prng.Rand8Extremes(); | 396 const uint8_t r = prng.Rand8Extremes(); |
| 390 | 397 |
| 391 out[y * kOutputStride + x] = r; | 398 out[y * kOutputStride + x] = r; |
| 392 ref[y * kOutputStride + x] = r; | 399 ref[y * kOutputStride + x] = r; |
| 393 } | 400 } |
| 394 } | 401 } |
| 395 | 402 |
| 396 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { | 403 for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) { |
| 397 const InterpKernel *filters = | 404 const InterpKernel *filters = |
| 398 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); | 405 vp9_get_interp_kernel(static_cast<INTERP_FILTER>(filter_bank)); |
| 406 const InterpKernel *const eighttap_smooth = |
| 407 vp9_get_interp_kernel(EIGHTTAP_SMOOTH); |
| 399 | 408 |
| 400 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { | 409 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) { |
| 401 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { | 410 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) { |
| 402 filter_average_block2d_8_c(in, kInputStride, | 411 filter_average_block2d_8_c(in, kInputStride, |
| 403 filters[filter_x], filters[filter_y], | 412 filters[filter_x], filters[filter_y], |
| 404 ref, kOutputStride, | 413 ref, kOutputStride, |
| 405 Width(), Height()); | 414 Width(), Height()); |
| 406 | 415 |
| 407 if (filters == vp9_sub_pel_filters_8lp || (filter_x && filter_y)) | 416 if (filters == eighttap_smooth || (filter_x && filter_y)) |
| 408 REGISTER_STATE_CHECK( | 417 REGISTER_STATE_CHECK( |
| 409 UUT_->hv8_avg_(in, kInputStride, out, kOutputStride, | 418 UUT_->hv8_avg_(in, kInputStride, out, kOutputStride, |
| 410 filters[filter_x], 16, filters[filter_y], 16, | 419 filters[filter_x], 16, filters[filter_y], 16, |
| 411 Width(), Height())); | 420 Width(), Height())); |
| 412 else if (filter_y) | 421 else if (filter_y) |
| 413 REGISTER_STATE_CHECK( | 422 REGISTER_STATE_CHECK( |
| 414 UUT_->v8_avg_(in, kInputStride, out, kOutputStride, | 423 UUT_->v8_avg_(in, kInputStride, out, kOutputStride, |
| 415 filters[filter_x], 16, filters[filter_y], 16, | 424 filters[filter_x], 16, filters[filter_y], 16, |
| 416 Width(), Height())); | 425 Width(), Height())); |
| 417 else | 426 else |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 << "x == " << x << ", y == " << y; | 546 << "x == " << x << ", y == " << y; |
| 538 } | 547 } |
| 539 } | 548 } |
| 540 } | 549 } |
| 541 | 550 |
| 542 /* This test exercises that enough rows and columns are filtered with every | 551 /* This test exercises that enough rows and columns are filtered with every |
| 543 possible initial fractional positions and scaling steps. */ | 552 possible initial fractional positions and scaling steps. */ |
| 544 TEST_P(ConvolveTest, CheckScalingFiltering) { | 553 TEST_P(ConvolveTest, CheckScalingFiltering) { |
| 545 uint8_t* const in = input(); | 554 uint8_t* const in = input(); |
| 546 uint8_t* const out = output(); | 555 uint8_t* const out = output(); |
| 556 const InterpKernel *const eighttap = vp9_get_interp_kernel(EIGHTTAP); |
| 547 | 557 |
| 548 SetConstantInput(127); | 558 SetConstantInput(127); |
| 549 | 559 |
| 550 for (int frac = 0; frac < 16; ++frac) { | 560 for (int frac = 0; frac < 16; ++frac) { |
| 551 for (int step = 1; step <= 32; ++step) { | 561 for (int step = 1; step <= 32; ++step) { |
| 552 /* Test the horizontal and vertical filters in combination. */ | 562 /* Test the horizontal and vertical filters in combination. */ |
| 553 REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride, | 563 REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride, |
| 554 vp9_sub_pel_filters_8[frac], step, | 564 eighttap[frac], step, |
| 555 vp9_sub_pel_filters_8[frac], step, | 565 eighttap[frac], step, |
| 556 Width(), Height())); | 566 Width(), Height())); |
| 557 | 567 |
| 558 CheckGuardBlocks(); | 568 CheckGuardBlocks(); |
| 559 | 569 |
| 560 for (int y = 0; y < Height(); ++y) { | 570 for (int y = 0; y < Height(); ++y) { |
| 561 for (int x = 0; x < Width(); ++x) { | 571 for (int x = 0; x < Width(); ++x) { |
| 562 ASSERT_EQ(in[y * kInputStride + x], out[y * kOutputStride + x]) | 572 ASSERT_EQ(in[y * kInputStride + x], out[y * kOutputStride + x]) |
| 563 << "x == " << x << ", y == " << y | 573 << "x == " << x << ", y == " << y |
| 564 << ", frac == " << frac << ", step == " << step; | 574 << ", frac == " << frac << ", step == " << step; |
| 565 } | 575 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 make_tuple(8, 16, &convolve8_ssse3), | 637 make_tuple(8, 16, &convolve8_ssse3), |
| 628 make_tuple(16, 16, &convolve8_ssse3), | 638 make_tuple(16, 16, &convolve8_ssse3), |
| 629 make_tuple(32, 16, &convolve8_ssse3), | 639 make_tuple(32, 16, &convolve8_ssse3), |
| 630 make_tuple(16, 32, &convolve8_ssse3), | 640 make_tuple(16, 32, &convolve8_ssse3), |
| 631 make_tuple(32, 32, &convolve8_ssse3), | 641 make_tuple(32, 32, &convolve8_ssse3), |
| 632 make_tuple(64, 32, &convolve8_ssse3), | 642 make_tuple(64, 32, &convolve8_ssse3), |
| 633 make_tuple(32, 64, &convolve8_ssse3), | 643 make_tuple(32, 64, &convolve8_ssse3), |
| 634 make_tuple(64, 64, &convolve8_ssse3))); | 644 make_tuple(64, 64, &convolve8_ssse3))); |
| 635 #endif | 645 #endif |
| 636 | 646 |
| 647 #if HAVE_AVX2 |
| 648 // TODO(jzern): these prototypes can be removed after the avx2 versions are |
| 649 // reenabled in vp9_rtcd_defs.pl. |
| 650 extern "C" { |
| 651 void vp9_convolve8_vert_avx2(const uint8_t *src, ptrdiff_t src_stride, |
| 652 uint8_t *dst, ptrdiff_t dst_stride, |
| 653 const int16_t *filter_x, int x_step_q4, |
| 654 const int16_t *filter_y, int y_step_q4, |
| 655 int w, int h); |
| 656 void vp9_convolve8_horiz_avx2(const uint8_t *src, ptrdiff_t src_stride, |
| 657 uint8_t *dst, ptrdiff_t dst_stride, |
| 658 const int16_t *filter_x, int x_step_q4, |
| 659 const int16_t *filter_y, int y_step_q4, |
| 660 int w, int h); |
| 661 void vp9_convolve8_avx2(const uint8_t *src, ptrdiff_t src_stride, |
| 662 uint8_t *dst, ptrdiff_t dst_stride, |
| 663 const int16_t *filter_x, int x_step_q4, |
| 664 const int16_t *filter_y, int y_step_q4, |
| 665 int w, int h); |
| 666 } |
| 667 |
| 668 const ConvolveFunctions convolve8_avx2( |
| 669 vp9_convolve8_horiz_avx2, vp9_convolve8_avg_horiz_ssse3, |
| 670 vp9_convolve8_vert_avx2, vp9_convolve8_avg_vert_ssse3, |
| 671 vp9_convolve8_avx2, vp9_convolve8_avg_ssse3); |
| 672 |
| 673 INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, ::testing::Values( |
| 674 make_tuple(4, 4, &convolve8_avx2), |
| 675 make_tuple(8, 4, &convolve8_avx2), |
| 676 make_tuple(4, 8, &convolve8_avx2), |
| 677 make_tuple(8, 8, &convolve8_avx2), |
| 678 make_tuple(8, 16, &convolve8_avx2))); |
| 679 |
| 680 INSTANTIATE_TEST_CASE_P(DISABLED_AVX2, ConvolveTest, ::testing::Values( |
| 681 make_tuple(16, 8, &convolve8_avx2), |
| 682 make_tuple(16, 16, &convolve8_avx2), |
| 683 make_tuple(32, 16, &convolve8_avx2), |
| 684 make_tuple(16, 32, &convolve8_avx2), |
| 685 make_tuple(32, 32, &convolve8_avx2), |
| 686 make_tuple(64, 32, &convolve8_avx2), |
| 687 make_tuple(32, 64, &convolve8_avx2), |
| 688 make_tuple(64, 64, &convolve8_avx2))); |
| 689 #endif |
| 690 |
| 637 #if HAVE_NEON_ASM | 691 #if HAVE_NEON_ASM |
| 638 const ConvolveFunctions convolve8_neon( | 692 const ConvolveFunctions convolve8_neon( |
| 639 vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon, | 693 vp9_convolve8_horiz_neon, vp9_convolve8_avg_horiz_neon, |
| 640 vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon, | 694 vp9_convolve8_vert_neon, vp9_convolve8_avg_vert_neon, |
| 641 vp9_convolve8_neon, vp9_convolve8_avg_neon); | 695 vp9_convolve8_neon, vp9_convolve8_avg_neon); |
| 642 | 696 |
| 643 INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, ::testing::Values( | 697 INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, ::testing::Values( |
| 644 make_tuple(4, 4, &convolve8_neon), | 698 make_tuple(4, 4, &convolve8_neon), |
| 645 make_tuple(8, 4, &convolve8_neon), | 699 make_tuple(8, 4, &convolve8_neon), |
| 646 make_tuple(4, 8, &convolve8_neon), | 700 make_tuple(4, 8, &convolve8_neon), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 671 make_tuple(8, 16, &convolve8_dspr2), | 725 make_tuple(8, 16, &convolve8_dspr2), |
| 672 make_tuple(16, 16, &convolve8_dspr2), | 726 make_tuple(16, 16, &convolve8_dspr2), |
| 673 make_tuple(32, 16, &convolve8_dspr2), | 727 make_tuple(32, 16, &convolve8_dspr2), |
| 674 make_tuple(16, 32, &convolve8_dspr2), | 728 make_tuple(16, 32, &convolve8_dspr2), |
| 675 make_tuple(32, 32, &convolve8_dspr2), | 729 make_tuple(32, 32, &convolve8_dspr2), |
| 676 make_tuple(64, 32, &convolve8_dspr2), | 730 make_tuple(64, 32, &convolve8_dspr2), |
| 677 make_tuple(32, 64, &convolve8_dspr2), | 731 make_tuple(32, 64, &convolve8_dspr2), |
| 678 make_tuple(64, 64, &convolve8_dspr2))); | 732 make_tuple(64, 64, &convolve8_dspr2))); |
| 679 #endif | 733 #endif |
| 680 } // namespace | 734 } // namespace |
| OLD | NEW |