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 23 matching lines...) Expand all Loading... | |
34 * | 34 * |
35 * The max value for PSNR is 48.0 (between equal frames), as for SSIM it is 1.0. | 35 * The max value for PSNR is 48.0 (between equal frames), as for SSIM it is 1.0. |
36 * | 36 * |
37 * Usage: | 37 * Usage: |
38 * frame_analyzer --label=<test_label> --reference_file=<name_of_file> | 38 * frame_analyzer --label=<test_label> --reference_file=<name_of_file> |
39 * --test_file=<name_of_file> --stats_file=<name_of_file> --width=<frame_width> | 39 * --test_file=<name_of_file> --stats_file=<name_of_file> --width=<frame_width> |
40 * --height=<frame_height> | 40 * --height=<frame_height> |
41 */ | 41 */ |
42 int main(int argc, char** argv) { | 42 int main(int argc, char** argv) { |
43 std::string program_name = argv[0]; | 43 std::string program_name = argv[0]; |
44 std::string usage = "Compares the output video with the initially sent video." | 44 // TODO(mandermo) fix comment |
phoglund
2016/12/08 09:55:44
...yes :)
mandermo
2016/12/08 18:08:30
Done.
phoglund
2016/12/12 12:46:20
... Also remove the TODO
mandermo
2016/12/21 16:42:06
Done.
| |
45 "\nExample usage:\n" + program_name + " --stats_file=stats.txt " | 45 std::string usage = |
46 "Compares the output video with the initially sent video." | |
47 "\nExample usage:\n" + | |
48 program_name + | |
49 " --stats_file=stats.txt " | |
46 "--reference_file=ref.yuv --test_file=test.yuv --width=320 --height=240\n" | 50 "--reference_file=ref.yuv --test_file=test.yuv --width=320 --height=240\n" |
47 "Command line flags:\n" | 51 "Command line flags:\n" |
48 " - width(int): The width of the reference and test files. Default: -1\n" | 52 " - width(int): The width of the reference and test files. Default: -1\n" |
49 " - height(int): The height of the reference and test files. " | 53 " - height(int): The height of the reference and test files. " |
50 " Default: -1\n" | 54 " Default: -1\n" |
51 " - label(string): The label to use for the perf output." | 55 " - label(string): The label to use for the perf output." |
52 " Default: MY_TEST\n" | 56 " Default: MY_TEST\n" |
53 " - stats_file(string): The full name of the file containing the stats" | 57 " - stats_file(string): The full name of the file containing the stats" |
54 " after decoding of the received YUV video. Default: stats.txt\n" | 58 " after decoding of the received YUV video. Default: stats.txt\n" |
55 " - reference_file(string): The reference YUV file to compare against." | 59 " - reference_file(string): The reference YUV file to compare against." |
56 " Default: ref.yuv\n" | 60 " Default: ref.yuv\n" |
57 " - test_file(string): The test YUV file to run the analysis for." | 61 " - test_file(string): The test YUV file to run the analysis for." |
58 " Default: test_file.yuv\n"; | 62 " Default: test_file.yuv\n"; |
59 | 63 |
60 webrtc::test::CommandLineParser parser; | 64 webrtc::test::CommandLineParser parser; |
61 | 65 |
62 // Init the parser and set the usage message | 66 // Init the parser and set the usage message |
63 parser.Init(argc, argv); | 67 parser.Init(argc, argv); |
64 parser.SetUsageMessage(usage); | 68 parser.SetUsageMessage(usage); |
65 | 69 |
66 parser.SetFlag("width", "-1"); | 70 parser.SetFlag("width", "-1"); |
67 parser.SetFlag("height", "-1"); | 71 parser.SetFlag("height", "-1"); |
68 parser.SetFlag("label", "MY_TEST"); | 72 parser.SetFlag("label", "MY_TEST"); |
69 parser.SetFlag("stats_file", "stats.txt"); | 73 parser.SetFlag("stats_file_ref", "stats_ref.txt"); |
74 parser.SetFlag("stats_file_test", "stats_test.txt"); | |
70 parser.SetFlag("reference_file", "ref.yuv"); | 75 parser.SetFlag("reference_file", "ref.yuv"); |
71 parser.SetFlag("test_file", "test.yuv"); | 76 parser.SetFlag("test_file", "test.yuv"); |
72 parser.SetFlag("help", "false"); | 77 parser.SetFlag("help", "false"); |
73 | 78 |
74 parser.ProcessFlags(); | 79 parser.ProcessFlags(); |
75 if (parser.GetFlag("help") == "true") { | 80 if (parser.GetFlag("help") == "true") { |
76 parser.PrintUsageMessage(); | 81 parser.PrintUsageMessage(); |
77 exit(EXIT_SUCCESS); | 82 exit(EXIT_SUCCESS); |
78 } | 83 } |
79 parser.PrintEnteredFlags(); | 84 parser.PrintEnteredFlags(); |
80 | 85 |
81 int width = strtol((parser.GetFlag("width")).c_str(), NULL, 10); | 86 int width = strtol((parser.GetFlag("width")).c_str(), NULL, 10); |
82 int height = strtol((parser.GetFlag("height")).c_str(), NULL, 10); | 87 int height = strtol((parser.GetFlag("height")).c_str(), NULL, 10); |
83 | 88 |
84 if (width <= 0 || height <= 0) { | 89 if (width <= 0 || height <= 0) { |
85 fprintf(stderr, "Error: width or height cannot be <= 0!\n"); | 90 fprintf(stderr, "Error: width or height cannot be <= 0!\n"); |
86 return -1; | 91 return -1; |
87 } | 92 } |
88 | 93 |
89 webrtc::test::ResultsContainer results; | 94 webrtc::test::ResultsContainer results; |
90 | 95 |
91 webrtc::test::RunAnalysis(parser.GetFlag("reference_file").c_str(), | 96 webrtc::test::RunAnalysis(parser.GetFlag("reference_file").c_str(), |
92 parser.GetFlag("test_file").c_str(), | 97 parser.GetFlag("test_file").c_str(), |
93 parser.GetFlag("stats_file").c_str(), width, height, | 98 parser.GetFlag("stats_file_ref").c_str(), |
94 &results); | 99 parser.GetFlag("stats_file_test").c_str(), width, |
100 height, &results); | |
95 | 101 |
96 std::string label = parser.GetFlag("label"); | 102 std::string label = parser.GetFlag("label"); |
97 webrtc::test::PrintAnalysisResults(label, &results); | 103 webrtc::test::PrintAnalysisResults(label, &results); |
98 webrtc::test::PrintMaxRepeatedAndSkippedFrames(label, | 104 webrtc::test::PrintMaxRepeatedAndSkippedFrames( |
99 parser.GetFlag("stats_file")); | 105 label, parser.GetFlag("stats_file_ref"), |
106 parser.GetFlag("stats_file_test")); | |
100 } | 107 } |
OLD | NEW |