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

Side by Side Diff: media/base/yuv_convert_unittest.cc

Issue 12213029: Lift MEDIA_MMX_INTRINSICS_AVAILABLE definition to header and use it to condition media_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Completely exclude FilterYUVRows_MMX tests on win64 Created 7 years, 10 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 | « media/base/yuv_convert.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cpu.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "media/base/djb2.h" 10 #include "media/base/djb2.h"
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 memset(dst.get(), 0, 16); 768 memset(dst.get(), 0, 16);
769 769
770 media::FilterYUVRows_C(dst.get(), src.get(), src.get(), 1, 255); 770 media::FilterYUVRows_C(dst.get(), src.get(), src.get(), 1, 255);
771 771
772 EXPECT_EQ(255u, dst[0]); 772 EXPECT_EQ(255u, dst[0]);
773 for (int i = 1; i < 16; ++i) { 773 for (int i = 1; i < 16; ++i) {
774 EXPECT_EQ(0u, dst[i]) << " not equal at " << i; 774 EXPECT_EQ(0u, dst[i]) << " not equal at " << i;
775 } 775 }
776 } 776 }
777 777
778 #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
778 TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) { 779 TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) {
779 base::CPU cpu; 780 base::CPU cpu;
780 if (!cpu.has_mmx()) { 781 if (!cpu.has_mmx()) {
781 LOG(WARNING) << "System not supported. Test skipped."; 782 LOG(WARNING) << "System not supported. Test skipped.";
782 return; 783 return;
783 } 784 }
784 785
785 scoped_array<uint8> src(new uint8[16]); 786 scoped_array<uint8> src(new uint8[16]);
786 scoped_array<uint8> dst(new uint8[16]); 787 scoped_array<uint8> dst(new uint8[16]);
787 788
788 memset(src.get(), 0xff, 16); 789 memset(src.get(), 0xff, 16);
789 memset(dst.get(), 0, 16); 790 memset(dst.get(), 0, 16);
790 791
791 media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255); 792 media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255);
792 media::EmptyRegisterState(); 793 media::EmptyRegisterState();
793 794
794 EXPECT_EQ(255u, dst[0]); 795 EXPECT_EQ(255u, dst[0]);
795 for (int i = 1; i < 16; ++i) { 796 for (int i = 1; i < 16; ++i) {
796 EXPECT_EQ(0u, dst[i]); 797 EXPECT_EQ(0u, dst[i]);
797 } 798 }
798 } 799 }
800 #endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
799 801
800 TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { 802 TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) {
801 base::CPU cpu; 803 base::CPU cpu;
802 if (!cpu.has_sse2()) { 804 if (!cpu.has_sse2()) {
803 LOG(WARNING) << "System not supported. Test skipped."; 805 LOG(WARNING) << "System not supported. Test skipped.";
804 return; 806 return;
805 } 807 }
806 808
807 scoped_array<uint8> src(new uint8[16]); 809 scoped_array<uint8> src(new uint8[16]);
808 scoped_array<uint8> dst(new uint8[16]); 810 scoped_array<uint8> dst(new uint8[16]);
809 811
810 memset(src.get(), 0xff, 16); 812 memset(src.get(), 0xff, 16);
811 memset(dst.get(), 0, 16); 813 memset(dst.get(), 0, 16);
812 814
813 media::FilterYUVRows_SSE2(dst.get(), src.get(), src.get(), 1, 255); 815 media::FilterYUVRows_SSE2(dst.get(), src.get(), src.get(), 1, 255);
814 816
815 EXPECT_EQ(255u, dst[0]); 817 EXPECT_EQ(255u, dst[0]);
816 for (int i = 1; i < 16; ++i) { 818 for (int i = 1; i < 16; ++i) {
817 EXPECT_EQ(0u, dst[i]); 819 EXPECT_EQ(0u, dst[i]);
818 } 820 }
819 } 821 }
820 822
823 #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
821 TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) { 824 TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) {
822 base::CPU cpu; 825 base::CPU cpu;
823 if (!cpu.has_mmx()) { 826 if (!cpu.has_mmx()) {
824 LOG(WARNING) << "System not supported. Test skipped."; 827 LOG(WARNING) << "System not supported. Test skipped.";
825 return; 828 return;
826 } 829 }
827 830
828 const int kSize = 32; 831 const int kSize = 32;
829 scoped_array<uint8> src(new uint8[kSize]); 832 scoped_array<uint8> src(new uint8[kSize]);
830 scoped_array<uint8> dst_sample(new uint8[kSize]); 833 scoped_array<uint8> dst_sample(new uint8[kSize]);
831 scoped_array<uint8> dst(new uint8[kSize]); 834 scoped_array<uint8> dst(new uint8[kSize]);
832 835
833 memset(dst_sample.get(), 0, kSize); 836 memset(dst_sample.get(), 0, kSize);
834 memset(dst.get(), 0, kSize); 837 memset(dst.get(), 0, kSize);
835 for (int i = 0; i < kSize; ++i) 838 for (int i = 0; i < kSize; ++i)
836 src[i] = 100 + i; 839 src[i] = 100 + i;
837 840
838 media::FilterYUVRows_C(dst_sample.get(), 841 media::FilterYUVRows_C(dst_sample.get(),
839 src.get(), src.get(), 17, 128); 842 src.get(), src.get(), 17, 128);
840 843
841 // Generate an unaligned output address. 844 // Generate an unaligned output address.
842 uint8* dst_ptr = 845 uint8* dst_ptr =
843 reinterpret_cast<uint8*>( 846 reinterpret_cast<uint8*>(
844 (reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1); 847 (reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1);
845 media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128); 848 media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128);
846 media::EmptyRegisterState(); 849 media::EmptyRegisterState();
847 850
848 EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17)); 851 EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17));
849 } 852 }
853 #endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
850 854
851 TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { 855 TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) {
852 base::CPU cpu; 856 base::CPU cpu;
853 if (!cpu.has_sse2()) { 857 if (!cpu.has_sse2()) {
854 LOG(WARNING) << "System not supported. Test skipped."; 858 LOG(WARNING) << "System not supported. Test skipped.";
855 return; 859 return;
856 } 860 }
857 861
858 const int kSize = 64; 862 const int kSize = 64;
859 scoped_array<uint8> src(new uint8[kSize]); 863 scoped_array<uint8> src(new uint8[kSize]);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 kSourceDx); 932 kSourceDx);
929 media::EmptyRegisterState(); 933 media::EmptyRegisterState();
930 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 934 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
931 rgb_bytes_converted.get(), 935 rgb_bytes_converted.get(),
932 kWidth * kBpp)); 936 kWidth * kBpp));
933 } 937 }
934 938
935 #endif // defined(ARCH_CPU_X86_64) 939 #endif // defined(ARCH_CPU_X86_64)
936 940
937 #endif // defined(ARCH_CPU_X86_FAMILY) 941 #endif // defined(ARCH_CPU_X86_FAMILY)
OLDNEW
« no previous file with comments | « media/base/yuv_convert.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698