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 20 matching lines...) Expand all Loading... |
31 // Used for calculating min and max values. | 31 // Used for calculating min and max values. |
32 static bool LessForFrameResultValue(const FrameResult& s1, | 32 static bool LessForFrameResultValue(const FrameResult& s1, |
33 const FrameResult& s2) { | 33 const FrameResult& s2) { |
34 return s1.value < s2.value; | 34 return s1.value < s2.value; |
35 } | 35 } |
36 | 36 |
37 enum VideoMetricsType { kPSNR, kSSIM, kBoth }; | 37 enum VideoMetricsType { kPSNR, kSSIM, kBoth }; |
38 | 38 |
39 // Calculates metrics for a frame and adds statistics to the result for it. | 39 // Calculates metrics for a frame and adds statistics to the result for it. |
40 void CalculateFrame(VideoMetricsType video_metrics_type, | 40 void CalculateFrame(VideoMetricsType video_metrics_type, |
41 const VideoFrameBuffer& ref, | 41 const I420BufferInterface& ref, |
42 const VideoFrameBuffer& test, | 42 const I420BufferInterface& test, |
43 int frame_number, | 43 int frame_number, |
44 QualityMetricsResult* result) { | 44 QualityMetricsResult* result) { |
45 FrameResult frame_result = {0, 0}; | 45 FrameResult frame_result = {0, 0}; |
46 frame_result.frame_number = frame_number; | 46 frame_result.frame_number = frame_number; |
47 switch (video_metrics_type) { | 47 switch (video_metrics_type) { |
48 case kPSNR: | 48 case kPSNR: |
49 frame_result.value = I420PSNR(ref, test); | 49 frame_result.value = I420PSNR(ref, test); |
50 break; | 50 break; |
51 case kSSIM: | 51 case kSSIM: |
52 frame_result.value = I420SSIM(ref, test); | 52 frame_result.value = I420SSIM(ref, test); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int width, | 184 int width, |
185 int height, | 185 int height, |
186 QualityMetricsResult* result) { | 186 QualityMetricsResult* result) { |
187 assert(result != NULL); | 187 assert(result != NULL); |
188 return CalculateMetrics(kSSIM, ref_filename, test_filename, width, height, | 188 return CalculateMetrics(kSSIM, ref_filename, test_filename, width, height, |
189 NULL, result); | 189 NULL, result); |
190 } | 190 } |
191 | 191 |
192 } // namespace test | 192 } // namespace test |
193 } // namespace webrtc | 193 } // namespace webrtc |
OLD | NEW |