| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 kBGRA, | 44 kBGRA, |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // This is the max PSNR value our algorithms can return. | 47 // This is the max PSNR value our algorithms can return. |
| 48 const double kPerfectPSNR = 48.0f; | 48 const double kPerfectPSNR = 48.0f; |
| 49 | 49 |
| 50 // Conversion between the RawVideoType and the LibYuv videoType. | 50 // Conversion between the RawVideoType and the LibYuv videoType. |
| 51 // TODO(wu): Consolidate types into one type throughout WebRtc. | 51 // TODO(wu): Consolidate types into one type throughout WebRtc. |
| 52 VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type); | 52 VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type); |
| 53 | 53 |
| 54 // Align integer values. | |
| 55 // Input: | |
| 56 // - value : Input value to be aligned. | |
| 57 // - alignment : Alignment basis (power of 2). | |
| 58 // Return value: An aligned form of the input value. | |
| 59 int AlignInt(int value, int alignment); | |
| 60 | |
| 61 // Align stride values for I420 Video frames. | |
| 62 // Input: | |
| 63 // - width : Image width. | |
| 64 // - stride_y : Pointer to the stride of the y plane. | |
| 65 // - stride_uv: Pointer to the stride of the u and v planes (setting identical | |
| 66 // values for both). | |
| 67 // Setting 16 byte alignment. | |
| 68 void Calc16ByteAlignedStride(int width, int* stride_y, int* stride_uv); | |
| 69 | |
| 70 // Calculate the required buffer size. | 54 // Calculate the required buffer size. |
| 71 // Input: | 55 // Input: |
| 72 // - type :The type of the designated video frame. | 56 // - type :The type of the designated video frame. |
| 73 // - width :frame width in pixels. | 57 // - width :frame width in pixels. |
| 74 // - height :frame height in pixels. | 58 // - height :frame height in pixels. |
| 75 // Return value: :The required size in bytes to accommodate the specified | 59 // Return value: :The required size in bytes to accommodate the specified |
| 76 // video frame. | 60 // video frame. |
| 77 size_t CalcBufferSize(VideoType type, int width, int height); | 61 size_t CalcBufferSize(VideoType type, int width, int height); |
| 78 | 62 |
| 79 // 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. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 // - src_frame : Reference to a source frame. | 105 // - src_frame : Reference to a source frame. |
| 122 // - dst_video_type : Type of output video. | 106 // - dst_video_type : Type of output video. |
| 123 // - dst_sample_size : Required only for the parsing of MJPG. | 107 // - dst_sample_size : Required only for the parsing of MJPG. |
| 124 // - dst_frame : Pointer to a destination frame. | 108 // - dst_frame : Pointer to a destination frame. |
| 125 // Return value: 0 if OK, < 0 otherwise. | 109 // Return value: 0 if OK, < 0 otherwise. |
| 126 // It is assumed that source and destination have equal height. | 110 // It is assumed that source and destination have equal height. |
| 127 int ConvertFromI420(const VideoFrame& src_frame, | 111 int ConvertFromI420(const VideoFrame& src_frame, |
| 128 VideoType dst_video_type, | 112 VideoType dst_video_type, |
| 129 int dst_sample_size, | 113 int dst_sample_size, |
| 130 uint8_t* dst_frame); | 114 uint8_t* dst_frame); |
| 131 // ConvertFrom YV12. | |
| 132 // Interface - same as above. | |
| 133 int ConvertFromYV12(const VideoFrame& src_frame, | |
| 134 VideoType dst_video_type, | |
| 135 int dst_sample_size, | |
| 136 uint8_t* dst_frame); | |
| 137 | 115 |
| 138 // The following list describes designated conversion functions which | |
| 139 // are not covered by the previous general functions. | |
| 140 // Input and output descriptions mostly match the above descriptions, and are | |
| 141 // therefore omitted. | |
| 142 int ConvertRGB24ToARGB(const uint8_t* src_frame, | |
| 143 uint8_t* dst_frame, | |
| 144 int width, int height, | |
| 145 int dst_stride); | |
| 146 int ConvertNV12ToRGB565(const uint8_t* src_frame, | |
| 147 uint8_t* dst_frame, | |
| 148 int width, int height); | |
| 149 | |
| 150 // Compute PSNR for an I420 frame (all planes). | 116 // Compute PSNR for an I420 frame (all planes). |
| 151 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR. | 117 // Returns the PSNR in decibel, to a maximum of kInfinitePSNR. |
| 152 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); | 118 double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); |
| 153 // Compute SSIM for an I420 frame (all planes). | 119 // Compute SSIM for an I420 frame (all planes). |
| 154 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); | 120 double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); |
| 155 | 121 |
| 156 } // namespace webrtc | 122 } // namespace webrtc |
| 157 | 123 |
| 158 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ | 124 #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ |
| OLD | NEW |