OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 size_t CalcBufferSize(VideoType type, int width, int height); | 61 size_t CalcBufferSize(VideoType type, int width, int height); |
62 | 62 |
63 // TODO(mikhal): Add unit test for these two functions and determine location. | 63 // TODO(mikhal): Add unit test for these two functions and determine location. |
64 // Print VideoFrame to file | 64 // Print VideoFrame to file |
65 // Input: | 65 // Input: |
66 // - frame : Reference to video frame. | 66 // - frame : Reference to video frame. |
67 // - file : pointer to file object. It is assumed that the file is | 67 // - file : pointer to file object. It is assumed that the file is |
68 // already open for writing. | 68 // already open for writing. |
69 // Return value: 0 if OK, < 0 otherwise. | 69 // Return value: 0 if OK, < 0 otherwise. |
70 int PrintVideoFrame(const VideoFrame& frame, FILE* file); | 70 int PrintVideoFrame(const VideoFrame& frame, FILE* file); |
| 71 int PrintVideoFrame(const VideoFrameBuffer& frame, FILE* file); |
71 | 72 |
72 // Extract buffer from VideoFrame or VideoFrameBuffer (consecutive | 73 // Extract buffer from VideoFrame or VideoFrameBuffer (consecutive |
73 // planes, no stride) | 74 // planes, no stride) |
74 // Input: | 75 // Input: |
75 // - frame : Reference to video frame. | 76 // - frame : Reference to video frame. |
76 // - size : pointer to the size of the allocated buffer. If size is | 77 // - size : pointer to the size of the allocated buffer. If size is |
77 // insufficient, an error will be returned. | 78 // insufficient, an error will be returned. |
78 // - buffer : Pointer to buffer | 79 // - buffer : Pointer to buffer |
79 // Return value: length of buffer if OK, < 0 otherwise. | 80 // Return value: length of buffer if OK, < 0 otherwise. |
80 int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame, | 81 int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame, |
(...skipping 14 matching lines...) Expand all Loading... |
95 // Return value: 0 if OK, < 0 otherwise. | 96 // Return value: 0 if OK, < 0 otherwise. |
96 | 97 |
97 int ConvertToI420(VideoType src_video_type, | 98 int ConvertToI420(VideoType src_video_type, |
98 const uint8_t* src_frame, | 99 const uint8_t* src_frame, |
99 int crop_x, | 100 int crop_x, |
100 int crop_y, | 101 int crop_y, |
101 int src_width, | 102 int src_width, |
102 int src_height, | 103 int src_height, |
103 size_t sample_size, | 104 size_t sample_size, |
104 VideoRotation rotation, | 105 VideoRotation rotation, |
105 VideoFrame* dst_frame); | 106 I420Buffer* dst_buffer); |
106 | 107 |
107 // Convert From I420 | 108 // Convert From I420 |
108 // Input: | 109 // Input: |
109 // - src_frame : Reference to a source frame. | 110 // - src_frame : Reference to a source frame. |
110 // - dst_video_type : Type of output video. | 111 // - dst_video_type : Type of output video. |
111 // - dst_sample_size : Required only for the parsing of MJPG. | 112 // - dst_sample_size : Required only for the parsing of MJPG. |
112 // - dst_frame : Pointer to a destination frame. | 113 // - dst_frame : Pointer to a destination frame. |
113 // Return value: 0 if OK, < 0 otherwise. | 114 // Return value: 0 if OK, < 0 otherwise. |
114 // It is assumed that source and destination have equal height. | 115 // It is assumed that source and destination have equal height. |
115 int ConvertFromI420(const VideoFrame& src_frame, | 116 int ConvertFromI420(const VideoFrame& src_frame, |
116 VideoType dst_video_type, | 117 VideoType dst_video_type, |
117 int dst_sample_size, | 118 int dst_sample_size, |
118 uint8_t* dst_frame); | 119 uint8_t* dst_frame); |
119 | 120 |
120 // Compute PSNR for an I420 frame (all planes). | 121 // Compute PSNR for an I420 frame (all planes). |
121 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR. | 122 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR. |
122 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); | 123 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); |
| 124 double I420PSNR(const VideoFrameBuffer& ref_buffer, |
| 125 const VideoFrameBuffer& test_buffer); |
123 // Compute SSIM for an I420 frame (all planes). | 126 // Compute SSIM for an I420 frame (all planes). |
124 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); | 127 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); |
| 128 double I420SSIM(const VideoFrameBuffer& ref_buffer, |
| 129 const VideoFrameBuffer& test_buffer); |
125 | 130 |
126 } // namespace webrtc | 131 } // namespace webrtc |
127 | 132 |
128 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 133 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
OLD | NEW |