Chromium Code Reviews

Side by Side Diff: webrtc/common_video/libyuv/include/webrtc_libyuv.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.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 32 matching lines...)
43 size_t CalcBufferSize(VideoType type, int width, int height); 43 size_t CalcBufferSize(VideoType type, int width, int height);
44 44
45 // TODO(mikhal): Add unit test for these two functions and determine location. 45 // TODO(mikhal): Add unit test for these two functions and determine location.
46 // Print VideoFrame to file 46 // Print VideoFrame to file
47 // Input: 47 // Input:
48 // - frame : Reference to video frame. 48 // - frame : Reference to video frame.
49 // - file : pointer to file object. It is assumed that the file is 49 // - file : pointer to file object. It is assumed that the file is
50 // already open for writing. 50 // already open for writing.
51 // Return value: 0 if OK, < 0 otherwise. 51 // Return value: 0 if OK, < 0 otherwise.
52 int PrintVideoFrame(const VideoFrame& frame, FILE* file); 52 int PrintVideoFrame(const VideoFrame& frame, FILE* file);
53 int PrintVideoFrame(const VideoFrameBuffer& frame, FILE* file); 53 int PrintVideoFrame(const I420BufferInterface& frame, FILE* file);
54 54
55 // Extract buffer from VideoFrame or VideoFrameBuffer (consecutive 55 // Extract buffer from VideoFrame or I420BufferInterface (consecutive
56 // planes, no stride) 56 // planes, no stride)
57 // Input: 57 // Input:
58 // - frame : Reference to video frame. 58 // - frame : Reference to video frame.
59 // - size : pointer to the size of the allocated buffer. If size is 59 // - size : pointer to the size of the allocated buffer. If size is
60 // insufficient, an error will be returned. 60 // insufficient, an error will be returned.
61 // - buffer : Pointer to buffer 61 // - buffer : Pointer to buffer
62 // Return value: length of buffer if OK, < 0 otherwise. 62 // Return value: length of buffer if OK, < 0 otherwise.
63 int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame, 63 int ExtractBuffer(const rtc::scoped_refptr<I420BufferInterface>& input_frame,
64 size_t size, 64 size_t size,
65 uint8_t* buffer); 65 uint8_t* buffer);
66 int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer); 66 int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer);
67 // Convert To I420 67 // Convert To I420
68 // Input: 68 // Input:
69 // - src_video_type : Type of input video. 69 // - src_video_type : Type of input video.
70 // - src_frame : Pointer to a source frame. 70 // - src_frame : Pointer to a source frame.
71 // - crop_x/crop_y : Starting positions for cropping (0 for no crop). 71 // - crop_x/crop_y : Starting positions for cropping (0 for no crop).
72 // - src_width : src width in pixels. 72 // - src_width : src width in pixels.
73 // - src_height : src height in pixels. 73 // - src_height : src height in pixels.
(...skipping 27 matching lines...)
101 // Return value: 0 if OK, < 0 otherwise. 101 // Return value: 0 if OK, < 0 otherwise.
102 // It is assumed that source and destination have equal height. 102 // It is assumed that source and destination have equal height.
103 int ConvertFromI420(const VideoFrame& src_frame, 103 int ConvertFromI420(const VideoFrame& src_frame,
104 VideoType dst_video_type, 104 VideoType dst_video_type,
105 int dst_sample_size, 105 int dst_sample_size,
106 uint8_t* dst_frame); 106 uint8_t* dst_frame);
107 107
108 // Compute PSNR for an I420 frame (all planes). 108 // Compute PSNR for an I420 frame (all planes).
109 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR. 109 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR.
110 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); 110 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame);
111 double I420PSNR(const VideoFrameBuffer& ref_buffer, 111 double I420PSNR(const I420BufferInterface& ref_buffer,
112 const VideoFrameBuffer& test_buffer); 112 const I420BufferInterface& test_buffer);
113 113
114 // Compute SSIM for an I420 frame (all planes). 114 // Compute SSIM for an I420 frame (all planes).
115 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); 115 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame);
116 double I420SSIM(const VideoFrameBuffer& ref_buffer, 116 double I420SSIM(const I420BufferInterface& ref_buffer,
117 const VideoFrameBuffer& test_buffer); 117 const I420BufferInterface& test_buffer);
118 118
119 // Helper function for scaling NV12 to NV12. 119 // Helper function for scaling NV12 to NV12.
120 void NV12Scale(std::vector<uint8_t>* tmp_buffer, 120 void NV12Scale(std::vector<uint8_t>* tmp_buffer,
121 const uint8_t* src_y, int src_stride_y, 121 const uint8_t* src_y, int src_stride_y,
122 const uint8_t* src_uv, int src_stride_uv, 122 const uint8_t* src_uv, int src_stride_uv,
123 int src_width, int src_height, 123 int src_width, int src_height,
124 uint8_t* dst_y, int dst_stride_y, 124 uint8_t* dst_y, int dst_stride_y,
125 uint8_t* dst_uv, int dst_stride_uv, 125 uint8_t* dst_uv, int dst_stride_uv,
126 int dst_width, int dst_height); 126 int dst_width, int dst_height);
127 127
(...skipping 11 matching lines...)
139 uint8_t* dst_u, int dst_stride_u, 139 uint8_t* dst_u, int dst_stride_u,
140 uint8_t* dst_v, int dst_stride_v, 140 uint8_t* dst_v, int dst_stride_v,
141 int dst_width, int dst_height); 141 int dst_width, int dst_height);
142 private: 142 private:
143 std::vector<uint8_t> tmp_uv_planes_; 143 std::vector<uint8_t> tmp_uv_planes_;
144 }; 144 };
145 145
146 } // namespace webrtc 146 } // namespace webrtc
147 147
148 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ 148 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_
OLDNEW
« no previous file with comments | « webrtc/common_video/i420_video_frame_unittest.cc ('k') | webrtc/common_video/libyuv/libyuv_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine