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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 int StrideU() const override; | 115 int StrideU() const override; |
116 int StrideV() const override; | 116 int StrideV() const override; |
117 | 117 |
118 void* native_handle() const override; | 118 void* native_handle() const override; |
119 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 119 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
120 | 120 |
121 // Create a new buffer and copy the pixel data. | 121 // Create a new buffer and copy the pixel data. |
122 static rtc::scoped_refptr<I420Buffer> Copy( | 122 static rtc::scoped_refptr<I420Buffer> Copy( |
123 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); | 123 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); |
124 | 124 |
| 125 static rtc::scoped_refptr<I420Buffer> CropAndScale( |
| 126 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| 127 int offset_x, |
| 128 int offset_y, |
| 129 int crop_width, |
| 130 int crop_height, |
| 131 int dst_width, |
| 132 int dst_height); |
| 133 |
125 protected: | 134 protected: |
126 ~I420Buffer() override; | 135 ~I420Buffer() override; |
127 | 136 |
128 private: | 137 private: |
129 const int width_; | 138 const int width_; |
130 const int height_; | 139 const int height_; |
131 const int stride_y_; | 140 const int stride_y_; |
132 const int stride_u_; | 141 const int stride_u_; |
133 const int stride_v_; | 142 const int stride_v_; |
134 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 143 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // Helper function to crop |buffer| without making a deep copy. May only be used | 214 // Helper function to crop |buffer| without making a deep copy. May only be used |
206 // for non-native frames. | 215 // for non-native frames. |
207 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( | 216 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
208 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 217 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
209 int cropped_width, | 218 int cropped_width, |
210 int cropped_height); | 219 int cropped_height); |
211 | 220 |
212 } // namespace webrtc | 221 } // namespace webrtc |
213 | 222 |
214 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 223 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |