Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Side by Side Diff: source/libvpx/test/convolve_test.cc

Issue 23600008: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/test/dct16x16_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 { 0, 0, 0, 0, 0, 0, 0, 128}, 449 { 0, 0, 0, 0, 0, 0, 0, 128},
450 { 0, 0, 0, 0, 0, 0, 128}, 450 { 0, 0, 0, 0, 0, 0, 128},
451 { 0, 0, 0, 0, 0, 128}, 451 { 0, 0, 0, 0, 0, 128},
452 { 0, 0, 0, 0, 128}, 452 { 0, 0, 0, 0, 128},
453 { 0, 0, 0, 128}, 453 { 0, 0, 0, 128},
454 { 0, 0, 128}, 454 { 0, 0, 128},
455 { 0, 128}, 455 { 0, 128},
456 { 128} 456 { 128}
457 }; 457 };
458 458
459 /* This test exercises the horizontal and vertical filter functions. */
459 TEST_P(ConvolveTest, ChangeFilterWorks) { 460 TEST_P(ConvolveTest, ChangeFilterWorks) {
460 uint8_t* const in = input(); 461 uint8_t* const in = input();
461 uint8_t* const out = output(); 462 uint8_t* const out = output();
463
464 /* Assume that the first input sample is at the 8/16th position. */
465 const int kInitialSubPelOffset = 8;
466
467 /* Filters are 8-tap, so the first filter tap will be applied to the pixel
468 * at position -3 with respect to the current filtering position. Since
469 * kInitialSubPelOffset is set to 8, we first select sub-pixel filter 8,
470 * which is non-zero only in the last tap. So, applying the filter at the
471 * current input position will result in an output equal to the pixel at
472 * offset +4 (-3 + 7) with respect to the current filtering position.
473 */
462 const int kPixelSelected = 4; 474 const int kPixelSelected = 4;
463 475
476 /* Assume that each output pixel requires us to step on by 17/16th pixels in
477 * the input.
478 */
479 const int kInputPixelStep = 17;
480
481 /* The filters are setup in such a way that the expected output produces
482 * sets of 8 identical output samples. As the filter position moves to the
483 * next 1/16th pixel position the only active (=128) filter tap moves one
484 * position to the left, resulting in the same input pixel being replicated
485 * in to the output for 8 consecutive samples. After each set of 8 positions
486 * the filters select a different input pixel. kFilterPeriodAdjust below
487 * computes which input pixel is written to the output for a specified
488 * x or y position.
489 */
490
491 /* Test the horizontal filter. */
464 REGISTER_STATE_CHECK(UUT_->h8_(in, kInputStride, out, kOutputStride, 492 REGISTER_STATE_CHECK(UUT_->h8_(in, kInputStride, out, kOutputStride,
465 kChangeFilters[8], 17, kChangeFilters[4], 16, 493 kChangeFilters[kInitialSubPelOffset],
466 Width(), Height())); 494 kInputPixelStep, NULL, 0, Width(), Height()));
467 495
468 for (int x = 0; x < Width(); ++x) { 496 for (int x = 0; x < Width(); ++x) {
469 const int kQ4StepAdjust = x >> 4;
470 const int kFilterPeriodAdjust = (x >> 3) << 3; 497 const int kFilterPeriodAdjust = (x >> 3) << 3;
471 const int ref_x = kQ4StepAdjust + kFilterPeriodAdjust + kPixelSelected; 498 const int ref_x =
472 ASSERT_EQ(in[ref_x], out[x]) << "x == " << x; 499 kPixelSelected + ((kInitialSubPelOffset
500 + kFilterPeriodAdjust * kInputPixelStep)
501 >> SUBPEL_BITS);
502 ASSERT_EQ(in[ref_x], out[x]) << "x == " << x << "width = " << Width();
473 } 503 }
474 504
505 /* Test the vertical filter. */
475 REGISTER_STATE_CHECK(UUT_->v8_(in, kInputStride, out, kOutputStride, 506 REGISTER_STATE_CHECK(UUT_->v8_(in, kInputStride, out, kOutputStride,
476 kChangeFilters[4], 16, kChangeFilters[8], 17, 507 NULL, 0, kChangeFilters[kInitialSubPelOffset],
477 Width(), Height())); 508 kInputPixelStep, Width(), Height()));
478 509
479 for (int y = 0; y < Height(); ++y) { 510 for (int y = 0; y < Height(); ++y) {
480 const int kQ4StepAdjust = y >> 4;
481 const int kFilterPeriodAdjust = (y >> 3) << 3; 511 const int kFilterPeriodAdjust = (y >> 3) << 3;
482 const int ref_y = kQ4StepAdjust + kFilterPeriodAdjust + kPixelSelected; 512 const int ref_y =
513 kPixelSelected + ((kInitialSubPelOffset
514 + kFilterPeriodAdjust * kInputPixelStep)
515 >> SUBPEL_BITS);
483 ASSERT_EQ(in[ref_y * kInputStride], out[y * kInputStride]) << "y == " << y; 516 ASSERT_EQ(in[ref_y * kInputStride], out[y * kInputStride]) << "y == " << y;
484 } 517 }
485 518
519 /* Test the horizontal and vertical filters in combination. */
486 REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride, 520 REGISTER_STATE_CHECK(UUT_->hv8_(in, kInputStride, out, kOutputStride,
487 kChangeFilters[8], 17, kChangeFilters[8], 17, 521 kChangeFilters[kInitialSubPelOffset],
522 kInputPixelStep,
523 kChangeFilters[kInitialSubPelOffset],
524 kInputPixelStep,
488 Width(), Height())); 525 Width(), Height()));
489 526
490 for (int y = 0; y < Height(); ++y) { 527 for (int y = 0; y < Height(); ++y) {
491 const int kQ4StepAdjustY = y >> 4;
492 const int kFilterPeriodAdjustY = (y >> 3) << 3; 528 const int kFilterPeriodAdjustY = (y >> 3) << 3;
493 const int ref_y = kQ4StepAdjustY + kFilterPeriodAdjustY + kPixelSelected; 529 const int ref_y =
530 kPixelSelected + ((kInitialSubPelOffset
531 + kFilterPeriodAdjustY * kInputPixelStep)
532 >> SUBPEL_BITS);
494 for (int x = 0; x < Width(); ++x) { 533 for (int x = 0; x < Width(); ++x) {
495 const int kQ4StepAdjustX = x >> 4;
496 const int kFilterPeriodAdjustX = (x >> 3) << 3; 534 const int kFilterPeriodAdjustX = (x >> 3) << 3;
497 const int ref_x = kQ4StepAdjustX + kFilterPeriodAdjustX + kPixelSelected; 535 const int ref_x =
536 kPixelSelected + ((kInitialSubPelOffset
537 + kFilterPeriodAdjustX * kInputPixelStep)
538 >> SUBPEL_BITS);
498 539
499 ASSERT_EQ(in[ref_y * kInputStride + ref_x], out[y * kOutputStride + x]) 540 ASSERT_EQ(in[ref_y * kInputStride + ref_x], out[y * kOutputStride + x])
500 << "x == " << x << ", y == " << y; 541 << "x == " << x << ", y == " << y;
501 } 542 }
502 } 543 }
503 } 544 }
504 545
505
506 using std::tr1::make_tuple; 546 using std::tr1::make_tuple;
507 547
508 const ConvolveFunctions convolve8_c( 548 const ConvolveFunctions convolve8_c(
509 vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c, 549 vp9_convolve8_horiz_c, vp9_convolve8_avg_horiz_c,
510 vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c, 550 vp9_convolve8_vert_c, vp9_convolve8_avg_vert_c,
511 vp9_convolve8_c, vp9_convolve8_avg_c); 551 vp9_convolve8_c, vp9_convolve8_avg_c);
512 552
513 INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values( 553 INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::Values(
514 make_tuple(4, 4, &convolve8_c), 554 make_tuple(4, 4, &convolve8_c),
515 make_tuple(8, 4, &convolve8_c), 555 make_tuple(8, 4, &convolve8_c),
516 make_tuple(4, 8, &convolve8_c), 556 make_tuple(4, 8, &convolve8_c),
517 make_tuple(8, 8, &convolve8_c), 557 make_tuple(8, 8, &convolve8_c),
518 make_tuple(16, 8, &convolve8_c), 558 make_tuple(16, 8, &convolve8_c),
519 make_tuple(8, 16, &convolve8_c), 559 make_tuple(8, 16, &convolve8_c),
520 make_tuple(16, 16, &convolve8_c), 560 make_tuple(16, 16, &convolve8_c),
521 make_tuple(32, 16, &convolve8_c), 561 make_tuple(32, 16, &convolve8_c),
522 make_tuple(16, 32, &convolve8_c), 562 make_tuple(16, 32, &convolve8_c),
523 make_tuple(32, 32, &convolve8_c), 563 make_tuple(32, 32, &convolve8_c),
524 make_tuple(64, 32, &convolve8_c), 564 make_tuple(64, 32, &convolve8_c),
525 make_tuple(32, 64, &convolve8_c), 565 make_tuple(32, 64, &convolve8_c),
526 make_tuple(64, 64, &convolve8_c))); 566 make_tuple(64, 64, &convolve8_c)));
527 567
528 #if HAVE_SSSE3 568 #if HAVE_SSSE3
529 const ConvolveFunctions convolve8_ssse3( 569 const ConvolveFunctions convolve8_ssse3(
530 vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_c, 570 vp9_convolve8_horiz_ssse3, vp9_convolve8_avg_horiz_ssse3,
531 vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_c, 571 vp9_convolve8_vert_ssse3, vp9_convolve8_avg_vert_ssse3,
532 vp9_convolve8_ssse3, vp9_convolve8_avg_c); 572 vp9_convolve8_ssse3, vp9_convolve8_avg_ssse3);
533 573
534 INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values( 574 INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, ::testing::Values(
535 make_tuple(4, 4, &convolve8_ssse3), 575 make_tuple(4, 4, &convolve8_ssse3),
536 make_tuple(8, 4, &convolve8_ssse3), 576 make_tuple(8, 4, &convolve8_ssse3),
537 make_tuple(4, 8, &convolve8_ssse3), 577 make_tuple(4, 8, &convolve8_ssse3),
538 make_tuple(8, 8, &convolve8_ssse3), 578 make_tuple(8, 8, &convolve8_ssse3),
539 make_tuple(16, 8, &convolve8_ssse3), 579 make_tuple(16, 8, &convolve8_ssse3),
540 make_tuple(8, 16, &convolve8_ssse3), 580 make_tuple(8, 16, &convolve8_ssse3),
541 make_tuple(16, 16, &convolve8_ssse3), 581 make_tuple(16, 16, &convolve8_ssse3),
542 make_tuple(32, 16, &convolve8_ssse3), 582 make_tuple(32, 16, &convolve8_ssse3),
(...skipping 19 matching lines...) Expand all
562 make_tuple(8, 16, &convolve8_neon), 602 make_tuple(8, 16, &convolve8_neon),
563 make_tuple(16, 16, &convolve8_neon), 603 make_tuple(16, 16, &convolve8_neon),
564 make_tuple(32, 16, &convolve8_neon), 604 make_tuple(32, 16, &convolve8_neon),
565 make_tuple(16, 32, &convolve8_neon), 605 make_tuple(16, 32, &convolve8_neon),
566 make_tuple(32, 32, &convolve8_neon), 606 make_tuple(32, 32, &convolve8_neon),
567 make_tuple(64, 32, &convolve8_neon), 607 make_tuple(64, 32, &convolve8_neon),
568 make_tuple(32, 64, &convolve8_neon), 608 make_tuple(32, 64, &convolve8_neon),
569 make_tuple(64, 64, &convolve8_neon))); 609 make_tuple(64, 64, &convolve8_neon)));
570 #endif 610 #endif
571 } // namespace 611 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/test/dct16x16_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698