Chromium Code Reviews

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

Issue 2005733003: Refactor VideoDenoiser to work with I420Buffer, not VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 10
(...skipping 189 matching lines...)
200 buffer->DataU(), buffer->StrideU(), 200 buffer->DataU(), buffer->StrideU(),
201 buffer->DataV(), buffer->StrideV(), 201 buffer->DataV(), buffer->StrideV(),
202 copy->MutableDataY(), copy->StrideY(), 202 copy->MutableDataY(), copy->StrideY(),
203 copy->MutableDataU(), copy->StrideU(), 203 copy->MutableDataU(), copy->StrideU(),
204 copy->MutableDataV(), copy->StrideV(), 204 copy->MutableDataV(), copy->StrideV(),
205 width, height) == 0); 205 width, height) == 0);
206 206
207 return copy; 207 return copy;
208 } 208 }
209 209
210 rtc::scoped_refptr<I420Buffer> I420Buffer::CopyKeepStride(
211 const rtc::scoped_refptr<VideoFrameBuffer>& buffer) {
212 int width = buffer->width();
213 int height = buffer->height();
214 int stride_y = buffer->StrideY();
215 int stride_u = buffer->StrideU();
216 int stride_v = buffer->StrideV();
217 rtc::scoped_refptr<I420Buffer> copy = new rtc::RefCountedObject<I420Buffer>(
218 width, height, stride_y, stride_u, stride_v);
219 RTC_CHECK(libyuv::I420Copy(buffer->DataY(), stride_y,
220 buffer->DataU(), stride_u,
221 buffer->DataV(), stride_v,
222 copy->MutableDataY(), stride_y,
223 copy->MutableDataU(), stride_u,
224 copy->MutableDataV(), stride_v,
225 width, height) == 0);
226
227 return copy;
jackychen 2016/06/09 19:08:36 Could you use a better name instead of copy? At le
nisse-webrtc 2016/06/10 11:09:19 To me, "copy" seems quite clear from the context,
228 }
229
210 NativeHandleBuffer::NativeHandleBuffer(void* native_handle, 230 NativeHandleBuffer::NativeHandleBuffer(void* native_handle,
211 int width, 231 int width,
212 int height) 232 int height)
213 : native_handle_(native_handle), width_(width), height_(height) { 233 : native_handle_(native_handle), width_(width), height_(height) {
214 RTC_DCHECK(native_handle != nullptr); 234 RTC_DCHECK(native_handle != nullptr);
215 RTC_DCHECK_GT(width, 0); 235 RTC_DCHECK_GT(width, 0);
216 RTC_DCHECK_GT(height, 0); 236 RTC_DCHECK_GT(height, 0);
217 } 237 }
218 238
219 bool NativeHandleBuffer::IsMutable() { 239 bool NativeHandleBuffer::IsMutable() {
(...skipping 129 matching lines...)
349 buffer->StrideV() * uv_offset_y + uv_offset_x; 369 buffer->StrideV() * uv_offset_y + uv_offset_x;
350 return new rtc::RefCountedObject<WrappedI420Buffer>( 370 return new rtc::RefCountedObject<WrappedI420Buffer>(
351 cropped_width, cropped_height, 371 cropped_width, cropped_height,
352 y_plane, buffer->StrideY(), 372 y_plane, buffer->StrideY(),
353 u_plane, buffer->StrideU(), 373 u_plane, buffer->StrideU(),
354 v_plane, buffer->StrideV(), 374 v_plane, buffer->StrideV(),
355 rtc::KeepRefUntilDone(buffer)); 375 rtc::KeepRefUntilDone(buffer));
356 } 376 }
357 377
358 } // namespace webrtc 378 } // 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