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 | |
145 void I420Buffer::InitializeData() { | 134 void I420Buffer::InitializeData() { |
146 memset(data_.get(), 0, | 135 memset(data_.get(), 0, |
147 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); | 136 I420DataSize(height_, stride_y_, stride_u_, stride_v_)); |
148 } | 137 } |
149 | 138 |
150 int I420Buffer::width() const { | 139 int I420Buffer::width() const { |
151 return width_; | 140 return width_; |
152 } | 141 } |
153 | 142 |
154 int I420Buffer::height() const { | 143 int I420Buffer::height() const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 src, | 239 src, |
251 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, | 240 (src.width() - crop_width) / 2, (src.height() - crop_height) / 2, |
252 crop_width, crop_height); | 241 crop_width, crop_height); |
253 } | 242 } |
254 | 243 |
255 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { | 244 void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) { |
256 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); | 245 CropAndScaleFrom(src, 0, 0, src.width(), src.height()); |
257 } | 246 } |
258 | 247 |
259 } // namespace webrtc | 248 } // namespace webrtc |
OLD | NEW |