| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 size_t CalcBufferSize(VideoType type, int width, int height); | 62 size_t CalcBufferSize(VideoType type, int width, int height); |
| 63 | 63 |
| 64 // TODO(mikhal): Add unit test for these two functions and determine location. | 64 // TODO(mikhal): Add unit test for these two functions and determine location. |
| 65 // Print VideoFrame to file | 65 // Print VideoFrame to file |
| 66 // Input: | 66 // Input: |
| 67 // - frame : Reference to video frame. | 67 // - frame : Reference to video frame. |
| 68 // - file : pointer to file object. It is assumed that the file is | 68 // - file : pointer to file object. It is assumed that the file is |
| 69 // already open for writing. | 69 // already open for writing. |
| 70 // Return value: 0 if OK, < 0 otherwise. | 70 // Return value: 0 if OK, < 0 otherwise. |
| 71 int PrintVideoFrame(const VideoFrame& frame, FILE* file); | 71 int PrintVideoFrame(const VideoFrame& frame, FILE* file); |
| 72 int PrintVideoFrame(const VideoFrameBuffer& frame, FILE* file); |
| 72 | 73 |
| 73 // Extract buffer from VideoFrame or VideoFrameBuffer (consecutive | 74 // Extract buffer from VideoFrame or VideoFrameBuffer (consecutive |
| 74 // planes, no stride) | 75 // planes, no stride) |
| 75 // Input: | 76 // Input: |
| 76 // - frame : Reference to video frame. | 77 // - frame : Reference to video frame. |
| 77 // - size : pointer to the size of the allocated buffer. If size is | 78 // - size : pointer to the size of the allocated buffer. If size is |
| 78 // insufficient, an error will be returned. | 79 // insufficient, an error will be returned. |
| 79 // - buffer : Pointer to buffer | 80 // - buffer : Pointer to buffer |
| 80 // Return value: length of buffer if OK, < 0 otherwise. | 81 // Return value: length of buffer if OK, < 0 otherwise. |
| 81 int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame, | 82 int ExtractBuffer(const rtc::scoped_refptr<VideoFrameBuffer>& input_frame, |
| 82 size_t size, | 83 size_t size, |
| 83 uint8_t* buffer); | 84 uint8_t* buffer); |
| 84 int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer); | 85 int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer); |
| 85 // Convert To I420 | 86 // Convert To I420 |
| 86 // Input: | 87 // Input: |
| 87 // - src_video_type : Type of input video. | 88 // - src_video_type : Type of input video. |
| 88 // - src_frame : Pointer to a source frame. | 89 // - src_frame : Pointer to a source frame. |
| 89 // - crop_x/crop_y : Starting positions for cropping (0 for no crop). | 90 // - crop_x/crop_y : Starting positions for cropping (0 for no crop). |
| 90 // - src_width : src width in pixels. | 91 // - src_width : src width in pixels. |
| 91 // - src_height : src height in pixels. | 92 // - src_height : src height in pixels. |
| 92 // - sample_size : Required only for the parsing of MJPG (set to 0 else). | 93 // - sample_size : Required only for the parsing of MJPG (set to 0 else). |
| 93 // - rotate : Rotation mode of output image. | 94 // - rotate : Rotation mode of output image. |
| 94 // Output: | 95 // Output: |
| 95 // - dst_frame : Reference to a destination frame. | 96 // - dst_buffer : Reference to a destination frame buffer. |
| 96 // Return value: 0 if OK, < 0 otherwise. | 97 // Return value: 0 if OK, < 0 otherwise. |
| 97 | 98 |
| 98 // TODO(nisse): Deprecated, see | 99 // TODO(nisse): Delete this wrapper, and let users call libyuv directly. Most |
| 99 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5921. | 100 // calls pass |src_video_type| == kI420, and should use libyuv::I420Copy. The |
| 101 // only exception at the time of this writing is |
| 102 // VideoCaptureImpl::IncomingFrame, which still needs libyuv::ConvertToI420. |
| 100 int ConvertToI420(VideoType src_video_type, | 103 int ConvertToI420(VideoType src_video_type, |
| 101 const uint8_t* src_frame, | 104 const uint8_t* src_frame, |
| 102 int crop_x, | 105 int crop_x, |
| 103 int crop_y, | 106 int crop_y, |
| 104 int src_width, | 107 int src_width, |
| 105 int src_height, | 108 int src_height, |
| 106 size_t sample_size, | 109 size_t sample_size, |
| 107 VideoRotation rotation, | 110 VideoRotation rotation, |
| 108 VideoFrame* dst_frame); | 111 I420Buffer* dst_buffer); |
| 109 | 112 |
| 110 // Convert From I420 | 113 // Convert From I420 |
| 111 // Input: | 114 // Input: |
| 112 // - src_frame : Reference to a source frame. | 115 // - src_frame : Reference to a source frame. |
| 113 // - dst_video_type : Type of output video. | 116 // - dst_video_type : Type of output video. |
| 114 // - dst_sample_size : Required only for the parsing of MJPG. | 117 // - dst_sample_size : Required only for the parsing of MJPG. |
| 115 // - dst_frame : Pointer to a destination frame. | 118 // - dst_frame : Pointer to a destination frame. |
| 116 // Return value: 0 if OK, < 0 otherwise. | 119 // Return value: 0 if OK, < 0 otherwise. |
| 117 // It is assumed that source and destination have equal height. | 120 // It is assumed that source and destination have equal height. |
| 118 int ConvertFromI420(const VideoFrame& src_frame, | 121 int ConvertFromI420(const VideoFrame& src_frame, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 143 uint8_t* dst_u, int dst_stride_u, | 146 uint8_t* dst_u, int dst_stride_u, |
| 144 uint8_t* dst_v, int dst_stride_v, | 147 uint8_t* dst_v, int dst_stride_v, |
| 145 int dst_width, int dst_height); | 148 int dst_width, int dst_height); |
| 146 private: | 149 private: |
| 147 std::vector<uint8_t> tmp_uv_planes_; | 150 std::vector<uint8_t> tmp_uv_planes_; |
| 148 }; | 151 }; |
| 149 | 152 |
| 150 } // namespace webrtc | 153 } // namespace webrtc |
| 151 | 154 |
| 152 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 155 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
| OLD | NEW |