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

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

Issue 2029273004: New static method I420Buffer::SetToBlack. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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) 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 buffer->DataU(), buffer->StrideU(), 193 buffer->DataU(), buffer->StrideU(),
194 buffer->DataV(), buffer->StrideV(), 194 buffer->DataV(), buffer->StrideV(),
195 copy->MutableDataY(), copy->StrideY(), 195 copy->MutableDataY(), copy->StrideY(),
196 copy->MutableDataU(), copy->StrideU(), 196 copy->MutableDataU(), copy->StrideU(),
197 copy->MutableDataV(), copy->StrideV(), 197 copy->MutableDataV(), copy->StrideV(),
198 width, height) == 0); 198 width, height) == 0);
199 199
200 return copy; 200 return copy;
201 } 201 }
202 202
203 void I420Buffer::SetToBlack(
204 const rtc::scoped_refptr<VideoFrameBuffer>& buffer) {
205 RTC_CHECK(libyuv::I420Rect(buffer->MutableDataY(), buffer->StrideY(),
206 buffer->MutableDataU(), buffer->StrideU(),
207 buffer->MutableDataV(), buffer->StrideV(),
208 0, 0,
209 buffer->width(), buffer->height(),
210 0, 128, 128) == 0);
211 }
212
203 NativeHandleBuffer::NativeHandleBuffer(void* native_handle, 213 NativeHandleBuffer::NativeHandleBuffer(void* native_handle,
204 int width, 214 int width,
205 int height) 215 int height)
206 : native_handle_(native_handle), width_(width), height_(height) { 216 : native_handle_(native_handle), width_(width), height_(height) {
207 RTC_DCHECK(native_handle != nullptr); 217 RTC_DCHECK(native_handle != nullptr);
208 RTC_DCHECK_GT(width, 0); 218 RTC_DCHECK_GT(width, 0);
209 RTC_DCHECK_GT(height, 0); 219 RTC_DCHECK_GT(height, 0);
210 } 220 }
211 221
212 int NativeHandleBuffer::width() const { 222 int NativeHandleBuffer::width() const {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 buffer->StrideV() * uv_offset_y + uv_offset_x; 343 buffer->StrideV() * uv_offset_y + uv_offset_x;
334 return new rtc::RefCountedObject<WrappedI420Buffer>( 344 return new rtc::RefCountedObject<WrappedI420Buffer>(
335 cropped_width, cropped_height, 345 cropped_width, cropped_height,
336 y_plane, buffer->StrideY(), 346 y_plane, buffer->StrideY(),
337 u_plane, buffer->StrideU(), 347 u_plane, buffer->StrideU(),
338 v_plane, buffer->StrideV(), 348 v_plane, buffer->StrideV(),
339 rtc::KeepRefUntilDone(buffer)); 349 rtc::KeepRefUntilDone(buffer));
340 } 350 }
341 351
342 } // namespace webrtc 352 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698