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

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

Issue 2528153002: Add I420Buffer::Copy method taking plane pointers as input. (Closed)
Patch Set: Reordered methods. Use RTC_CHECK_EQ. Created 4 years, 1 month 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 287624e59ec5076f72ad0d87a856a6fe8e0ba8b0..2d5949fbc4e10275b34b5f326a6d86c6c3ce4c54 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -58,9 +58,6 @@ class VideoFrameBuffer : public rtc::RefCountInterface {
// Plain I420 buffer in standard memory.
class I420Buffer : public VideoFrameBuffer {
public:
- I420Buffer(int width, int height);
- I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v);
-
static rtc::scoped_refptr<I420Buffer> Create(int width, int height);
static rtc::scoped_refptr<I420Buffer> Create(int width,
int height,
@@ -68,6 +65,24 @@ class I420Buffer : public VideoFrameBuffer {
int stride_u,
int stride_v);
+ // Create a new buffer and copy the pixel data.
+ static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer);
+
+ static rtc::scoped_refptr<I420Buffer> Copy(
+ int width, int height,
+ const uint8_t* data_y, int stride_y,
+ const uint8_t* data_u, int stride_u,
+ const uint8_t* data_v, int stride_v);
+
+ // Returns a rotated versions of |src|. Native buffers are not
+ // supported. The reason this function doesn't return an I420Buffer,
+ // is that it returns |src| unchanged in case |rotation| is zero.
+ // TODO(nisse): Consider dropping the special handling of zero
+ // rotation, and leave any optimizing that case to the caller.
+ static rtc::scoped_refptr<VideoFrameBuffer> Rotate(
+ rtc::scoped_refptr<VideoFrameBuffer> src,
+ VideoRotation rotation);
+
// Sets all three planes to all zeros. Used to work around for
// quirks in memory checkers
// (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and
@@ -95,9 +110,6 @@ class I420Buffer : public VideoFrameBuffer {
void* native_handle() const override;
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
- // Create a new buffer and copy the pixel data.
- static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer);
-
// Scale the cropped area of |src| to the size of |this| buffer, and
// write the result into |this|.
void CropAndScaleFrom(const VideoFrameBuffer& src,
@@ -133,14 +145,10 @@ class I420Buffer : public VideoFrameBuffer {
ScaleFrom(*src);
}
- // Returns a rotated versions of |src|. Native buffers are not
- // supported. The reason this function doesn't return an I420Buffer,
- // is that it returns |src| unchanged in case |rotation| is zero.
- static rtc::scoped_refptr<VideoFrameBuffer> Rotate(
- rtc::scoped_refptr<VideoFrameBuffer> src,
- VideoRotation rotation);
-
protected:
+ I420Buffer(int width, int height);
+ I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v);
+
~I420Buffer() override;
private:

Powered by Google App Engine
This is Rietveld 408576698