| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // position in the original video. We should provide a statistics file along | 46 // position in the original video. We should provide a statistics file along |
| 47 // with the test video. The stats file contains the connection between the | 47 // with the test video. The stats file contains the connection between the |
| 48 // actual frames in the test file and their position in the reference video, so | 48 // actual frames in the test file and their position in the reference video, so |
| 49 // that the analysis could run with the right frames from both videos. The stats | 49 // that the analysis could run with the right frames from both videos. The stats |
| 50 // file should be in the form 'frame_xxxx yyyy', where xxxx is the consecutive | 50 // file should be in the form 'frame_xxxx yyyy', where xxxx is the consecutive |
| 51 // number of the frame in the test video, and yyyy is the equivalent frame in | 51 // number of the frame in the test video, and yyyy is the equivalent frame in |
| 52 // the reference video. The stats file could be produced by | 52 // the reference video. The stats file could be produced by |
| 53 // tools/barcode_tools/barcode_decoder.py. This script decodes the barcodes | 53 // tools/barcode_tools/barcode_decoder.py. This script decodes the barcodes |
| 54 // integrated in every video and generates the stats file. If three was some | 54 // integrated in every video and generates the stats file. If three was some |
| 55 // problem with the decoding there would be 'Barcode error' instead of yyyy. | 55 // problem with the decoding there would be 'Barcode error' instead of yyyy. |
| 56 void RunAnalysis(const char* reference_file_name, const char* test_file_name, | 56 void RunAnalysis(const char* reference_file_name, |
| 57 const char* stats_file_name, int width, int height, | 57 const char* test_file_name, |
| 58 const char* stats_file_reference_name, |
| 59 const char* stats_file_test_name, |
| 60 int width, |
| 61 int height, |
| 58 ResultsContainer* results); | 62 ResultsContainer* results); |
| 59 | 63 |
| 60 // Compute PSNR or SSIM for an I420 frame (all planes). When we are calculating | 64 // Compute PSNR or SSIM for an I420 frame (all planes). When we are calculating |
| 61 // PSNR values, the max return value (in the case where the test and reference | 65 // PSNR values, the max return value (in the case where the test and reference |
| 62 // frames are exactly the same) will be 48. In the case of SSIM the max return | 66 // frames are exactly the same) will be 48. In the case of SSIM the max return |
| 63 // value will be 1. | 67 // value will be 1. |
| 64 double CalculateMetrics(VideoAnalysisMetricsType video_metrics_type, | 68 double CalculateMetrics(VideoAnalysisMetricsType video_metrics_type, |
| 65 const uint8_t* ref_frame, | 69 const uint8_t* ref_frame, |
| 66 const uint8_t* test_frame, | 70 const uint8_t* test_frame, |
| 67 int width, | 71 int width, |
| 68 int height); | 72 int height); |
| 69 | 73 |
| 70 // Prints the result from the analysis in Chromium performance | 74 // Prints the result from the analysis in Chromium performance |
| 71 // numbers compatible format to stdout. If the results object contains no frames | 75 // numbers compatible format to stdout. If the results object contains no frames |
| 72 // no output will be written. | 76 // no output will be written. |
| 73 void PrintAnalysisResults(const std::string& label, ResultsContainer* results); | 77 void PrintAnalysisResults(const std::string& label, ResultsContainer* results); |
| 74 | 78 |
| 75 // Similar to the above, but will print to the specified file handle. | 79 // Similar to the above, but will print to the specified file handle. |
| 76 void PrintAnalysisResults(FILE* output, const std::string& label, | 80 void PrintAnalysisResults(FILE* output, const std::string& label, |
| 77 ResultsContainer* results); | 81 ResultsContainer* results); |
| 78 | 82 |
| 79 // Calculates max repeated and skipped frames and prints them to stdout in a | 83 // Calculates max repeated and skipped frames and prints them to stdout in a |
| 80 // format that is compatible with Chromium performance numbers. | 84 // format that is compatible with Chromium performance numbers. |
| 81 void PrintMaxRepeatedAndSkippedFrames(const std::string& label, | 85 void PrintMaxRepeatedAndSkippedFrames(const std::string& label, |
| 82 const std::string& stats_file_name); | 86 const std::string& stats_file_ref_name, |
| 87 const std::string& stats_file_test_name); |
| 83 | 88 |
| 84 // Similar to the above, but will print to the specified file handle. | 89 // Similar to the above, but will print to the specified file handle. |
| 85 void PrintMaxRepeatedAndSkippedFrames(FILE* output, const std::string& label, | 90 void PrintMaxRepeatedAndSkippedFrames(FILE* output, |
| 86 const std::string& stats_file_name); | 91 const std::string& label, |
| 92 const std::string& stats_file_ref_name, |
| 93 const std::string& stats_file_test_name); |
| 87 | 94 |
| 88 // Gets the next line from an open stats file. | 95 // Gets the next line from an open stats file. |
| 89 bool GetNextStatsLine(FILE* stats_file, char* line); | 96 bool GetNextStatsLine(FILE* stats_file, char* line); |
| 90 | 97 |
| 91 // Calculates the size of a I420 frame if given the width and height. | 98 // Calculates the size of a I420 frame if given the width and height. |
| 92 int GetI420FrameSize(int width, int height); | 99 int GetI420FrameSize(int width, int height); |
| 93 | 100 |
| 94 // Extract the sequence of the frame in the video. I.e. if line is | 101 // Extract the sequence of the frame in the video. I.e. if line is |
| 95 // frame_0023 0284, we will get 23. | 102 // frame_0023 0284, we will get 23. |
| 96 int ExtractFrameSequenceNumber(std::string line); | 103 int ExtractFrameSequenceNumber(std::string line); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 114 bool ExtractFrameFromY4mFile(const char* i420_file_name, | 121 bool ExtractFrameFromY4mFile(const char* i420_file_name, |
| 115 int width, | 122 int width, |
| 116 int height, | 123 int height, |
| 117 int frame_number, | 124 int frame_number, |
| 118 uint8_t* result_frame); | 125 uint8_t* result_frame); |
| 119 | 126 |
| 120 } // namespace test | 127 } // namespace test |
| 121 } // namespace webrtc | 128 } // namespace webrtc |
| 122 | 129 |
| 123 #endif // WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ | 130 #endif // WEBRTC_TOOLS_FRAME_ANALYZER_VIDEO_QUALITY_ANALYSIS_H_ |
| OLD | NEW |