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 #include "webrtc/api/video/i420_buffer.h" | 10 #include "webrtc/api/video/i420_buffer.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 static_cast<libyuv::RotationMode>(rotation))); | 129 static_cast<libyuv::RotationMode>(rotation))); |
130 | 130 |
131 return buffer; | 131 return buffer; |
132 } | 132 } |
133 | 133 |
134 void I420Buffer::InitializeData() { | 134 void I420Buffer::InitializeData() { |
135 memset(data_.get(), 0, | 135 memset(data_.get(), 0, |
136 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); | 136 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); |
137 } | 137 } |
138 | 138 |
139 VideoFrameBuffer::Type I420Buffer::type() const { | |
140 return Type::kI420; | |
141 } | |
142 | |
143 int I420Buffer::width() const { | 139 int I420Buffer::width() const { |
144 return width_; | 140 return width_; |
145 } | 141 } |
146 | 142 |
147 int I420Buffer::height() const { | 143 int I420Buffer::height() const { |
148 return height_; | 144 return height_; |
149 } | 145 } |
150 | 146 |
151 const uint8_t* I420Buffer::DataY() const { | 147 const uint8_t* I420Buffer::DataY() const { |
152 return data_.get(); | 148 return data_.get(); |
153 } | 149 } |
154 const uint8_t* I420Buffer::DataU() const { | 150 const uint8_t* I420Buffer::DataU() const { |
155 return data_.get() + stride_y_ * height_; | 151 return data_.get() + stride_y_ * height_; |
156 } | 152 } |
157 const uint8_t* I420Buffer::DataV() const { | 153 const uint8_t* I420Buffer::DataV() const { |
158 return data_.get() + stride_y_ * height_ + stride_u_ * ((height_ + 1) / 2); | 154 return data_.get() + stride_y_ * height_ + stride_u_ * ((height_ + 1) / 2); |
159 } | 155 } |
160 | 156 |
161 int I420Buffer::StrideY() const { | 157 int I420Buffer::StrideY() const { |
162 return stride_y_; | 158 return stride_y_; |
163 } | 159 } |
164 int I420Buffer::StrideU() const { | 160 int I420Buffer::StrideU() const { |
165 return stride_u_; | 161 return stride_u_; |
166 } | 162 } |
167 int I420Buffer::StrideV() const { | 163 int I420Buffer::StrideV() const { |
168 return stride_v_; | 164 return stride_v_; |
169 } | 165 } |
170 | 166 |
| 167 void* I420Buffer::native_handle() const { |
| 168 return nullptr; |
| 169 } |
| 170 |
| 171 rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::NativeToI420Buffer() { |
| 172 return this; |
| 173 } |
| 174 |
171 uint8_t* I420Buffer::MutableDataY() { | 175 uint8_t* I420Buffer::MutableDataY() { |
172 return const_cast<uint8_t*>(DataY()); | 176 return const_cast<uint8_t*>(DataY()); |
173 } | 177 } |
174 uint8_t* I420Buffer::MutableDataU() { | 178 uint8_t* I420Buffer::MutableDataU() { |
175 return const_cast<uint8_t*>(DataU()); | 179 return const_cast<uint8_t*>(DataU()); |
176 } | 180 } |
177 uint8_t* I420Buffer::MutableDataV() { | 181 uint8_t* I420Buffer::MutableDataV() { |
178 return const_cast<uint8_t*>(DataV()); | 182 return const_cast<uint8_t*>(DataV()); |
179 } | 183 } |
180 | 184 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 src, | 239 src, |
236 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, | 240 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, |
237 crop_width, crop_height); | 241 crop_width, crop_height); |
238 } | 242 } |
239 | 243 |
240 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { | 244 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { |
241 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); | 245 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); |
242 } | 246 } |
243 | 247 |
244 } // namespace webrtc | 248 } // namespace webrtc |
OLD | NEW |