Chromium Code Reviews| Index: webrtc/common_video/include/video_frame_buffer.h |
| diff --git a/webrtc/common_video/include/video_frame_buffer.h b/webrtc/common_video/include/video_frame_buffer.h |
| index 6f082dee9bae928fbb005027b7262f03bdde3053..2eb88549d095506d9136b80a9ff0599dc8fa8b91 100644 |
| --- a/webrtc/common_video/include/video_frame_buffer.h |
| +++ b/webrtc/common_video/include/video_frame_buffer.h |
| @@ -122,6 +122,26 @@ class I420Buffer : public VideoFrameBuffer { |
| static rtc::scoped_refptr<I420Buffer> Copy( |
| const rtc::scoped_refptr<VideoFrameBuffer>& buffer); |
| + static rtc::scoped_refptr<I420Buffer> Scale( |
| + const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| + int dst_width, |
| + int dst_height); |
| + |
| + // Extracts a rectangle of size |crop_width| x |crop_height|, with |
| + // lower left corner at |crop_x|, |crop_y|, and returns a new frame |
|
perkj_webrtc
2016/05/16 06:48:47
lower left? -really ? isn't this upper left?
|
| + // buffer with the rectangle scaled to size |dst_width| x |
| + // |dst_height|. Note that this function doesn't care about aspect |
| + // ration; typically, callers select |crop_width| and |crop_height| |
| + // so that the aspect ratio is preserved. |
| + static rtc::scoped_refptr<I420Buffer> CropAndScale( |
| + const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| + int crop_x, |
| + int crop_y, |
| + int crop_width, |
| + int crop_height, |
| + int dst_width, |
| + int dst_height); |
| + |
| protected: |
| ~I420Buffer() override; |
| @@ -187,6 +207,15 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer { |
| rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; |
| + // Helper function to crop |buffer| without making a deep copy. May |
| + // only be used for non-native frames. |
| + static rtc::scoped_refptr<WrappedI420Buffer> ShallowCrop( |
| + const rtc::scoped_refptr<VideoFrameBuffer>& buffer, |
| + int crop_x, |
| + int crop_y, |
| + int cropped_width, |
| + int cropped_height); |
| + |
| private: |
| friend class rtc::RefCountedObject<WrappedI420Buffer>; |
| ~WrappedI420Buffer() override; |