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

Side by Side Diff: webrtc/api/video/i420_buffer.h

Issue 2906053002: Update I420Buffer to new VideoFrameBuffer interface (Closed)
Patch Set: Make const versions of Get functions Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/video/i420_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 class I420Buffer : public I420BufferInterface { 23 class I420Buffer : public I420BufferInterface {
24 public: 24 public:
25 static rtc::scoped_refptr<I420Buffer> Create(int width, int height); 25 static rtc::scoped_refptr<I420Buffer> Create(int width, int height);
26 static rtc::scoped_refptr<I420Buffer> Create(int width, 26 static rtc::scoped_refptr<I420Buffer> Create(int width,
27 int height, 27 int height,
28 int stride_y, 28 int stride_y,
29 int stride_u, 29 int stride_u,
30 int stride_v); 30 int stride_v);
31 31
32 // Create a new buffer and copy the pixel data. 32 // Create a new buffer and copy the pixel data.
33 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer); 33 static rtc::scoped_refptr<I420Buffer> Copy(const I420BufferInterface& buffer);
34 // Deprecated.
35 static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer) {
36 return Copy(*buffer.GetI420());
37 }
34 38
35 static rtc::scoped_refptr<I420Buffer> Copy( 39 static rtc::scoped_refptr<I420Buffer> Copy(
36 int width, int height, 40 int width, int height,
37 const uint8_t* data_y, int stride_y, 41 const uint8_t* data_y, int stride_y,
38 const uint8_t* data_u, int stride_u, 42 const uint8_t* data_u, int stride_u,
39 const uint8_t* data_v, int stride_v); 43 const uint8_t* data_v, int stride_v);
40 44
41 // Returns a rotated copy of |src|. 45 // Returns a rotated copy of |src|.
46 static rtc::scoped_refptr<I420Buffer> Rotate(const I420BufferInterface& src,
47 VideoRotation rotation);
48 // Deprecated.
42 static rtc::scoped_refptr<I420Buffer> Rotate(const VideoFrameBuffer& src, 49 static rtc::scoped_refptr<I420Buffer> Rotate(const VideoFrameBuffer& src,
43 VideoRotation rotation); 50 VideoRotation rotation) {
51 return Rotate(*src.GetI420(), rotation);
52 }
44 53
45 // Sets the buffer to all black. 54 // Sets the buffer to all black.
46 static void SetBlack(I420Buffer* buffer); 55 static void SetBlack(I420Buffer* buffer);
47 56
48 // Sets all three planes to all zeros. Used to work around for 57 // Sets all three planes to all zeros. Used to work around for
49 // quirks in memory checkers 58 // quirks in memory checkers
50 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and 59 // (https://bugs.chromium.org/p/libyuv/issues/detail?id=377) and
51 // ffmpeg (http://crbug.com/390941). 60 // ffmpeg (http://crbug.com/390941).
52 // TODO(nisse): Deprecated. Should be deleted if/when those issues 61 // TODO(nisse): Deprecated. Should be deleted if/when those issues
53 // are resolved in a better way. Or in the mean time, use SetBlack. 62 // are resolved in a better way. Or in the mean time, use SetBlack.
54 void InitializeData(); 63 void InitializeData();
55 64
56 int width() const override; 65 int width() const override;
57 int height() const override; 66 int height() const override;
58 const uint8_t* DataY() const override; 67 const uint8_t* DataY() const override;
59 const uint8_t* DataU() const override; 68 const uint8_t* DataU() const override;
60 const uint8_t* DataV() const override; 69 const uint8_t* DataV() const override;
61 70
62 int StrideY() const override; 71 int StrideY() const override;
63 int StrideU() const override; 72 int StrideU() const override;
64 int StrideV() const override; 73 int StrideV() const override;
65 74
66 uint8_t* MutableDataY(); 75 uint8_t* MutableDataY();
67 uint8_t* MutableDataU(); 76 uint8_t* MutableDataU();
68 uint8_t* MutableDataV(); 77 uint8_t* MutableDataV();
69 78
70 // Scale the cropped area of |src| to the size of |this| buffer, and 79 // Scale the cropped area of |src| to the size of |this| buffer, and
71 // write the result into |this|. 80 // write the result into |this|.
72 void CropAndScaleFrom(const VideoFrameBuffer& src, 81 void CropAndScaleFrom(const I420BufferInterface& src,
73 int offset_x, 82 int offset_x,
74 int offset_y, 83 int offset_y,
75 int crop_width, 84 int crop_width,
76 int crop_height); 85 int crop_height);
77 86
78 // The common case of a center crop, when needed to adjust the 87 // The common case of a center crop, when needed to adjust the
79 // aspect ratio without distorting the image. 88 // aspect ratio without distorting the image.
80 void CropAndScaleFrom(const VideoFrameBuffer& src); 89 void CropAndScaleFrom(const I420BufferInterface& src);
81 90
82 // Scale all of |src| to the size of |this| buffer, with no cropping. 91 // Scale all of |src| to the size of |this| buffer, with no cropping.
83 void ScaleFrom(const VideoFrameBuffer& src); 92 void ScaleFrom(const I420BufferInterface& src);
84 93
85 protected: 94 protected:
86 I420Buffer(int width, int height); 95 I420Buffer(int width, int height);
87 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v); 96 I420Buffer(int width, int height, int stride_y, int stride_u, int stride_v);
88 97
89 ~I420Buffer() override; 98 ~I420Buffer() override;
90 99
91 private: 100 private:
92 const int width_; 101 const int width_;
93 const int height_; 102 const int height_;
94 const int stride_y_; 103 const int stride_y_;
95 const int stride_u_; 104 const int stride_u_;
96 const int stride_v_; 105 const int stride_v_;
97 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; 106 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_;
98 }; 107 };
99 108
100 } // namespace webrtc 109 } // namespace webrtc
101 110
102 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_ 111 #endif // WEBRTC_API_VIDEO_I420_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/video/i420_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698