Chromium Code Reviews| 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> Scale( | |
| 126 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | |
| 127 int dst_width, | |
| 128 int dst_height); | |
| 129 | |
| 130 static rtc::scoped_refptr<I420Buffer> CropAndScale( | |
| 131 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | |
| 132 int crop_x, | |
| 133 int crop_y, | |
| 134 int crop_width, | |
|
perkj_webrtc
2016/05/11 10:05:17
please document what the arguments means.
nisse-webrtc
2016/05/12 12:23:06
Done.
| |
| 135 int crop_height, | |
| 136 int dst_width, | |
| 137 int dst_height); | |
| 138 | |
| 125 protected: | 139 protected: |
| 126 ~I420Buffer() override; | 140 ~I420Buffer() override; |
| 127 | 141 |
| 128 private: | 142 private: |
| 129 const int width_; | 143 const int width_; |
| 130 const int height_; | 144 const int height_; |
| 131 const int stride_y_; | 145 const int stride_y_; |
| 132 const int stride_u_; | 146 const int stride_u_; |
| 133 const int stride_v_; | 147 const int stride_v_; |
| 134 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; | 148 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 const uint8_t* DataU() const override; | 194 const uint8_t* DataU() const override; |
| 181 const uint8_t* DataV() const override; | 195 const uint8_t* DataV() const override; |
| 182 int StrideY() const override; | 196 int StrideY() const override; |
| 183 int StrideU() const override; | 197 int StrideU() const override; |
| 184 int StrideV() const override; | 198 int StrideV() const override; |
| 185 | 199 |
| 186 void* native_handle() const override; | 200 void* native_handle() const override; |
| 187 | 201 |
| 188 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; | 202 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
| 189 | 203 |
| 204 // Helper function to crop |buffer| without making a deep copy. May | |
| 205 // only be used for non-native frames. | |
| 206 static rtc::scoped_refptr<WrappedI420Buffer> ShallowCrop( | |
| 207 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | |
| 208 int crop_x, | |
| 209 int crop_y, | |
| 210 int cropped_width, | |
| 211 int cropped_height); | |
| 212 | |
| 190 private: | 213 private: |
| 191 friend class rtc::RefCountedObject<WrappedI420Buffer>; | 214 friend class rtc::RefCountedObject<WrappedI420Buffer>; |
| 192 ~WrappedI420Buffer() override; | 215 ~WrappedI420Buffer() override; |
| 193 | 216 |
| 194 const int width_; | 217 const int width_; |
| 195 const int height_; | 218 const int height_; |
| 196 const uint8_t* const y_plane_; | 219 const uint8_t* const y_plane_; |
| 197 const uint8_t* const u_plane_; | 220 const uint8_t* const u_plane_; |
| 198 const uint8_t* const v_plane_; | 221 const uint8_t* const v_plane_; |
| 199 const int y_stride_; | 222 const int y_stride_; |
| 200 const int u_stride_; | 223 const int u_stride_; |
| 201 const int v_stride_; | 224 const int v_stride_; |
| 202 rtc::Callback0<void> no_longer_used_cb_; | 225 rtc::Callback0<void> no_longer_used_cb_; |
| 203 }; | 226 }; |
| 204 | 227 |
| 205 // Helper function to crop |buffer| without making a deep copy. May only be used | 228 // Helper function to crop |buffer| without making a deep copy. May only be used |
| 206 // for non-native frames. | 229 // for non-native frames. |
| 207 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( | 230 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop( |
| 208 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, | 231 const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| 209 int cropped_width, | 232 int cropped_width, |
| 210 int cropped_height); | 233 int cropped_height); |
| 211 | 234 |
| 212 } // namespace webrtc | 235 } // namespace webrtc |
| 213 | 236 |
| 214 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ | 237 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ |
| OLD | NEW |