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 #ifndef WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ | 11 #ifndef WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ |
12 #define WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ | 12 #define WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
| 16 #include <utility> |
16 | 17 |
17 #include "libyuv/compare.h" // NOLINT | 18 #include "libyuv/compare.h" // NOLINT |
18 #include "libyuv/convert.h" // NOLINT | 19 #include "libyuv/convert.h" // NOLINT |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 namespace test { | 22 namespace test { |
22 | 23 |
23 struct AnalysisResult { | 24 struct AnalysisResult { |
24 AnalysisResult() {} | 25 AnalysisResult() {} |
25 AnalysisResult(int frame_number, double psnr_value, double ssim_value) | 26 AnalysisResult(int frame_number, double psnr_value, double ssim_value) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 76 |
76 // Prints the result from the analysis in Chromium performance | 77 // Prints the result from the analysis in Chromium performance |
77 // numbers compatible format to stdout. If the results object contains no frames | 78 // numbers compatible format to stdout. If the results object contains no frames |
78 // no output will be written. | 79 // no output will be written. |
79 void PrintAnalysisResults(const std::string& label, ResultsContainer* results); | 80 void PrintAnalysisResults(const std::string& label, ResultsContainer* results); |
80 | 81 |
81 // Similar to the above, but will print to the specified file handle. | 82 // Similar to the above, but will print to the specified file handle. |
82 void PrintAnalysisResults(FILE* output, const std::string& label, | 83 void PrintAnalysisResults(FILE* output, const std::string& label, |
83 ResultsContainer* results); | 84 ResultsContainer* results); |
84 | 85 |
| 86 // The barcode number that means that the barcode could not be decoded. |
| 87 const int DECODE_ERROR = -1; |
| 88 |
| 89 // Clusters the frames in the file. First in the pair is the frame number and |
| 90 // second is the number of frames in that cluster. So if first frame in video |
| 91 // has number 100 and it is repeated 3 after each other, then the first entry |
| 92 // in the returned vector has first set to 100 and second set to 3. |
| 93 // Decode errors between two frames with same barcode, then it interprets |
| 94 // the frame with the decode error as having the same id as the two frames |
| 95 // around it. Eg. [400, DECODE_ERROR, DECODE_ERROR, 400] is becomes an entry |
| 96 // in return vector with first==400 and second==4. In other cases with decode |
| 97 // errors like [400, DECODE_ERROR, 401] becomes three entries, each with |
| 98 // second==1 and the middle has first==DECODE_ERROR. |
| 99 std::vector<std::pair<int, int> > CalculateFrameClusters( |
| 100 FILE* file, |
| 101 int* num_decode_errors); |
| 102 |
85 // Calculates max repeated and skipped frames and prints them to stdout in a | 103 // Calculates max repeated and skipped frames and prints them to stdout in a |
86 // format that is compatible with Chromium performance numbers. | 104 // format that is compatible with Chromium performance numbers. |
87 void PrintMaxRepeatedAndSkippedFrames(const std::string& label, | 105 void PrintMaxRepeatedAndSkippedFrames(const std::string& label, |
88 const std::string& stats_file_ref_name, | 106 const std::string& stats_file_ref_name, |
89 const std::string& stats_file_test_name); | 107 const std::string& stats_file_test_name); |
90 | 108 |
91 // Similar to the above, but will print to the specified file handle. | 109 // Similar to the above, but will print to the specified file handle. |
92 void PrintMaxRepeatedAndSkippedFrames(FILE* output, | 110 void PrintMaxRepeatedAndSkippedFrames(FILE* output, |
93 const std::string& label, | 111 const std::string& label, |
94 const std::string& stats_file_ref_name, | 112 const std::string& stats_file_ref_name, |
(...skipping 28 matching lines...) Expand all Loading... |
123 bool ExtractFrameFromY4mFile(const char* i420_file_name, | 141 bool ExtractFrameFromY4mFile(const char* i420_file_name, |
124 int width, | 142 int width, |
125 int height, | 143 int height, |
126 int frame_number, | 144 int frame_number, |
127 uint8_t* result_frame); | 145 uint8_t* result_frame); |
128 | 146 |
129 } // namespace test | 147 } // namespace test |
130 } // namespace webrtc | 148 } // namespace webrtc |
131 | 149 |
132 #endif // WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ | 150 #endif // WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ |
OLD | NEW |