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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 int StrideU() const override; | 102 int StrideU() const override; |
103 int StrideV() const override; | 103 int StrideV() const override; |
104 | 104 |
105 void* native_handle() const override; | 105 void* native_handle() const override; |
106 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 106 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
107 | 107 |
108 // Create a new buffer and copy the pixel data. | 108 // Create a new buffer and copy the pixel data. |
109 static rtc::scoped_refptr<I420Buffer> Copy( | 109 static rtc::scoped_refptr<I420Buffer> Copy( |
110 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); | 110 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); |
111 | 111 |
112 // Only the most generally useful operations should be methods on | |
113 // this class, for more specialized operations, use | |
114 // MutableDataY(,U,V) to get write access. | |
115 | |
116 // Crop the input buffer, then scale it to the size of this buffer. | |
117 void CropAndScale(const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | |
118 int offset_x, | |
119 int offset_y, | |
120 int crop_width, | |
121 int crop_height); | |
122 | |
123 // The common case of a center crop, when needed to maintain the | |
124 // same aspect ratio. | |
125 static void CenterCropAndScale( | |
126 const rtc::scoped_refptr<I420Buffer>& dst, | |
127 const rtc::scoped_refptr<VideoFrameBuffer>& src); | |
128 | |
112 protected: | 129 protected: |
113 ~I420Buffer() override; | 130 ~I420Buffer() override; |
114 | 131 |
115 private: | 132 private: |
116 const int width_; | 133 const int width_; |
117 const int height_; | 134 const int height_; |
118 const int stride_y_; | 135 const int stride_y_; |
119 const int stride_u_; | 136 const int stride_u_; |
120 const int stride_v_; | 137 const int stride_v_; |
121 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 138 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 const uint8_t* const u_plane_; | 198 const uint8_t* const u_plane_; |
182 const uint8_t* const v_plane_; | 199 const uint8_t* const v_plane_; |
183 const int y_stride_; | 200 const int y_stride_; |
184 const int u_stride_; | 201 const int u_stride_; |
185 const int v_stride_; | 202 const int v_stride_; |
186 rtc::Callback0<void> no_longer_used_cb_; | 203 rtc::Callback0<void> no_longer_used_cb_; |
187 }; | 204 }; |
188 | 205 |
189 // Helper function to crop |buffer| without making a deep copy. May only be used | 206 // Helper function to crop |buffer| without making a deep copy. May only be used |
190 // for non-native frames. | 207 // for non-native frames. |
191 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( | 208 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
magjed_webrtc
2016/05/30 11:58:26
Is this unused now?
nisse-webrtc
2016/05/30 12:58:22
It is! It became unused in the previous cl, https:
| |
192 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 209 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
193 int cropped_width, | 210 int cropped_width, |
194 int cropped_height); | 211 int cropped_height); |
195 | 212 |
196 } // namespace webrtc | 213 } // namespace webrtc |
197 | 214 |
198 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 215 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
OLD | NEW |