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

Side by Side 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: Delete ShallowCenterCrop. Created 4 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
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int StrideU() const override; 102 int StrideU() const override;
103 int StrideV() const override; 103 int StrideV() const override;
104 104
105 void* native_handle() const override; 105 void* native_handle() const override;
106 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override; 106 rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
107 107
108 // Create a new buffer and copy the pixel data. 108 // Create a new buffer and copy the pixel data.
109 static rtc::scoped_refptr<I420Buffer> Copy( 109 static rtc::scoped_refptr<I420Buffer> Copy(
110 const rtc::scoped_refptr<VideoFrameBuffer>& buffer); 110 const rtc::scoped_refptr<VideoFrameBuffer>& buffer);
111 111
112 // Only the most generally useful operations should be methods on
113 // this class, for more specialized operations, use
114 // MutableDataY(,U,V) to get write access.
115
116 // Crop the input buffer, then scale it to the size of this buffer.
117 void CropAndScale(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
pbos-webrtc 2016/05/31 14:14:01 const VideoFrameBuffer& src?
nisse-webrtc 2016/06/01 09:15:17 I had a brief discussion with Magnus and Tommi, an
118 int offset_x,
119 int offset_y,
120 int crop_width,
121 int crop_height);
122
123 // The common case of a center crop, when needed to maintain the
124 // same aspect ratio.
125 static void CenterCropAndScale(
126 const rtc::scoped_refptr<I420Buffer>& dst,
pbos-webrtc 2016/05/31 14:14:01 Should this be a I420Buffer* dst and const VideoFr
127 const rtc::scoped_refptr<VideoFrameBuffer>& src);
128
112 protected: 129 protected:
113 ~I420Buffer() override; 130 ~I420Buffer() override;
114 131
115 private: 132 private:
116 const int width_; 133 const int width_;
117 const int height_; 134 const int height_;
118 const int stride_y_; 135 const int stride_y_;
119 const int stride_u_; 136 const int stride_u_;
120 const int stride_v_; 137 const int stride_v_;
121 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_; 138 const std::unique_ptr<uint8_t, AlignedFreeDeleter> data_;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const int height_; 196 const int height_;
180 const uint8_t* const y_plane_; 197 const uint8_t* const y_plane_;
181 const uint8_t* const u_plane_; 198 const uint8_t* const u_plane_;
182 const uint8_t* const v_plane_; 199 const uint8_t* const v_plane_;
183 const int y_stride_; 200 const int y_stride_;
184 const int u_stride_; 201 const int u_stride_;
185 const int v_stride_; 202 const int v_stride_;
186 rtc::Callback0<void> no_longer_used_cb_; 203 rtc::Callback0<void> no_longer_used_cb_;
187 }; 204 };
188 205
189 // Helper function to crop |buffer| without making a deep copy. May only be used
190 // for non-native frames.
191 rtc::scoped_refptr<VideoFrameBuffer> ShallowCenterCrop(
192 const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
193 int cropped_width,
194 int cropped_height);
195
196 } // namespace webrtc 206 } // namespace webrtc
197 207
198 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_ 208 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698