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 | 20 |
20 #include "webrtc/common_types.h" // RawVideoTypes. | 21 #include "webrtc/common_types.h" // RawVideoTypes. |
21 #include "webrtc/common_video/rotation.h" | 22 #include "webrtc/common_video/rotation.h" |
22 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
23 #include "webrtc/video_frame.h" | 24 #include "webrtc/video_frame.h" |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
26 | 27 |
27 // Supported video types. | 28 // Supported video types. |
28 enum VideoType { | 29 enum VideoType { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
123 // Compute SSIM for an I420 frame (all planes). | 124 // Compute SSIM for an I420 frame (all planes). |
124 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); | 125 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); |
125 | 126 |
| 127 // Helper class for directly converting and scaling NV12 to I420. The Y-plane |
| 128 // will be scaled directly to the I420 destination, which makes this faster |
| 129 // than separate NV12->I420 + I420->I420 scaling. |
| 130 class NV12ToI420Scaler { |
| 131 public: |
| 132 void NV12ToI420Scale(const uint8_t* src_y, int src_stride_y, |
| 133 const uint8_t* src_uv, int src_stride_uv, |
| 134 int src_width, int src_height, |
| 135 uint8_t* dst_y, int dst_stride_y, |
| 136 uint8_t* dst_u, int dst_stride_u, |
| 137 uint8_t* dst_v, int dst_stride_v, |
| 138 int dst_width, int dst_height); |
| 139 private: |
| 140 std::vector<uint8_t> tmp_uv_planes_; |
| 141 }; |
| 142 |
126 } // namespace webrtc | 143 } // namespace webrtc |
127 | 144 |
128 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 145 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
OLD | NEW |