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

Side by Side Diff: webrtc/media/base/videoframe.h

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Include <algorithm>, needed for std::min. 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) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 // Converts the I420 data to RGB of a certain type such as ARGB and ABGR. 63 // Converts the I420 data to RGB of a certain type such as ARGB and ABGR.
64 // Returns the frame's actual size, regardless of whether it was written or 64 // Returns the frame's actual size, regardless of whether it was written or
65 // not (like snprintf). Parameters size and stride_rgb are in units of bytes. 65 // not (like snprintf). Parameters size and stride_rgb are in units of bytes.
66 // If there is insufficient space, nothing is written. 66 // If there is insufficient space, nothing is written.
67 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc, 67 virtual size_t ConvertToRgbBuffer(uint32_t to_fourcc,
68 uint8_t* buffer, 68 uint8_t* buffer,
69 size_t size, 69 size_t size,
70 int stride_rgb) const; 70 int stride_rgb) const;
71 71
72 // Writes the frame into the given planes, stretched to the given width and
73 // height. The parameter "interpolate" controls whether to interpolate or just
74 // take the nearest-point. The parameter "crop" controls whether to crop this
75 // frame to the aspect ratio of the given dimensions before stretching.
76 virtual void StretchToPlanes(uint8_t* y,
77 uint8_t* u,
78 uint8_t* v,
79 int32_t pitchY,
80 int32_t pitchU,
81 int32_t pitchV,
82 size_t width,
83 size_t height,
84 bool interpolate,
85 bool crop) const;
86
87 // Writes the frame into the target VideoFrame, stretched to the size of that
88 // frame. The parameter "interpolate" controls whether to interpolate or just
89 // take the nearest-point. The parameter "crop" controls whether to crop this
90 // frame to the aspect ratio of the target frame before stretching.
91 virtual void StretchToFrame(VideoFrame *target, bool interpolate,
92 bool crop) const;
93
94 // Sets the video frame to black. 72 // Sets the video frame to black.
95 virtual bool SetToBlack(); 73 virtual bool SetToBlack();
96 74
97 // Tests if sample is valid. Returns true if valid. 75 // Tests if sample is valid. Returns true if valid.
98 static bool Validate(uint32_t fourcc, 76 static bool Validate(uint32_t fourcc,
99 int w, 77 int w,
100 int h, 78 int h,
101 const uint8_t* sample, 79 const uint8_t* sample,
102 size_t sample_size); 80 size_t sample_size);
103 81
104 protected: 82 protected:
105 // Writes the frame into the given planes, stretched to the given width and
106 // height. The parameter "interpolate" controls whether to interpolate or just
107 // take the nearest-point. The parameter "crop" controls whether to crop this
108 // frame to the aspect ratio of the given dimensions before stretching.
109 virtual bool CopyToPlanes(uint8_t* dst_y,
110 uint8_t* dst_u,
111 uint8_t* dst_v,
112 int32_t dst_pitch_y,
113 int32_t dst_pitch_u,
114 int32_t dst_pitch_v) const;
115
116 // Creates an empty frame. 83 // Creates an empty frame.
117 virtual VideoFrame* CreateEmptyFrame(int w, 84 virtual VideoFrame* CreateEmptyFrame(int w,
118 int h, 85 int h,
119 int64_t timestamp_us) const = 0; 86 int64_t timestamp_us) const = 0;
120 87
121 virtual void set_rotation(webrtc::VideoRotation rotation) = 0; 88 virtual void set_rotation(webrtc::VideoRotation rotation) = 0;
122 }; 89 };
123 90
124 } // namespace cricket 91 } // namespace cricket
125 92
126 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_ 93 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698