Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1931)

Unified Diff: webrtc/common_video/include/video_frame_buffer.h

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Clarify some comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 984bd50d674e78d7e7aedfc252fcfef8810b6963..311af01ce7f884bf56f8a509bf86d5e1b2d55eab 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -109,6 +109,23 @@ class I420Buffer : public VideoFrameBuffer {
static rtc::scoped_refptr<I420Buffer> Copy(
const rtc::scoped_refptr<VideoFrameBuffer>& buffer);
+ // Only the most generally useful operations should be methods on
perkj_webrtc 2016/06/02 13:43:08 I don't think this comment belong here. please rem
nisse-webrtc 2016/06/03 13:55:02 Done.
+ // this class, for more specialized operations, use
+ // MutableDataY(,U,V) to get write access.
+
+ // Scale the cropped area of |src|, writing into this buffer.
perkj_webrtc 2016/06/02 13:43:08 Please comment that the result width and height wi
nisse-webrtc 2016/06/03 13:55:02 Done.
+ void CropAndScale(const rtc::scoped_refptr<VideoFrameBuffer>& src,
+ int offset_x,
+ int offset_y,
+ int crop_width,
+ int crop_height);
+
+ // The common case of a center crop, when needed to maintain the
+ // same aspect ratio.
+ static void CenterCropAndScale(
perkj_webrtc 2016/06/02 13:43:08 I would prefer this to be just void CropAndScale
nisse-webrtc 2016/06/03 13:55:02 Done.
+ const rtc::scoped_refptr<I420Buffer>& dst,
+ const rtc::scoped_refptr<VideoFrameBuffer>& src);
+
protected:
~I420Buffer() override;
@@ -186,13 +203,6 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
rtc::Callback0<void> no_longer_used_cb_;
};
-// Helper function to crop |buffer| without making a deep copy. May only be used
-// for non-native frames.
-rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop(
- const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
- int cropped_width,
- int cropped_height);
-
} // namespace webrtc
#endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_

Powered by Google App Engine
This is Rietveld 408576698