| 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 |
| 11 /* | 11 /* |
| 12 * WebRTC's wrapper to libyuv. | 12 * WebRTC's wrapper to libyuv. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 #ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 15 #ifndef WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
| 16 #define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 16 #define WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
| 17 | 17 |
| 18 #include <stdio.h> | 18 #include <stdio.h> |
| 19 #include <vector> | 19 #include <vector> |
| 20 | 20 |
| 21 #include "webrtc/api/video/video_frame.h" |
| 21 #include "webrtc/common_types.h" // RawVideoTypes. | 22 #include "webrtc/common_types.h" // RawVideoTypes. |
| 22 #include "webrtc/common_video/rotation.h" | |
| 23 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
| 24 #include "webrtc/video_frame.h" | |
| 25 | 24 |
| 26 namespace webrtc { | 25 namespace webrtc { |
| 27 | 26 |
| 27 class I420Buffer; |
| 28 |
| 28 // Supported video types. | 29 // Supported video types. |
| 29 enum VideoType { | 30 enum VideoType { |
| 30 kUnknown, | 31 kUnknown, |
| 31 kI420, | 32 kI420, |
| 32 kIYUV, | 33 kIYUV, |
| 33 kRGB24, | 34 kRGB24, |
| 34 kABGR, | 35 kABGR, |
| 35 kARGB, | 36 kARGB, |
| 36 kARGB4444, | 37 kARGB4444, |
| 37 kRGB565, | 38 kRGB565, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // - crop_x/crop_y : Starting positions for cropping (0 for no crop). | 91 // - crop_x/crop_y : Starting positions for cropping (0 for no crop). |
| 91 // - src_width : src width in pixels. | 92 // - src_width : src width in pixels. |
| 92 // - src_height : src height in pixels. | 93 // - src_height : src height in pixels. |
| 93 // - sample_size : Required only for the parsing of MJPG (set to 0 else). | 94 // - sample_size : Required only for the parsing of MJPG (set to 0 else). |
| 94 // - rotate : Rotation mode of output image. | 95 // - rotate : Rotation mode of output image. |
| 95 // Output: | 96 // Output: |
| 96 // - dst_buffer : Reference to a destination frame buffer. | 97 // - dst_buffer : Reference to a destination frame buffer. |
| 97 // Return value: 0 if OK, < 0 otherwise. | 98 // Return value: 0 if OK, < 0 otherwise. |
| 98 | 99 |
| 99 // TODO(nisse): Delete this wrapper, and let users call libyuv directly. Most | 100 // TODO(nisse): Delete this wrapper, and let users call libyuv directly. Most |
| 100 // calls pass |src_video_type| == kI420, and should use libyuv::I420Copy. The | 101 // calls pass |src_video_type| == kI420, and should use libyuv::I420Copy. Also |
| 101 // only exception at the time of this writing is | 102 // remember to delete the I420Buffer forward declaration above. The only |
| 102 // VideoCaptureImpl::IncomingFrame, which still needs libyuv::ConvertToI420. | 103 // exception at the time of this writing is VideoCaptureImpl::IncomingFrame, |
| 104 // which still needs libyuv::ConvertToI420. |
| 103 int ConvertToI420(VideoType src_video_type, | 105 int ConvertToI420(VideoType src_video_type, |
| 104 const uint8_t* src_frame, | 106 const uint8_t* src_frame, |
| 105 int crop_x, | 107 int crop_x, |
| 106 int crop_y, | 108 int crop_y, |
| 107 int src_width, | 109 int src_width, |
| 108 int src_height, | 110 int src_height, |
| 109 size_t sample_size, | 111 size_t sample_size, |
| 110 VideoRotation rotation, | 112 VideoRotation rotation, |
| 111 I420Buffer* dst_buffer); | 113 I420Buffer* dst_buffer); |
| 112 | 114 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 uint8_t* dst_u, int dst_stride_u, | 157 uint8_t* dst_u, int dst_stride_u, |
| 156 uint8_t* dst_v, int dst_stride_v, | 158 uint8_t* dst_v, int dst_stride_v, |
| 157 int dst_width, int dst_height); | 159 int dst_width, int dst_height); |
| 158 private: | 160 private: |
| 159 std::vector<uint8_t> tmp_uv_planes_; | 161 std::vector<uint8_t> tmp_uv_planes_; |
| 160 }; | 162 }; |
| 161 | 163 |
| 162 } // namespace webrtc | 164 } // namespace webrtc |
| 163 | 165 |
| 164 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 166 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
| OLD | NEW |