| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/cpu.h" |
| 6 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "media/base/cpu_features.h" | |
| 10 #include "media/base/djb2.h" | 10 #include "media/base/djb2.h" |
| 11 #include "media/base/simd/convert_rgb_to_yuv.h" | 11 #include "media/base/simd/convert_rgb_to_yuv.h" |
| 12 #include "media/base/simd/convert_yuv_to_rgb.h" | 12 #include "media/base/simd/convert_yuv_to_rgb.h" |
| 13 #include "media/base/simd/filter_yuv.h" | 13 #include "media/base/simd/filter_yuv.h" |
| 14 #include "media/base/yuv_convert.h" | 14 #include "media/base/yuv_convert.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 | 17 |
| 18 // Size of raw image. | 18 // Size of raw image. |
| 19 static const int kSourceWidth = 640; | 19 static const int kSourceWidth = 640; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (next_sub_rect & 2) | 450 if (next_sub_rect & 2) |
| 451 sub_rect.set_y(sub_rect.y() + sub_rect.height() / 2); | 451 sub_rect.set_y(sub_rect.y() + sub_rect.height() / 2); |
| 452 sub_rect.set_width(sub_rect.width() / 2); | 452 sub_rect.set_width(sub_rect.width() / 2); |
| 453 sub_rect.set_height(sub_rect.height() / 2); | 453 sub_rect.set_height(sub_rect.height() / 2); |
| 454 next_sub_rect++; | 454 next_sub_rect++; |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 #if !defined(ARCH_CPU_ARM_FAMILY) | 458 #if !defined(ARCH_CPU_ARM_FAMILY) |
| 459 TEST(YUVConvertTest, RGB32ToYUV_SSE2_MatchReference) { | 459 TEST(YUVConvertTest, RGB32ToYUV_SSE2_MatchReference) { |
| 460 if (!media::hasSSE2()) { | 460 base::CPU cpu; |
| 461 if (!cpu.has_sse2()) { |
| 461 LOG(WARNING) << "System doesn't support SSE2, test not executed."; | 462 LOG(WARNING) << "System doesn't support SSE2, test not executed."; |
| 462 return; | 463 return; |
| 463 } | 464 } |
| 464 | 465 |
| 465 // Allocate all surfaces. | 466 // Allocate all surfaces. |
| 466 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 467 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 467 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); | 468 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); |
| 468 scoped_array<uint8> yuv_converted_bytes(new uint8[kYUV12Size]); | 469 scoped_array<uint8> yuv_converted_bytes(new uint8[kYUV12Size]); |
| 469 scoped_array<uint8> yuv_reference_bytes(new uint8[kYUV12Size]); | 470 scoped_array<uint8> yuv_reference_bytes(new uint8[kYUV12Size]); |
| 470 | 471 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (diff < 0) | 537 if (diff < 0) |
| 537 diff = -diff; | 538 diff = -diff; |
| 538 error += diff; | 539 error += diff; |
| 539 } | 540 } |
| 540 | 541 |
| 541 // Make sure there's no difference from the reference. | 542 // Make sure there's no difference from the reference. |
| 542 EXPECT_EQ(0, error); | 543 EXPECT_EQ(0, error); |
| 543 } | 544 } |
| 544 | 545 |
| 545 TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) { | 546 TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) { |
| 546 if (!media::hasMMX()) { | 547 base::CPU cpu; |
| 548 if (!cpu.has_mmx()) { |
| 547 LOG(WARNING) << "System not supported. Test skipped."; | 549 LOG(WARNING) << "System not supported. Test skipped."; |
| 548 return; | 550 return; |
| 549 } | 551 } |
| 550 | 552 |
| 551 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 553 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 552 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 554 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 553 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 555 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 554 ReadYV12Data(&yuv_bytes); | 556 ReadYV12Data(&yuv_bytes); |
| 555 | 557 |
| 556 const int kWidth = 167; | 558 const int kWidth = 167; |
| 557 ConvertYUVToRGB32Row_C(yuv_bytes.get(), | 559 ConvertYUVToRGB32Row_C(yuv_bytes.get(), |
| 558 yuv_bytes.get() + kSourceUOffset, | 560 yuv_bytes.get() + kSourceUOffset, |
| 559 yuv_bytes.get() + kSourceVOffset, | 561 yuv_bytes.get() + kSourceVOffset, |
| 560 rgb_bytes_reference.get(), | 562 rgb_bytes_reference.get(), |
| 561 kWidth); | 563 kWidth); |
| 562 ConvertYUVToRGB32Row_MMX(yuv_bytes.get(), | 564 ConvertYUVToRGB32Row_MMX(yuv_bytes.get(), |
| 563 yuv_bytes.get() + kSourceUOffset, | 565 yuv_bytes.get() + kSourceUOffset, |
| 564 yuv_bytes.get() + kSourceVOffset, | 566 yuv_bytes.get() + kSourceVOffset, |
| 565 rgb_bytes_converted.get(), | 567 rgb_bytes_converted.get(), |
| 566 kWidth); | 568 kWidth); |
| 567 media::EmptyRegisterState(); | 569 media::EmptyRegisterState(); |
| 568 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 570 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 569 rgb_bytes_converted.get(), | 571 rgb_bytes_converted.get(), |
| 570 kWidth * kBpp)); | 572 kWidth * kBpp)); |
| 571 } | 573 } |
| 572 | 574 |
| 573 TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { | 575 TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { |
| 574 if (!media::hasSSE()) { | 576 base::CPU cpu; |
| 577 if (!cpu.has_sse()) { |
| 575 LOG(WARNING) << "System not supported. Test skipped."; | 578 LOG(WARNING) << "System not supported. Test skipped."; |
| 576 return; | 579 return; |
| 577 } | 580 } |
| 578 | 581 |
| 579 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 582 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 580 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 583 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 581 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 584 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 582 ReadYV12Data(&yuv_bytes); | 585 ReadYV12Data(&yuv_bytes); |
| 583 | 586 |
| 584 const int kWidth = 167; | 587 const int kWidth = 167; |
| 585 ConvertYUVToRGB32Row_C(yuv_bytes.get(), | 588 ConvertYUVToRGB32Row_C(yuv_bytes.get(), |
| 586 yuv_bytes.get() + kSourceUOffset, | 589 yuv_bytes.get() + kSourceUOffset, |
| 587 yuv_bytes.get() + kSourceVOffset, | 590 yuv_bytes.get() + kSourceVOffset, |
| 588 rgb_bytes_reference.get(), | 591 rgb_bytes_reference.get(), |
| 589 kWidth); | 592 kWidth); |
| 590 ConvertYUVToRGB32Row_SSE(yuv_bytes.get(), | 593 ConvertYUVToRGB32Row_SSE(yuv_bytes.get(), |
| 591 yuv_bytes.get() + kSourceUOffset, | 594 yuv_bytes.get() + kSourceUOffset, |
| 592 yuv_bytes.get() + kSourceVOffset, | 595 yuv_bytes.get() + kSourceVOffset, |
| 593 rgb_bytes_converted.get(), | 596 rgb_bytes_converted.get(), |
| 594 kWidth); | 597 kWidth); |
| 595 media::EmptyRegisterState(); | 598 media::EmptyRegisterState(); |
| 596 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 599 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 597 rgb_bytes_converted.get(), | 600 rgb_bytes_converted.get(), |
| 598 kWidth * kBpp)); | 601 kWidth * kBpp)); |
| 599 } | 602 } |
| 600 | 603 |
| 601 TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { | 604 TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { |
| 602 if (!media::hasMMX()) { | 605 base::CPU cpu; |
| 606 if (!cpu.has_mmx()) { |
| 603 LOG(WARNING) << "System not supported. Test skipped."; | 607 LOG(WARNING) << "System not supported. Test skipped."; |
| 604 return; | 608 return; |
| 605 } | 609 } |
| 606 | 610 |
| 607 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 611 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 608 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 612 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 609 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 613 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 610 ReadYV12Data(&yuv_bytes); | 614 ReadYV12Data(&yuv_bytes); |
| 611 | 615 |
| 612 const int kWidth = 167; | 616 const int kWidth = 167; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 623 rgb_bytes_converted.get(), | 627 rgb_bytes_converted.get(), |
| 624 kWidth, | 628 kWidth, |
| 625 kSourceDx); | 629 kSourceDx); |
| 626 media::EmptyRegisterState(); | 630 media::EmptyRegisterState(); |
| 627 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 631 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 628 rgb_bytes_converted.get(), | 632 rgb_bytes_converted.get(), |
| 629 kWidth * kBpp)); | 633 kWidth * kBpp)); |
| 630 } | 634 } |
| 631 | 635 |
| 632 TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { | 636 TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { |
| 633 if (!media::hasSSE()) { | 637 base::CPU cpu; |
| 638 if (!cpu.has_sse()) { |
| 634 LOG(WARNING) << "System not supported. Test skipped."; | 639 LOG(WARNING) << "System not supported. Test skipped."; |
| 635 return; | 640 return; |
| 636 } | 641 } |
| 637 | 642 |
| 638 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 643 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 639 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 644 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 640 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 645 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 641 ReadYV12Data(&yuv_bytes); | 646 ReadYV12Data(&yuv_bytes); |
| 642 | 647 |
| 643 const int kWidth = 167; | 648 const int kWidth = 167; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 654 rgb_bytes_converted.get(), | 659 rgb_bytes_converted.get(), |
| 655 kWidth, | 660 kWidth, |
| 656 kSourceDx); | 661 kSourceDx); |
| 657 media::EmptyRegisterState(); | 662 media::EmptyRegisterState(); |
| 658 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 663 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 659 rgb_bytes_converted.get(), | 664 rgb_bytes_converted.get(), |
| 660 kWidth * kBpp)); | 665 kWidth * kBpp)); |
| 661 } | 666 } |
| 662 | 667 |
| 663 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) { | 668 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) { |
| 664 if (!media::hasMMX()) { | 669 base::CPU cpu; |
| 670 if (!cpu.has_mmx()) { |
| 665 LOG(WARNING) << "System not supported. Test skipped."; | 671 LOG(WARNING) << "System not supported. Test skipped."; |
| 666 return; | 672 return; |
| 667 } | 673 } |
| 668 | 674 |
| 669 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 675 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 670 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 676 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 671 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 677 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 672 ReadYV12Data(&yuv_bytes); | 678 ReadYV12Data(&yuv_bytes); |
| 673 | 679 |
| 674 const int kWidth = 167; | 680 const int kWidth = 167; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 685 rgb_bytes_converted.get(), | 691 rgb_bytes_converted.get(), |
| 686 kWidth, | 692 kWidth, |
| 687 kSourceDx); | 693 kSourceDx); |
| 688 media::EmptyRegisterState(); | 694 media::EmptyRegisterState(); |
| 689 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 695 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 690 rgb_bytes_converted.get(), | 696 rgb_bytes_converted.get(), |
| 691 kWidth * kBpp)); | 697 kWidth * kBpp)); |
| 692 } | 698 } |
| 693 | 699 |
| 694 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { | 700 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { |
| 695 if (!media::hasSSE()) { | 701 base::CPU cpu; |
| 702 if (!cpu.has_sse()) { |
| 696 LOG(WARNING) << "System not supported. Test skipped."; | 703 LOG(WARNING) << "System not supported. Test skipped."; |
| 697 return; | 704 return; |
| 698 } | 705 } |
| 699 | 706 |
| 700 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 707 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 701 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); | 708 scoped_array<uint8> rgb_bytes_reference(new uint8[kRGBSize]); |
| 702 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); | 709 scoped_array<uint8> rgb_bytes_converted(new uint8[kRGBSize]); |
| 703 ReadYV12Data(&yuv_bytes); | 710 ReadYV12Data(&yuv_bytes); |
| 704 | 711 |
| 705 const int kWidth = 167; | 712 const int kWidth = 167; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 731 | 738 |
| 732 media::FilterYUVRows_C(dst.get(), src.get(), src.get(), 1, 255); | 739 media::FilterYUVRows_C(dst.get(), src.get(), src.get(), 1, 255); |
| 733 | 740 |
| 734 EXPECT_EQ(255u, dst[0]); | 741 EXPECT_EQ(255u, dst[0]); |
| 735 for (int i = 1; i < 16; ++i) { | 742 for (int i = 1; i < 16; ++i) { |
| 736 EXPECT_EQ(0u, dst[i]) << " not equal at " << i; | 743 EXPECT_EQ(0u, dst[i]) << " not equal at " << i; |
| 737 } | 744 } |
| 738 } | 745 } |
| 739 | 746 |
| 740 TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) { | 747 TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) { |
| 741 if (!media::hasMMX()) { | 748 base::CPU cpu; |
| 749 if (!cpu.has_mmx()) { |
| 742 LOG(WARNING) << "System not supported. Test skipped."; | 750 LOG(WARNING) << "System not supported. Test skipped."; |
| 743 return; | 751 return; |
| 744 } | 752 } |
| 745 | 753 |
| 746 scoped_array<uint8> src(new uint8[16]); | 754 scoped_array<uint8> src(new uint8[16]); |
| 747 scoped_array<uint8> dst(new uint8[16]); | 755 scoped_array<uint8> dst(new uint8[16]); |
| 748 | 756 |
| 749 memset(src.get(), 0xff, 16); | 757 memset(src.get(), 0xff, 16); |
| 750 memset(dst.get(), 0, 16); | 758 memset(dst.get(), 0, 16); |
| 751 | 759 |
| 752 media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255); | 760 media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255); |
| 753 media::EmptyRegisterState(); | 761 media::EmptyRegisterState(); |
| 754 | 762 |
| 755 EXPECT_EQ(255u, dst[0]); | 763 EXPECT_EQ(255u, dst[0]); |
| 756 for (int i = 1; i < 16; ++i) { | 764 for (int i = 1; i < 16; ++i) { |
| 757 EXPECT_EQ(0u, dst[i]); | 765 EXPECT_EQ(0u, dst[i]); |
| 758 } | 766 } |
| 759 } | 767 } |
| 760 | 768 |
| 761 TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { | 769 TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { |
| 762 if (!media::hasSSE2()) { | 770 base::CPU cpu; |
| 771 if (!cpu.has_sse2()) { |
| 763 LOG(WARNING) << "System not supported. Test skipped."; | 772 LOG(WARNING) << "System not supported. Test skipped."; |
| 764 return; | 773 return; |
| 765 } | 774 } |
| 766 | 775 |
| 767 scoped_array<uint8> src(new uint8[16]); | 776 scoped_array<uint8> src(new uint8[16]); |
| 768 scoped_array<uint8> dst(new uint8[16]); | 777 scoped_array<uint8> dst(new uint8[16]); |
| 769 | 778 |
| 770 memset(src.get(), 0xff, 16); | 779 memset(src.get(), 0xff, 16); |
| 771 memset(dst.get(), 0, 16); | 780 memset(dst.get(), 0, 16); |
| 772 | 781 |
| 773 media::FilterYUVRows_SSE2(dst.get(), src.get(), src.get(), 1, 255); | 782 media::FilterYUVRows_SSE2(dst.get(), src.get(), src.get(), 1, 255); |
| 774 | 783 |
| 775 EXPECT_EQ(255u, dst[0]); | 784 EXPECT_EQ(255u, dst[0]); |
| 776 for (int i = 1; i < 16; ++i) { | 785 for (int i = 1; i < 16; ++i) { |
| 777 EXPECT_EQ(0u, dst[i]); | 786 EXPECT_EQ(0u, dst[i]); |
| 778 } | 787 } |
| 779 } | 788 } |
| 780 | 789 |
| 781 TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) { | 790 TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) { |
| 782 if (!media::hasMMX()) { | 791 base::CPU cpu; |
| 792 if (!cpu.has_mmx()) { |
| 783 LOG(WARNING) << "System not supported. Test skipped."; | 793 LOG(WARNING) << "System not supported. Test skipped."; |
| 784 return; | 794 return; |
| 785 } | 795 } |
| 786 | 796 |
| 787 const int kSize = 32; | 797 const int kSize = 32; |
| 788 scoped_array<uint8> src(new uint8[kSize]); | 798 scoped_array<uint8> src(new uint8[kSize]); |
| 789 scoped_array<uint8> dst_sample(new uint8[kSize]); | 799 scoped_array<uint8> dst_sample(new uint8[kSize]); |
| 790 scoped_array<uint8> dst(new uint8[kSize]); | 800 scoped_array<uint8> dst(new uint8[kSize]); |
| 791 | 801 |
| 792 memset(dst_sample.get(), 0, kSize); | 802 memset(dst_sample.get(), 0, kSize); |
| 793 memset(dst.get(), 0, kSize); | 803 memset(dst.get(), 0, kSize); |
| 794 for (int i = 0; i < kSize; ++i) | 804 for (int i = 0; i < kSize; ++i) |
| 795 src[i] = 100 + i; | 805 src[i] = 100 + i; |
| 796 | 806 |
| 797 media::FilterYUVRows_C(dst_sample.get(), | 807 media::FilterYUVRows_C(dst_sample.get(), |
| 798 src.get(), src.get(), 17, 128); | 808 src.get(), src.get(), 17, 128); |
| 799 | 809 |
| 800 // Generate an unaligned output address. | 810 // Generate an unaligned output address. |
| 801 uint8* dst_ptr = | 811 uint8* dst_ptr = |
| 802 reinterpret_cast<uint8*>( | 812 reinterpret_cast<uint8*>( |
| 803 (reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1); | 813 (reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1); |
| 804 media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128); | 814 media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128); |
| 805 media::EmptyRegisterState(); | 815 media::EmptyRegisterState(); |
| 806 | 816 |
| 807 EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17)); | 817 EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17)); |
| 808 } | 818 } |
| 809 | 819 |
| 810 TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { | 820 TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { |
| 811 if (!media::hasSSE2()) { | 821 base::CPU cpu; |
| 822 if (!cpu.has_sse2()) { |
| 812 LOG(WARNING) << "System not supported. Test skipped."; | 823 LOG(WARNING) << "System not supported. Test skipped."; |
| 813 return; | 824 return; |
| 814 } | 825 } |
| 815 | 826 |
| 816 const int kSize = 64; | 827 const int kSize = 64; |
| 817 scoped_array<uint8> src(new uint8[kSize]); | 828 scoped_array<uint8> src(new uint8[kSize]); |
| 818 scoped_array<uint8> dst_sample(new uint8[kSize]); | 829 scoped_array<uint8> dst_sample(new uint8[kSize]); |
| 819 scoped_array<uint8> dst(new uint8[kSize]); | 830 scoped_array<uint8> dst(new uint8[kSize]); |
| 820 | 831 |
| 821 memset(dst_sample.get(), 0, kSize); | 832 memset(dst_sample.get(), 0, kSize); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 kSourceDx); | 897 kSourceDx); |
| 887 media::EmptyRegisterState(); | 898 media::EmptyRegisterState(); |
| 888 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), | 899 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), |
| 889 rgb_bytes_converted.get(), | 900 rgb_bytes_converted.get(), |
| 890 kWidth * kBpp)); | 901 kWidth * kBpp)); |
| 891 } | 902 } |
| 892 | 903 |
| 893 #endif // defined(ARCH_CPU_X86_64) | 904 #endif // defined(ARCH_CPU_X86_64) |
| 894 | 905 |
| 895 #endif // defined(ARCH_CPU_X86_FAMILY) | 906 #endif // defined(ARCH_CPU_X86_FAMILY) |
| OLD | NEW |