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

Side by Side Diff: webrtc/common_video/i420_video_frame_unittest.cc

Issue 2528153002: Add I420Buffer::Copy method taking plane pointers as input. (Closed)
Patch Set: Reordered methods. Use RTC_CHECK_EQ. Created 4 years 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const int kSizeY = 400; 144 const int kSizeY = 400;
145 const int kSizeU = 100; 145 const int kSizeU = 100;
146 const int kSizeV = 100; 146 const int kSizeV = 100;
147 const VideoRotation kRotation = kVideoRotation_270; 147 const VideoRotation kRotation = kVideoRotation_270;
148 uint8_t buffer_y[kSizeY]; 148 uint8_t buffer_y[kSizeY];
149 uint8_t buffer_u[kSizeU]; 149 uint8_t buffer_u[kSizeU];
150 uint8_t buffer_v[kSizeV]; 150 uint8_t buffer_v[kSizeV];
151 memset(buffer_y, 16, kSizeY); 151 memset(buffer_y, 16, kSizeY);
152 memset(buffer_u, 8, kSizeU); 152 memset(buffer_u, 8, kSizeU);
153 memset(buffer_v, 4, kSizeV); 153 memset(buffer_v, 4, kSizeV);
154 // TODO(nisse): This new + Copy looks quite awkward. Consider adding 154
155 // an alternative I420Buffer::Create method.
156 VideoFrame frame1( 155 VideoFrame frame1(
157 I420Buffer::Copy(*rtc::scoped_refptr<VideoFrameBuffer>( 156 I420Buffer::Copy(width, height,
158 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( 157 buffer_y, stride_y,
159 width, height, 158 buffer_u, stride_u,
160 buffer_y, stride_y, 159 buffer_v, stride_v),
161 buffer_u, stride_u,
162 buffer_v, stride_v,
163 rtc::Callback0<void>([](){})))),
164 kRotation, 0); 160 kRotation, 0);
165 frame1.set_timestamp(timestamp); 161 frame1.set_timestamp(timestamp);
166 frame1.set_ntp_time_ms(ntp_time_ms); 162 frame1.set_ntp_time_ms(ntp_time_ms);
167 frame1.set_render_time_ms(render_time_ms); 163 frame1.set_render_time_ms(render_time_ms);
168 VideoFrame frame2(frame1); 164 VideoFrame frame2(frame1);
169 165
170 EXPECT_EQ(frame1.video_frame_buffer(), frame2.video_frame_buffer()); 166 EXPECT_EQ(frame1.video_frame_buffer(), frame2.video_frame_buffer());
171 EXPECT_EQ(frame1.video_frame_buffer()->DataY(), 167 EXPECT_EQ(frame1.video_frame_buffer()->DataY(),
172 frame2.video_frame_buffer()->DataY()); 168 frame2.video_frame_buffer()->DataY());
173 EXPECT_EQ(frame1.video_frame_buffer()->DataU(), 169 EXPECT_EQ(frame1.video_frame_buffer()->DataU(),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 CheckRotate(640, 480, GetParam(), *rotated_buffer); 290 CheckRotate(640, 480, GetParam(), *rotated_buffer);
295 } 291 }
296 292
297 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotate, 293 INSTANTIATE_TEST_CASE_P(Rotate, TestI420BufferRotate,
298 ::testing::Values(kVideoRotation_0, 294 ::testing::Values(kVideoRotation_0,
299 kVideoRotation_90, 295 kVideoRotation_90,
300 kVideoRotation_180, 296 kVideoRotation_180,
301 kVideoRotation_270)); 297 kVideoRotation_270));
302 298
303 } // namespace webrtc 299 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_video/include/video_frame_buffer.h » ('j') | webrtc/common_video/video_frame_buffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698