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

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

Issue 2469763002: Refactor VideoDenoiser to use a buffer pool, replacing explicit double buffering. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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/common_video/include/video_frame_buffer.h" 10 #include "webrtc/common_video/include/video_frame_buffer.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 src, 198 src,
199 (src->width() - crop_width) / 2, (src->height() - crop_height) / 2, 199 (src->width() - crop_width) / 2, (src->height() - crop_height) / 2,
200 crop_width, crop_height); 200 crop_width, crop_height);
201 } 201 }
202 202
203 void I420Buffer::ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) { 203 void I420Buffer::ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) {
204 CropAndScaleFrom(src, 0, 0, src->width(), src->height()); 204 CropAndScaleFrom(src, 0, 0, src->width(), src->height());
205 } 205 }
206 206
207 // static 207 // static
208 rtc::scoped_refptr<I420Buffer> I420Buffer::CopyKeepStride(
209 const rtc::scoped_refptr<VideoFrameBuffer>& source) {
210 int width = source->width();
211 int height = source->height();
212 int stride_y = source->StrideY();
213 int stride_u = source->StrideU();
214 int stride_v = source->StrideV();
215 rtc::scoped_refptr<I420Buffer> target =
216 I420Buffer::Create(width, height, stride_y, stride_u, stride_v);
217 RTC_CHECK(libyuv::I420Copy(source->DataY(), stride_y,
218 source->DataU(), stride_u,
219 source->DataV(), stride_v,
220 target->MutableDataY(), stride_y,
221 target->MutableDataU(), stride_u,
222 target->MutableDataV(), stride_v,
223 width, height) == 0);
224
225 return target;
226 }
227
228 // static
229 rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::Rotate( 208 rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::Rotate(
230 const rtc::scoped_refptr<VideoFrameBuffer>& src, 209 const rtc::scoped_refptr<VideoFrameBuffer>& src,
231 VideoRotation rotation) { 210 VideoRotation rotation) {
232 RTC_DCHECK(src->DataY()); 211 RTC_DCHECK(src->DataY());
233 RTC_DCHECK(src->DataU()); 212 RTC_DCHECK(src->DataU());
234 RTC_DCHECK(src->DataV()); 213 RTC_DCHECK(src->DataV());
235 214
236 if (rotation == webrtc::kVideoRotation_0) { 215 if (rotation == webrtc::kVideoRotation_0) {
237 return src; 216 return src;
238 } 217 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void* WrappedI420Buffer::native_handle() const { 341 void* WrappedI420Buffer::native_handle() const {
363 return nullptr; 342 return nullptr;
364 } 343 }
365 344
366 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() { 345 rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() {
367 RTC_NOTREACHED(); 346 RTC_NOTREACHED();
368 return nullptr; 347 return nullptr;
369 } 348 }
370 349
371 } // namespace webrtc 350 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_video/include/video_frame_buffer.h ('k') | webrtc/modules/video_processing/frame_preprocessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698