| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } else { | 140 } else { |
| 141 return Rotate(*src, rotation); | 141 return Rotate(*src, rotation); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 void I420Buffer::InitializeData() { | 145 void I420Buffer::InitializeData() { |
| 146 memset(data_.get(), 0, | 146 memset(data_.get(), 0, |
| 147 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); | 147 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 VideoFrameBuffer::PixelFormat I420Buffer::Format() const { |
| 151 return PixelFormat::kI420; |
| 152 } |
| 153 |
| 150 int I420Buffer::width() const { | 154 int I420Buffer::width() const { |
| 151 return width_; | 155 return width_; |
| 152 } | 156 } |
| 153 | 157 |
| 154 int I420Buffer::height() const { | 158 int I420Buffer::height() const { |
| 155 return height_; | 159 return height_; |
| 156 } | 160 } |
| 157 | 161 |
| 158 const uint8_t* I420Buffer::DataY() const { | 162 const uint8_t* I420Buffer::DataY() const { |
| 159 return data_.get(); | 163 return data_.get(); |
| 160 } | 164 } |
| 161 const uint8_t* I420Buffer::DataU() const { | 165 const uint8_t* I420Buffer::DataU() const { |
| 162 return data_.get() + stride_y_ * height_; | 166 return data_.get() + stride_y_ * height_; |
| 163 } | 167 } |
| 164 const uint8_t* I420Buffer::DataV() const { | 168 const uint8_t* I420Buffer::DataV() const { |
| 165 return data_.get() + stride_y_ * height_ + stride_u_ * ((height_ + 1) / 2); | 169 return data_.get() + stride_y_ * height_ + stride_u_ * ((height_ + 1) / 2); |
| 166 } | 170 } |
| 167 | 171 |
| 168 int I420Buffer::StrideY() const { | 172 int I420Buffer::StrideY() const { |
| 169 return stride_y_; | 173 return stride_y_; |
| 170 } | 174 } |
| 171 int I420Buffer::StrideU() const { | 175 int I420Buffer::StrideU() const { |
| 172 return stride_u_; | 176 return stride_u_; |
| 173 } | 177 } |
| 174 int I420Buffer::StrideV() const { | 178 int I420Buffer::StrideV() const { |
| 175 return stride_v_; | 179 return stride_v_; |
| 176 } | 180 } |
| 177 | 181 |
| 178 void* I420Buffer::native_handle() const { | |
| 179 return nullptr; | |
| 180 } | |
| 181 | |
| 182 rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::NativeToI420Buffer() { | |
| 183 return this; | |
| 184 } | |
| 185 | |
| 186 uint8_t* I420Buffer::MutableDataY() { | 182 uint8_t* I420Buffer::MutableDataY() { |
| 187 return const_cast<uint8_t*>(DataY()); | 183 return const_cast<uint8_t*>(DataY()); |
| 188 } | 184 } |
| 189 uint8_t* I420Buffer::MutableDataU() { | 185 uint8_t* I420Buffer::MutableDataU() { |
| 190 return const_cast<uint8_t*>(DataU()); | 186 return const_cast<uint8_t*>(DataU()); |
| 191 } | 187 } |
| 192 uint8_t* I420Buffer::MutableDataV() { | 188 uint8_t* I420Buffer::MutableDataV() { |
| 193 return const_cast<uint8_t*>(DataV()); | 189 return const_cast<uint8_t*>(DataV()); |
| 194 } | 190 } |
| 195 | 191 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 src, | 246 src, |
| 251 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, | 247 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, |
| 252 crop_width, crop_height); | 248 crop_width, crop_height); |
| 253 } | 249 } |
| 254 | 250 |
| 255 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { | 251 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { |
| 256 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); | 252 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); |
| 257 } | 253 } |
| 258 | 254 |
| 259 } // namespace webrtc | 255 } // namespace webrtc |
| OLD | NEW |