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

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

Issue 242643011: Add correct support for videos with YUVJ420P color format, in the software conversion path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yuvnopic
Patch Set: Created 6 years, 8 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
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"
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/simd/yuv_to_rgb_table.h"
14 #include "media/base/yuv_convert.h" 15 #include "media/base/yuv_convert.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
17 18
18 // Size of raw image. 19 // Size of raw image.
19 static const int kSourceWidth = 640; 20 static const int kSourceWidth = 640;
20 static const int kSourceHeight = 360; 21 static const int kSourceHeight = 360;
21 static const int kSourceYSize = kSourceWidth * kSourceHeight; 22 static const int kSourceYSize = kSourceWidth * kSourceHeight;
22 static const int kSourceUOffset = kSourceYSize; 23 static const int kSourceUOffset = kSourceYSize;
23 static const int kSourceVOffset = kSourceYSize * 5 / 4; 24 static const int kSourceVOffset = kSourceYSize * 5 / 4;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 media::YUVType yuv_type; 156 media::YUVType yuv_type;
156 media::ScaleFilter scale_filter; 157 media::ScaleFilter scale_filter;
157 uint32 rgb_hash; 158 uint32 rgb_hash;
158 }; 159 };
159 160
160 class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> { 161 class YUVScaleTest : public ::testing::TestWithParam<YUVScaleTestData> {
161 public: 162 public:
162 YUVScaleTest() { 163 YUVScaleTest() {
163 switch (GetParam().yuv_type) { 164 switch (GetParam().yuv_type) {
164 case media::YV12: 165 case media::YV12:
166 case media::YV12J:
165 ReadYV12Data(&yuv_bytes_); 167 ReadYV12Data(&yuv_bytes_);
166 break; 168 break;
167 case media::YV16: 169 case media::YV16:
168 ReadYV16Data(&yuv_bytes_); 170 ReadYV16Data(&yuv_bytes_);
169 break; 171 break;
170 } 172 }
171 173
172 rgb_bytes_.reset(new uint8[kRGBSizeScaled]); 174 rgb_bytes_.reset(new uint8[kRGBSizeScaled]);
173 } 175 }
174 176
175 // Helpers for getting the proper Y, U and V plane offsets. 177 // Helpers for getting the proper Y, U and V plane offsets.
176 uint8* y_plane() { return yuv_bytes_.get(); } 178 uint8* y_plane() { return yuv_bytes_.get(); }
177 uint8* u_plane() { return yuv_bytes_.get() + kSourceYSize; } 179 uint8* u_plane() { return yuv_bytes_.get() + kSourceYSize; }
178 uint8* v_plane() { 180 uint8* v_plane() {
179 switch (GetParam().yuv_type) { 181 switch (GetParam().yuv_type) {
180 case media::YV12: 182 case media::YV12:
183 case media::YV12J:
181 return yuv_bytes_.get() + kSourceVOffset; 184 return yuv_bytes_.get() + kSourceVOffset;
182 case media::YV16: 185 case media::YV16:
183 return yuv_bytes_.get() + kSourceYSize * 3 / 2; 186 return yuv_bytes_.get() + kSourceYSize * 3 / 2;
184 } 187 }
185 return NULL; 188 return NULL;
186 } 189 }
187 190
188 scoped_ptr<uint8[]> yuv_bytes_; 191 scoped_ptr<uint8[]> yuv_bytes_;
189 scoped_ptr<uint8[]> rgb_bytes_; 192 scoped_ptr<uint8[]> rgb_bytes_;
190 }; 193 };
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 614 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
612 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 615 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
613 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 616 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
614 ReadYV12Data(&yuv_bytes); 617 ReadYV12Data(&yuv_bytes);
615 618
616 const int kWidth = 167; 619 const int kWidth = 167;
617 ConvertYUVToRGB32Row_C(yuv_bytes.get(), 620 ConvertYUVToRGB32Row_C(yuv_bytes.get(),
618 yuv_bytes.get() + kSourceUOffset, 621 yuv_bytes.get() + kSourceUOffset,
619 yuv_bytes.get() + kSourceVOffset, 622 yuv_bytes.get() + kSourceVOffset,
620 rgb_bytes_reference.get(), 623 rgb_bytes_reference.get(),
621 kWidth); 624 kWidth,
625 kCoefficientsRgbY);
622 ConvertYUVToRGB32Row_MMX(yuv_bytes.get(), 626 ConvertYUVToRGB32Row_MMX(yuv_bytes.get(),
623 yuv_bytes.get() + kSourceUOffset, 627 yuv_bytes.get() + kSourceUOffset,
624 yuv_bytes.get() + kSourceVOffset, 628 yuv_bytes.get() + kSourceVOffset,
625 rgb_bytes_converted.get(), 629 rgb_bytes_converted.get(),
626 kWidth); 630 kWidth,
631 kCoefficientsRgbY);
627 media::EmptyRegisterState(); 632 media::EmptyRegisterState();
628 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 633 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
629 rgb_bytes_converted.get(), 634 rgb_bytes_converted.get(),
630 kWidth * kBpp)); 635 kWidth * kBpp));
631 } 636 }
632 637
633 TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { 638 TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) {
634 base::CPU cpu; 639 base::CPU cpu;
635 if (!cpu.has_sse()) { 640 if (!cpu.has_sse()) {
636 LOG(WARNING) << "System not supported. Test skipped."; 641 LOG(WARNING) << "System not supported. Test skipped.";
637 return; 642 return;
638 } 643 }
639 644
640 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 645 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
641 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 646 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
642 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 647 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
643 ReadYV12Data(&yuv_bytes); 648 ReadYV12Data(&yuv_bytes);
644 649
645 const int kWidth = 167; 650 const int kWidth = 167;
646 ConvertYUVToRGB32Row_C(yuv_bytes.get(), 651 ConvertYUVToRGB32Row_C(yuv_bytes.get(),
647 yuv_bytes.get() + kSourceUOffset, 652 yuv_bytes.get() + kSourceUOffset,
648 yuv_bytes.get() + kSourceVOffset, 653 yuv_bytes.get() + kSourceVOffset,
649 rgb_bytes_reference.get(), 654 rgb_bytes_reference.get(),
650 kWidth); 655 kWidth,
656 kCoefficientsRgbY);
651 ConvertYUVToRGB32Row_SSE(yuv_bytes.get(), 657 ConvertYUVToRGB32Row_SSE(yuv_bytes.get(),
652 yuv_bytes.get() + kSourceUOffset, 658 yuv_bytes.get() + kSourceUOffset,
653 yuv_bytes.get() + kSourceVOffset, 659 yuv_bytes.get() + kSourceVOffset,
654 rgb_bytes_converted.get(), 660 rgb_bytes_converted.get(),
655 kWidth); 661 kWidth,
662 kCoefficientsRgbY);
656 media::EmptyRegisterState(); 663 media::EmptyRegisterState();
657 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 664 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
658 rgb_bytes_converted.get(), 665 rgb_bytes_converted.get(),
659 kWidth * kBpp)); 666 kWidth * kBpp));
660 } 667 }
661 668
662 TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { 669 TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) {
663 base::CPU cpu; 670 base::CPU cpu;
664 if (!cpu.has_mmx()) { 671 if (!cpu.has_mmx()) {
665 LOG(WARNING) << "System not supported. Test skipped."; 672 LOG(WARNING) << "System not supported. Test skipped.";
666 return; 673 return;
667 } 674 }
668 675
669 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 676 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
670 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 677 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
671 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 678 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
672 ReadYV12Data(&yuv_bytes); 679 ReadYV12Data(&yuv_bytes);
673 680
674 const int kWidth = 167; 681 const int kWidth = 167;
675 const int kSourceDx = 80000; // This value means a scale down. 682 const int kSourceDx = 80000; // This value means a scale down.
676 ScaleYUVToRGB32Row_C(yuv_bytes.get(), 683 ScaleYUVToRGB32Row_C(yuv_bytes.get(),
677 yuv_bytes.get() + kSourceUOffset, 684 yuv_bytes.get() + kSourceUOffset,
678 yuv_bytes.get() + kSourceVOffset, 685 yuv_bytes.get() + kSourceVOffset,
679 rgb_bytes_reference.get(), 686 rgb_bytes_reference.get(),
680 kWidth, 687 kWidth,
681 kSourceDx); 688 kSourceDx,
689 kCoefficientsRgbY);
682 ScaleYUVToRGB32Row_MMX(yuv_bytes.get(), 690 ScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
683 yuv_bytes.get() + kSourceUOffset, 691 yuv_bytes.get() + kSourceUOffset,
684 yuv_bytes.get() + kSourceVOffset, 692 yuv_bytes.get() + kSourceVOffset,
685 rgb_bytes_converted.get(), 693 rgb_bytes_converted.get(),
686 kWidth, 694 kWidth,
687 kSourceDx); 695 kSourceDx,
696 kCoefficientsRgbY);
688 media::EmptyRegisterState(); 697 media::EmptyRegisterState();
689 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 698 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
690 rgb_bytes_converted.get(), 699 rgb_bytes_converted.get(),
691 kWidth * kBpp)); 700 kWidth * kBpp));
692 } 701 }
693 702
694 TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { 703 TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) {
695 base::CPU cpu; 704 base::CPU cpu;
696 if (!cpu.has_sse()) { 705 if (!cpu.has_sse()) {
697 LOG(WARNING) << "System not supported. Test skipped."; 706 LOG(WARNING) << "System not supported. Test skipped.";
698 return; 707 return;
699 } 708 }
700 709
701 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 710 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
702 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 711 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
703 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 712 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
704 ReadYV12Data(&yuv_bytes); 713 ReadYV12Data(&yuv_bytes);
705 714
706 const int kWidth = 167; 715 const int kWidth = 167;
707 const int kSourceDx = 80000; // This value means a scale down. 716 const int kSourceDx = 80000; // This value means a scale down.
708 ScaleYUVToRGB32Row_C(yuv_bytes.get(), 717 ScaleYUVToRGB32Row_C(yuv_bytes.get(),
709 yuv_bytes.get() + kSourceUOffset, 718 yuv_bytes.get() + kSourceUOffset,
710 yuv_bytes.get() + kSourceVOffset, 719 yuv_bytes.get() + kSourceVOffset,
711 rgb_bytes_reference.get(), 720 rgb_bytes_reference.get(),
712 kWidth, 721 kWidth,
713 kSourceDx); 722 kSourceDx,
723 kCoefficientsRgbY);
714 ScaleYUVToRGB32Row_SSE(yuv_bytes.get(), 724 ScaleYUVToRGB32Row_SSE(yuv_bytes.get(),
715 yuv_bytes.get() + kSourceUOffset, 725 yuv_bytes.get() + kSourceUOffset,
716 yuv_bytes.get() + kSourceVOffset, 726 yuv_bytes.get() + kSourceVOffset,
717 rgb_bytes_converted.get(), 727 rgb_bytes_converted.get(),
718 kWidth, 728 kWidth,
719 kSourceDx); 729 kSourceDx,
730 kCoefficientsRgbY);
720 media::EmptyRegisterState(); 731 media::EmptyRegisterState();
721 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 732 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
722 rgb_bytes_converted.get(), 733 rgb_bytes_converted.get(),
723 kWidth * kBpp)); 734 kWidth * kBpp));
724 } 735 }
725 736
726 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) { 737 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) {
727 base::CPU cpu; 738 base::CPU cpu;
728 if (!cpu.has_mmx()) { 739 if (!cpu.has_mmx()) {
729 LOG(WARNING) << "System not supported. Test skipped."; 740 LOG(WARNING) << "System not supported. Test skipped.";
730 return; 741 return;
731 } 742 }
732 743
733 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 744 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
734 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 745 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
735 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 746 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
736 ReadYV12Data(&yuv_bytes); 747 ReadYV12Data(&yuv_bytes);
737 748
738 const int kWidth = 167; 749 const int kWidth = 167;
739 const int kSourceDx = 80000; // This value means a scale down. 750 const int kSourceDx = 80000; // This value means a scale down.
740 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(), 751 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(),
741 yuv_bytes.get() + kSourceUOffset, 752 yuv_bytes.get() + kSourceUOffset,
742 yuv_bytes.get() + kSourceVOffset, 753 yuv_bytes.get() + kSourceVOffset,
743 rgb_bytes_reference.get(), 754 rgb_bytes_reference.get(),
744 kWidth, 755 kWidth,
745 kSourceDx); 756 kSourceDx,
757 kCoefficientsRgbY);
746 LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(), 758 LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
747 yuv_bytes.get() + kSourceUOffset, 759 yuv_bytes.get() + kSourceUOffset,
748 yuv_bytes.get() + kSourceVOffset, 760 yuv_bytes.get() + kSourceVOffset,
749 rgb_bytes_converted.get(), 761 rgb_bytes_converted.get(),
750 kWidth, 762 kWidth,
751 kSourceDx); 763 kSourceDx,
764 kCoefficientsRgbY);
752 media::EmptyRegisterState(); 765 media::EmptyRegisterState();
753 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 766 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
754 rgb_bytes_converted.get(), 767 rgb_bytes_converted.get(),
755 kWidth * kBpp)); 768 kWidth * kBpp));
756 } 769 }
757 770
758 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { 771 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) {
759 base::CPU cpu; 772 base::CPU cpu;
760 if (!cpu.has_sse()) { 773 if (!cpu.has_sse()) {
761 LOG(WARNING) << "System not supported. Test skipped."; 774 LOG(WARNING) << "System not supported. Test skipped.";
762 return; 775 return;
763 } 776 }
764 777
765 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 778 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
766 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 779 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
767 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 780 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
768 ReadYV12Data(&yuv_bytes); 781 ReadYV12Data(&yuv_bytes);
769 782
770 const int kWidth = 167; 783 const int kWidth = 167;
771 const int kSourceDx = 80000; // This value means a scale down. 784 const int kSourceDx = 80000; // This value means a scale down.
772 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(), 785 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(),
773 yuv_bytes.get() + kSourceUOffset, 786 yuv_bytes.get() + kSourceUOffset,
774 yuv_bytes.get() + kSourceVOffset, 787 yuv_bytes.get() + kSourceVOffset,
775 rgb_bytes_reference.get(), 788 rgb_bytes_reference.get(),
776 kWidth, 789 kWidth,
777 kSourceDx); 790 kSourceDx,
791 kCoefficientsRgbY);
778 LinearScaleYUVToRGB32Row_SSE(yuv_bytes.get(), 792 LinearScaleYUVToRGB32Row_SSE(yuv_bytes.get(),
779 yuv_bytes.get() + kSourceUOffset, 793 yuv_bytes.get() + kSourceUOffset,
780 yuv_bytes.get() + kSourceVOffset, 794 yuv_bytes.get() + kSourceVOffset,
781 rgb_bytes_converted.get(), 795 rgb_bytes_converted.get(),
782 kWidth, 796 kWidth,
783 kSourceDx); 797 kSourceDx,
798 kCoefficientsRgbY);
784 media::EmptyRegisterState(); 799 media::EmptyRegisterState();
785 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 800 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
786 rgb_bytes_converted.get(), 801 rgb_bytes_converted.get(),
787 kWidth * kBpp)); 802 kWidth * kBpp));
788 } 803 }
789 804
790 TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) { 805 TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) {
791 scoped_ptr<uint8[]> src(new uint8[16]); 806 scoped_ptr<uint8[]> src(new uint8[16]);
792 scoped_ptr<uint8[]> dst(new uint8[16]); 807 scoped_ptr<uint8[]> dst(new uint8[16]);
793 808
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 932 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
918 ReadYV12Data(&yuv_bytes); 933 ReadYV12Data(&yuv_bytes);
919 934
920 const int kWidth = 167; 935 const int kWidth = 167;
921 const int kSourceDx = 80000; // This value means a scale down. 936 const int kSourceDx = 80000; // This value means a scale down.
922 ScaleYUVToRGB32Row_C(yuv_bytes.get(), 937 ScaleYUVToRGB32Row_C(yuv_bytes.get(),
923 yuv_bytes.get() + kSourceUOffset, 938 yuv_bytes.get() + kSourceUOffset,
924 yuv_bytes.get() + kSourceVOffset, 939 yuv_bytes.get() + kSourceVOffset,
925 rgb_bytes_reference.get(), 940 rgb_bytes_reference.get(),
926 kWidth, 941 kWidth,
927 kSourceDx); 942 kSourceDx,
943 kCoefficientsRgbY);
928 ScaleYUVToRGB32Row_SSE2_X64(yuv_bytes.get(), 944 ScaleYUVToRGB32Row_SSE2_X64(yuv_bytes.get(),
929 yuv_bytes.get() + kSourceUOffset, 945 yuv_bytes.get() + kSourceUOffset,
930 yuv_bytes.get() + kSourceVOffset, 946 yuv_bytes.get() + kSourceVOffset,
931 rgb_bytes_converted.get(), 947 rgb_bytes_converted.get(),
932 kWidth, 948 kWidth,
933 kSourceDx); 949 kSourceDx,
950 kCoefficientsRgbY);
934 media::EmptyRegisterState(); 951 media::EmptyRegisterState();
935 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 952 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
936 rgb_bytes_converted.get(), 953 rgb_bytes_converted.get(),
937 kWidth * kBpp)); 954 kWidth * kBpp));
938 } 955 }
939 956
940 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) { 957 TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX_X64) {
941 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]); 958 scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
942 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]); 959 scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
943 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]); 960 scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
944 ReadYV12Data(&yuv_bytes); 961 ReadYV12Data(&yuv_bytes);
945 962
946 const int kWidth = 167; 963 const int kWidth = 167;
947 const int kSourceDx = 80000; // This value means a scale down. 964 const int kSourceDx = 80000; // This value means a scale down.
948 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(), 965 LinearScaleYUVToRGB32Row_C(yuv_bytes.get(),
949 yuv_bytes.get() + kSourceUOffset, 966 yuv_bytes.get() + kSourceUOffset,
950 yuv_bytes.get() + kSourceVOffset, 967 yuv_bytes.get() + kSourceVOffset,
951 rgb_bytes_reference.get(), 968 rgb_bytes_reference.get(),
952 kWidth, 969 kWidth,
953 kSourceDx); 970 kSourceDx,
971 kCoefficientsRgbY);
954 LinearScaleYUVToRGB32Row_MMX_X64(yuv_bytes.get(), 972 LinearScaleYUVToRGB32Row_MMX_X64(yuv_bytes.get(),
955 yuv_bytes.get() + kSourceUOffset, 973 yuv_bytes.get() + kSourceUOffset,
956 yuv_bytes.get() + kSourceVOffset, 974 yuv_bytes.get() + kSourceVOffset,
957 rgb_bytes_converted.get(), 975 rgb_bytes_converted.get(),
958 kWidth, 976 kWidth,
959 kSourceDx); 977 kSourceDx,
978 kCoefficientsRgbY);
960 media::EmptyRegisterState(); 979 media::EmptyRegisterState();
961 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(), 980 EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
962 rgb_bytes_converted.get(), 981 rgb_bytes_converted.get(),
963 kWidth * kBpp)); 982 kWidth * kBpp));
964 } 983 }
965 984
966 #endif // defined(ARCH_CPU_X86_64) 985 #endif // defined(ARCH_CPU_X86_64)
967 986
968 #endif // defined(ARCH_CPU_X86_FAMILY) 987 #endif // defined(ARCH_CPU_X86_FAMILY)
969 988
970 } // namespace media 989 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698