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

Side by Side Diff: webrtc/media/base/videoframe_unittest.h

Issue 2091983002: Revert of Cleanups in cricket::VideoFrame and cricket::WebRtcVideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/media/engine/webrtcvideoframe.h » ('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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 webrtc::kVideoRotation_180, &frame1)); \ 828 webrtc::kVideoRotation_180, &frame1)); \
829 size_t data_size; \ 829 size_t data_size; \
830 bool ret = ms->GetSize(&data_size); \ 830 bool ret = ms->GetSize(&data_size); \
831 EXPECT_TRUE(ret); \ 831 EXPECT_TRUE(ret); \
832 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ 832 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \
833 kHeight, \ 833 kHeight, \
834 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ 834 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \
835 data_size, 0, webrtc::kVideoRotation_0)); \ 835 data_size, 0, webrtc::kVideoRotation_0)); \
836 int width_rotate = frame1.width(); \ 836 int width_rotate = frame1.width(); \
837 int height_rotate = frame1.height(); \ 837 int height_rotate = frame1.height(); \
838 frame3.InitToEmptyBuffer(width_rotate, height_rotate); \ 838 frame3.InitToEmptyBuffer(width_rotate, height_rotate, 0); \
839 libyuv::I420Mirror(frame2.video_frame_buffer()->DataY(), \ 839 libyuv::I420Mirror(frame2.video_frame_buffer()->DataY(), \
840 frame2.video_frame_buffer()->StrideY(), \ 840 frame2.video_frame_buffer()->StrideY(), \
841 frame2.video_frame_buffer()->DataU(), \ 841 frame2.video_frame_buffer()->DataU(), \
842 frame2.video_frame_buffer()->StrideU(), \ 842 frame2.video_frame_buffer()->StrideU(), \
843 frame2.video_frame_buffer()->DataV(), \ 843 frame2.video_frame_buffer()->DataV(), \
844 frame2.video_frame_buffer()->StrideV(), \ 844 frame2.video_frame_buffer()->StrideV(), \
845 frame3.video_frame_buffer()->MutableDataY(), \ 845 frame3.video_frame_buffer()->MutableDataY(), \
846 frame3.video_frame_buffer()->StrideY(), \ 846 frame3.video_frame_buffer()->StrideY(), \
847 frame3.video_frame_buffer()->MutableDataU(), \ 847 frame3.video_frame_buffer()->MutableDataU(), \
848 frame3.video_frame_buffer()->StrideU(), \ 848 frame3.video_frame_buffer()->StrideU(), \
849 frame3.video_frame_buffer()->MutableDataV(), \ 849 frame3.video_frame_buffer()->MutableDataV(), \
850 frame3.video_frame_buffer()->StrideV(), kWidth, \ 850 frame3.video_frame_buffer()->StrideV(), \
851 kHeight); \ 851 kWidth, kHeight); \
852 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ 852 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \
853 } 853 }
854 854
855 TEST_MIRROR(I420, 420) 855 TEST_MIRROR(I420, 420)
856 856
857 // Macro to help test different rotations 857 // Macro to help test different rotations
858 #define TEST_ROTATE(FOURCC, BPP, ROTATE) \ 858 #define TEST_ROTATE(FOURCC, BPP, ROTATE) \
859 void Construct##FOURCC##Rotate##ROTATE() { \ 859 void Construct##FOURCC##Rotate##ROTATE() { \
860 T frame1, frame2, frame3; \ 860 T frame1, frame2, frame3; \
861 std::unique_ptr<rtc::MemoryStream> ms( \ 861 std::unique_ptr<rtc::MemoryStream> ms( \
862 CreateYuvSample(kWidth, kHeight, BPP)); \ 862 CreateYuvSample(kWidth, kHeight, BPP)); \
863 ASSERT_TRUE(ms.get() != NULL); \ 863 ASSERT_TRUE(ms.get() != NULL); \
864 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, kHeight, \ 864 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, kHeight, \
865 kWidth, kHeight, webrtc::kVideoRotation_##ROTATE, \ 865 kWidth, kHeight, webrtc::kVideoRotation_##ROTATE, \
866 &frame1)); \ 866 &frame1)); \
867 size_t data_size; \ 867 size_t data_size; \
868 bool ret = ms->GetSize(&data_size); \ 868 bool ret = ms->GetSize(&data_size); \
869 EXPECT_TRUE(ret); \ 869 EXPECT_TRUE(ret); \
870 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ 870 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \
871 kHeight, \ 871 kHeight, \
872 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ 872 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \
873 data_size, 0, webrtc::kVideoRotation_0)); \ 873 data_size, 0, webrtc::kVideoRotation_0)); \
874 int width_rotate = frame1.width(); \ 874 int width_rotate = frame1.width(); \
875 int height_rotate = frame1.height(); \ 875 int height_rotate = frame1.height(); \
876 frame3.InitToEmptyBuffer(width_rotate, height_rotate); \ 876 frame3.InitToEmptyBuffer(width_rotate, height_rotate, 0); \
877 libyuv::I420Rotate(frame2.video_frame_buffer()->DataY(), \ 877 libyuv::I420Rotate(frame2.video_frame_buffer()->DataY(), \
878 frame2.video_frame_buffer()->StrideY(), \ 878 frame2.video_frame_buffer()->StrideY(), \
879 frame2.video_frame_buffer()->DataU(), \ 879 frame2.video_frame_buffer()->DataU(), \
880 frame2.video_frame_buffer()->StrideU(), \ 880 frame2.video_frame_buffer()->StrideU(), \
881 frame2.video_frame_buffer()->DataV(), \ 881 frame2.video_frame_buffer()->DataV(), \
882 frame2.video_frame_buffer()->StrideV(), \ 882 frame2.video_frame_buffer()->StrideV(), \
883 frame3.video_frame_buffer()->MutableDataY(), \ 883 frame3.video_frame_buffer()->MutableDataY(), \
884 frame3.video_frame_buffer()->StrideY(), \ 884 frame3.video_frame_buffer()->StrideY(), \
885 frame3.video_frame_buffer()->MutableDataU(), \ 885 frame3.video_frame_buffer()->MutableDataU(), \
886 frame3.video_frame_buffer()->StrideU(), \ 886 frame3.video_frame_buffer()->StrideU(), \
887 frame3.video_frame_buffer()->MutableDataV(), \ 887 frame3.video_frame_buffer()->MutableDataV(), \
888 frame3.video_frame_buffer()->StrideV(), kWidth, \ 888 frame3.video_frame_buffer()->StrideV(), \
889 kHeight, libyuv::kRotate##ROTATE); \ 889 kWidth, kHeight, libyuv::kRotate##ROTATE); \
890 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ 890 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \
891 } 891 }
892 892
893 // Test constructing an image with rotation. 893 // Test constructing an image with rotation.
894 TEST_ROTATE(I420, 12, 0) 894 TEST_ROTATE(I420, 12, 0)
895 TEST_ROTATE(I420, 12, 90) 895 TEST_ROTATE(I420, 12, 90)
896 TEST_ROTATE(I420, 12, 180) 896 TEST_ROTATE(I420, 12, 180)
897 TEST_ROTATE(I420, 12, 270) 897 TEST_ROTATE(I420, 12, 270)
898 TEST_ROTATE(YV12, 12, 0) 898 TEST_ROTATE(YV12, 12, 0)
899 TEST_ROTATE(YV12, 12, 90) 899 TEST_ROTATE(YV12, 12, 90)
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 out += (kHeight - 1) * stride; // Point to last row. 1473 out += (kHeight - 1) * stride; // Point to last row.
1474 stride = -stride; 1474 stride = -stride;
1475 } 1475 }
1476 ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); 1476 ASSERT_TRUE(LoadFrameNoRepeat(&frame1));
1477 1477
1478 for (int i = 0; i < repeat_to; ++i) { 1478 for (int i = 0; i < repeat_to; ++i) {
1479 EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(fourcc, 1479 EXPECT_EQ(out_size, frame1.ConvertToRgbBuffer(fourcc,
1480 out, 1480 out,
1481 out_size, stride)); 1481 out_size, stride));
1482 } 1482 }
1483 frame2.InitToEmptyBuffer(kWidth, kHeight); 1483 frame2.InitToEmptyBuffer(kWidth, kHeight, 0);
1484 for (int i = 0; i < repeat_from; ++i) { 1484 for (int i = 0; i < repeat_from; ++i) {
1485 EXPECT_EQ(0, RGBToI420(out, stride, 1485 EXPECT_EQ(0, RGBToI420(out, stride,
1486 frame2.video_frame_buffer()->MutableDataY(), 1486 frame2.video_frame_buffer()->MutableDataY(),
1487 frame2.video_frame_buffer()->StrideY(), 1487 frame2.video_frame_buffer()->StrideY(),
1488 frame2.video_frame_buffer()->MutableDataU(), 1488 frame2.video_frame_buffer()->MutableDataU(),
1489 frame2.video_frame_buffer()->StrideU(), 1489 frame2.video_frame_buffer()->StrideU(),
1490 frame2.video_frame_buffer()->MutableDataV(), 1490 frame2.video_frame_buffer()->MutableDataV(),
1491 frame2.video_frame_buffer()->StrideV(), 1491 frame2.video_frame_buffer()->StrideV(),
1492 kWidth, kHeight)); 1492 kWidth, kHeight));
1493 } 1493 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 target.reset(source->Copy()); 1830 target.reset(source->Copy());
1831 EXPECT_TRUE(IsEqual(*source, *target, 0)); 1831 EXPECT_TRUE(IsEqual(*source, *target, 0));
1832 const T* const_source = source.get(); 1832 const T* const_source = source.get();
1833 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer()); 1833 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer());
1834 } 1834 }
1835 1835
1836 int repeat_; 1836 int repeat_;
1837 }; 1837 };
1838 1838
1839 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ 1839 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/videoframe.h ('k') | webrtc/media/engine/webrtcvideoframe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698