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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 src.DataU(), src.StrideU(), | 124 src.DataU(), src.StrideU(), |
125 src.DataV(), src.StrideV(), | 125 src.DataV(), src.StrideV(), |
126 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), | 126 buffer->MutableDataY(), buffer->StrideY(), buffer->MutableDataU(), |
127 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), | 127 buffer->StrideU(), buffer->MutableDataV(), buffer->StrideV(), |
128 src.width(), src.height(), | 128 src.width(), src.height(), |
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 // static |
| 135 rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::Rotate( |
| 136 rtc::scoped_refptr<VideoFrameBuffer> src, |
| 137 VideoRotation rotation) { |
| 138 if (rotation == webrtc::kVideoRotation_0) { |
| 139 return src; |
| 140 } else { |
| 141 return Rotate(*src, rotation); |
| 142 } |
| 143 } |
| 144 |
134 void I420Buffer::InitializeData() { | 145 void I420Buffer::InitializeData() { |
135 memset(data_.get(), 0, | 146 memset(data_.get(), 0, |
136 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); | 147 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); |
137 } | 148 } |
138 | 149 |
139 int I420Buffer::width() const { | 150 int I420Buffer::width() const { |
140 return width_; | 151 return width_; |
141 } | 152 } |
142 | 153 |
143 int I420Buffer::height() const { | 154 int I420Buffer::height() const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 src, | 250 src, |
240 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, | 251 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, |
241 crop_width, crop_height); | 252 crop_width, crop_height); |
242 } | 253 } |
243 | 254 |
244 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { | 255 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { |
245 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); | 256 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); |
246 } | 257 } |
247 | 258 |
248 } // namespace webrtc | 259 } // namespace webrtc |
OLD | NEW |