OLD | NEW |
---|---|
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 return nullptr; | 74 return nullptr; |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 uint8_t* I420Buffer::MutableData(PlaneType type) { | 78 uint8_t* I420Buffer::MutableData(PlaneType type) { |
79 RTC_DCHECK(HasOneRef()); | 79 RTC_DCHECK(HasOneRef()); |
80 return const_cast<uint8_t*>( | 80 return const_cast<uint8_t*>( |
81 static_cast<const VideoFrameBuffer*>(this)->data(type)); | 81 static_cast<const VideoFrameBuffer*>(this)->data(type)); |
82 } | 82 } |
83 | 83 |
84 size_t I420Buffer::DataSize() const { | |
85 return stride_y_ * height_ + (stride_u_ + stride_v_) * ((height_ + 1) / 2); | |
stefan-webrtc
2016/02/01 14:02:09
Shouldn't this be the fully allocated size if you
hbos
2016/02/02 16:13:03
This is the size used fir AlignedMalloc and for me
| |
86 } | |
87 | |
84 int I420Buffer::stride(PlaneType type) const { | 88 int I420Buffer::stride(PlaneType type) const { |
85 switch (type) { | 89 switch (type) { |
86 case kYPlane: | 90 case kYPlane: |
87 return stride_y_; | 91 return stride_y_; |
88 case kUPlane: | 92 case kUPlane: |
89 return stride_u_; | 93 return stride_u_; |
90 case kVPlane: | 94 case kVPlane: |
91 return stride_v_; | 95 return stride_v_; |
92 default: | 96 default: |
93 RTC_NOTREACHED(); | 97 RTC_NOTREACHED(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 buffer->stride(kVPlane) * uv_offset_y + uv_offset_x; | 233 buffer->stride(kVPlane) * uv_offset_y + uv_offset_x; |
230 return new rtc::RefCountedObject<WrappedI420Buffer>( | 234 return new rtc::RefCountedObject<WrappedI420Buffer>( |
231 cropped_width, cropped_height, | 235 cropped_width, cropped_height, |
232 y_plane, buffer->stride(kYPlane), | 236 y_plane, buffer->stride(kYPlane), |
233 u_plane, buffer->stride(kUPlane), | 237 u_plane, buffer->stride(kUPlane), |
234 v_plane, buffer->stride(kVPlane), | 238 v_plane, buffer->stride(kVPlane), |
235 rtc::KeepRefUntilDone(buffer)); | 239 rtc::KeepRefUntilDone(buffer)); |
236 } | 240 } |
237 | 241 |
238 } // namespace webrtc | 242 } // namespace webrtc |
OLD | NEW |