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

Side by Side Diff: webrtc/common_video/include/video_frame_buffer.h

Issue 2528153002: Add I420Buffer::Copy method taking plane pointers as input. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Returns a new memory-backed frame buffer converted from this buffer's 50 // Returns a new memory-backed frame buffer converted from this buffer's
51 // native handle. 51 // native handle.
52 virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0; 52 virtual rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() = 0;
53 53
54 protected: 54 protected:
55 virtual ~VideoFrameBuffer(); 55 virtual ~VideoFrameBuffer();
56 }; 56 };
57 57
58 // Plain I420 buffer in standard memory. 58 // Plain I420 buffer in standard memory.
59 class I420Buffer : public VideoFrameBuffer { 59 class I420Buffer : public VideoFrameBuffer {
60 public: 60 protected:
61 I420Buffer(int width, int height); 61 I420Buffer(int width, int height);
62 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); 62 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v);
63 63
64 public:
magjed_webrtc 2016/11/28 08:39:56 The order must be public, protected, private.
nisse-webrtc 2016/11/28 09:44:53 Done.
64 static rtc::scoped_refptr<I420Buffer> Create(int width, int height); 65 static rtc::scoped_refptr<I420Buffer> Create(int width, int height);
65 static rtc::scoped_refptr<I420Buffer> Create(int width, 66 static rtc::scoped_refptr<I420Buffer> Create(int width,
66 int height, 67 int height,
67 int stride_y, 68 int stride_y,
68 int stride_u, 69 int stride_u,
69 int stride_v); 70 int stride_v);
70 71
71 // Sets all three planes to all zeros. Used to work around for 72 // Sets all three planes to all zeros. Used to work around for
72 // quirks in memory checkers 73 // quirks in memory checkers
73 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and 74 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and
(...skipping 15 matching lines...) Expand all
89 uint8_t* MutableDataU(); 90 uint8_t* MutableDataU();
90 uint8_t* MutableDataV(); 91 uint8_t* MutableDataV();
91 int StrideY() const override; 92 int StrideY() const override;
92 int StrideU() const override; 93 int StrideU() const override;
93 int StrideV() const override; 94 int StrideV() const override;
94 95
95 void* native_handle() const override; 96 void* native_handle() const override;
96 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; 97 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
97 98
98 // Create a new buffer and copy the pixel data. 99 // Create a new buffer and copy the pixel data.
99 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer); 100 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer);
magjed_webrtc 2016/11/28 08:39:56 Can you move both these static methods up to the o
nisse-webrtc 2016/11/28 09:44:54 Done, except for the deprecated version of the Cop
magjed_webrtc 2016/11/28 10:18:20 Yeah, it's probably best to reorder the .cc file t
100 101
102 static rtc::scoped_refptr<I420Buffer> Copy(
103 int width, int height,
104 const uint8_t* data_y, int stride_y,
105 const uint8_t* data_u, int stride_u,
106 const uint8_t* data_v, int stride_v);
107
101 // Scale the cropped area of |src| to the size of |this| buffer, and 108 // Scale the cropped area of |src| to the size of |this| buffer, and
102 // write the result into |this|. 109 // write the result into |this|.
103 void CropAndScaleFrom(const VideoFrameBuffer& src, 110 void CropAndScaleFrom(const VideoFrameBuffer& src,
104 int offset_x, 111 int offset_x,
105 int offset_y, 112 int offset_y,
106 int crop_width, 113 int crop_width,
107 int crop_height); 114 int crop_height);
108 115
109 // The common case of a center crop, when needed to adjust the 116 // The common case of a center crop, when needed to adjust the
110 // aspect ratio without distorting the image. 117 // aspect ratio without distorting the image.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const uint8_t* const v_plane_; 220 const uint8_t* const v_plane_;
214 const int y_stride_; 221 const int y_stride_;
215 const int u_stride_; 222 const int u_stride_;
216 const int v_stride_; 223 const int v_stride_;
217 rtc::Callback0<void> no_longer_used_cb_; 224 rtc::Callback0<void> no_longer_used_cb_;
218 }; 225 };
219 226
220 } // namespace webrtc 227 } // namespace webrtc
221 228
222 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ 229 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698