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

Side by Side Diff: webrtc/test/frame_generator.cc

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 7 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include "webrtc/test/frame_generator.h" 10 #include "webrtc/test/frame_generator.h"
(...skipping 21 matching lines...) Expand all
32 VideoFrame* NextFrame() override { 32 VideoFrame* NextFrame() override {
33 frame_.CreateEmptyFrame(static_cast<int>(width_), 33 frame_.CreateEmptyFrame(static_cast<int>(width_),
34 static_cast<int>(height_), 34 static_cast<int>(height_),
35 static_cast<int>(width_), 35 static_cast<int>(width_),
36 static_cast<int>((width_ + 1) / 2), 36 static_cast<int>((width_ + 1) / 2),
37 static_cast<int>((width_ + 1) / 2)); 37 static_cast<int>((width_ + 1) / 2));
38 angle_ += 30.0; 38 angle_ += 30.0;
39 uint8_t u = fabs(sin(angle_)) * 0xFF; 39 uint8_t u = fabs(sin(angle_)) * 0xFF;
40 uint8_t v = fabs(cos(angle_)) * 0xFF; 40 uint8_t v = fabs(cos(angle_)) * 0xFF;
41 41
42 memset(frame_.buffer(kYPlane), 0x80, frame_.allocated_size(kYPlane)); 42 memset(frame_.video_frame_buffer()->MutableDataY(), 0x80,
43 memset(frame_.buffer(kUPlane), u, frame_.allocated_size(kUPlane)); 43 frame_.allocated_size(kYPlane));
44 memset(frame_.buffer(kVPlane), v, frame_.allocated_size(kVPlane)); 44 memset(frame_.video_frame_buffer()->MutableDataU(), u,
45 frame_.allocated_size(kUPlane));
46 memset(frame_.video_frame_buffer()->MutableDataV(), v,
47 frame_.allocated_size(kVPlane));
45 return &frame_; 48 return &frame_;
46 } 49 }
47 50
48 private: 51 private:
49 double angle_; 52 double angle_;
50 size_t width_; 53 size_t width_;
51 size_t height_; 54 size_t height_;
52 VideoFrame frame_; 55 VideoFrame frame_;
53 }; 56 };
54 57
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 void CropSourceToScrolledImage(double scroll_factor) { 196 void CropSourceToScrolledImage(double scroll_factor) {
194 const int kTargetWidth = current_frame_.width(); 197 const int kTargetWidth = current_frame_.width();
195 const int kTargetHeight = current_frame_.height(); 198 const int kTargetHeight = current_frame_.height();
196 int scroll_margin_x = current_source_frame_->width() - kTargetWidth; 199 int scroll_margin_x = current_source_frame_->width() - kTargetWidth;
197 int pixels_scrolled_x = 200 int pixels_scrolled_x =
198 static_cast<int>(scroll_margin_x * scroll_factor + 0.5); 201 static_cast<int>(scroll_margin_x * scroll_factor + 0.5);
199 int scroll_margin_y = current_source_frame_->height() - kTargetHeight; 202 int scroll_margin_y = current_source_frame_->height() - kTargetHeight;
200 int pixels_scrolled_y = 203 int pixels_scrolled_y =
201 static_cast<int>(scroll_margin_y * scroll_factor + 0.5); 204 static_cast<int>(scroll_margin_y * scroll_factor + 0.5);
202 205
203 int offset_y = (current_source_frame_->stride(PlaneType::kYPlane) * 206 int offset_y = (current_source_frame_->video_frame_buffer()->StrideY() *
204 pixels_scrolled_y) + 207 pixels_scrolled_y) +
205 pixels_scrolled_x; 208 pixels_scrolled_x;
206 int offset_u = (current_source_frame_->stride(PlaneType::kUPlane) * 209 int offset_u = (current_source_frame_->video_frame_buffer()->StrideU() *
207 (pixels_scrolled_y / 2)) + 210 (pixels_scrolled_y / 2)) +
208 (pixels_scrolled_x / 2); 211 (pixels_scrolled_x / 2);
209 int offset_v = (current_source_frame_->stride(PlaneType::kVPlane) * 212 int offset_v = (current_source_frame_->video_frame_buffer()->StrideV() *
210 (pixels_scrolled_y / 2)) + 213 (pixels_scrolled_y / 2)) +
211 (pixels_scrolled_x / 2); 214 (pixels_scrolled_x / 2);
212 215
213 current_frame_.CreateFrame( 216 current_frame_.CreateFrame(
214 &current_source_frame_->buffer(PlaneType::kYPlane)[offset_y], 217 &current_source_frame_->video_frame_buffer()->DataY()[offset_y],
215 &current_source_frame_->buffer(PlaneType::kUPlane)[offset_u], 218 &current_source_frame_->video_frame_buffer()->DataU()[offset_u],
216 &current_source_frame_->buffer(PlaneType::kVPlane)[offset_v], 219 &current_source_frame_->video_frame_buffer()->DataV()[offset_v],
217 kTargetWidth, kTargetHeight, 220 kTargetWidth, kTargetHeight,
218 current_source_frame_->stride(PlaneType::kYPlane), 221 current_source_frame_->video_frame_buffer()->StrideY(),
219 current_source_frame_->stride(PlaneType::kUPlane), 222 current_source_frame_->video_frame_buffer()->StrideU(),
220 current_source_frame_->stride(PlaneType::kVPlane), 223 current_source_frame_->video_frame_buffer()->StrideV(),
221 kVideoRotation_0); 224 kVideoRotation_0);
222 } 225 }
223 226
224 Clock* const clock_; 227 Clock* const clock_;
225 const int64_t start_time_; 228 const int64_t start_time_;
226 const int64_t scroll_time_; 229 const int64_t scroll_time_;
227 const int64_t pause_time_; 230 const int64_t pause_time_;
228 const size_t num_frames_; 231 const size_t num_frames_;
229 size_t current_frame_num_; 232 size_t current_frame_num_;
230 VideoFrame* current_source_frame_; 233 VideoFrame* current_source_frame_;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 files.push_back(file); 275 files.push_back(file);
273 } 276 }
274 277
275 return new ScrollingImageFrameGenerator( 278 return new ScrollingImageFrameGenerator(
276 clock, files, source_width, source_height, target_width, target_height, 279 clock, files, source_width, source_height, target_width, target_height,
277 scroll_time_ms, pause_time_ms); 280 scroll_time_ms, pause_time_ms);
278 } 281 }
279 282
280 } // namespace test 283 } // namespace test
281 } // namespace webrtc 284 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_processing/video_denoiser.cc ('k') | webrtc/test/frame_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698