Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: webrtc/tools/frame_analyzer/frame_analyzer.cc

Issue 2553693002: Comparison of videos with reference frame not starting from zero (Closed)
Patch Set: Added newline in debug prints for PrintMaxRepeatedAndSkippedFrames Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/tools/compare_videos.py ('k') | webrtc/tools/frame_analyzer/video_quality_analysis.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdio.h> 11 #include <stdio.h>
12 #include <stdlib.h> 12 #include <stdlib.h>
13 13
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/tools/frame_analyzer/video_quality_analysis.h" 18 #include "webrtc/tools/frame_analyzer/video_quality_analysis.h"
19 #include "webrtc/tools/simple_command_line_parser.h" 19 #include "webrtc/tools/simple_command_line_parser.h"
20 20
21 /* 21 /*
22 * A command line tool running PSNR and SSIM on a reference video and a test 22 * A command line tool running PSNR and SSIM on a reference video and a test
23 * video. The test video is a record of the reference video which can start at 23 * video. The test video is a record of the reference video which can start at
24 * an arbitrary point. It is possible that there will be repeated frames or 24 * an arbitrary point. It is possible that there will be repeated frames or
25 * skipped frames as well. In order to have a way to compare corresponding 25 * skipped frames as well. In order to have a way to compare corresponding
26 * frames from the two videos, a stats file should be provided. The stats file 26 * frames from the two videos, two stats files should be provided. One for the
27 * reference video and one for the test video. The stats file
27 * is a text file assumed to be in the format: 28 * is a text file assumed to be in the format:
28 * frame_xxxx yyyy 29 * frame_xxxx yyyy where xxxx is the frame number in and yyyy is the
29 * where xxxx is the frame number in the test video and yyyy is the 30 * corresponding barcode. The video files should be 1420 YUV videos.
30 * corresponding frame number in the original video.
31 * The video files should be 1420 YUV videos.
32 * The tool prints the result to standard output in the Chromium perf format: 31 * The tool prints the result to standard output in the Chromium perf format:
33 * RESULT <metric>:<label>= <values> 32 * RESULT <metric>:<label>= <values>
34 * 33 *
35 * The max value for PSNR is 48.0 (between equal frames), as for SSIM it is 1.0. 34 * The max value for PSNR is 48.0 (between equal frames), as for SSIM it is 1.0.
36 * 35 *
37 * Usage: 36 * Usage:
38 * frame_analyzer --label=<test_label> --reference_file=<name_of_file> 37 * frame_analyzer --label=<test_label> --reference_file=<name_of_file>
39 * --test_file=<name_of_file> --stats_file=<name_of_file> --width=<frame_width> 38 * --test_file_ref=<name_of_file> --stats_file_test=<name_of_file>
39 * --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 std::string usage =
45 "\nExample usage:\n" + program_name + " --stats_file=stats.txt " 45 "Compares the output video with the initially sent video."
46 "--reference_file=ref.yuv --test_file=test.yuv --width=320 --height=240\n" 46 "\nExample usage:\n" +
47 program_name +
48 " --reference_file=ref.yuv --test_file=test.yuv --width=320 "
49 "--height=240\n"
47 "Command line flags:\n" 50 "Command line flags:\n"
48 " - width(int): The width of the reference and test files. Default: -1\n" 51 " - width(int): The width of the reference and test files. Default: -1\n"
49 " - height(int): The height of the reference and test files. " 52 " - height(int): The height of the reference and test files. "
50 " Default: -1\n" 53 " Default: -1\n"
51 " - label(string): The label to use for the perf output." 54 " - label(string): The label to use for the perf output."
52 " Default: MY_TEST\n" 55 " Default: MY_TEST\n"
53 " - stats_file(string): The full name of the file containing the stats" 56 " - stats_file_ref(string): The path to the stats file that will be"
54 " after decoding of the received YUV video. Default: stats.txt\n" 57 " produced for the reference video file."
58 " Default: stats_ref.txt\n"
59 " - stats_file_test(string): The path to the stats file that will be"
60 " produced for the test video file."
61 " Default: stats_test.txt\n"
55 " - reference_file(string): The reference YUV file to compare against." 62 " - reference_file(string): The reference YUV file to compare against."
56 " Default: ref.yuv\n" 63 " Default: ref.yuv\n"
57 " - test_file(string): The test YUV file to run the analysis for." 64 " - test_file(string): The test YUV file to run the analysis for."
58 " Default: test_file.yuv\n"; 65 " Default: test_file.yuv\n";
59 66
60 webrtc::test::CommandLineParser parser; 67 webrtc::test::CommandLineParser parser;
61 68
62 // Init the parser and set the usage message 69 // Init the parser and set the usage message
63 parser.Init(argc, argv); 70 parser.Init(argc, argv);
64 parser.SetUsageMessage(usage); 71 parser.SetUsageMessage(usage);
65 72
66 parser.SetFlag("width", "-1"); 73 parser.SetFlag("width", "-1");
67 parser.SetFlag("height", "-1"); 74 parser.SetFlag("height", "-1");
68 parser.SetFlag("label", "MY_TEST"); 75 parser.SetFlag("label", "MY_TEST");
69 parser.SetFlag("stats_file", "stats.txt"); 76 parser.SetFlag("stats_file_ref", "stats_ref.txt");
77 parser.SetFlag("stats_file_test", "stats_test.txt");
70 parser.SetFlag("reference_file", "ref.yuv"); 78 parser.SetFlag("reference_file", "ref.yuv");
71 parser.SetFlag("test_file", "test.yuv"); 79 parser.SetFlag("test_file", "test.yuv");
72 parser.SetFlag("help", "false"); 80 parser.SetFlag("help", "false");
73 81
74 parser.ProcessFlags(); 82 parser.ProcessFlags();
75 if (parser.GetFlag("help") == "true") { 83 if (parser.GetFlag("help") == "true") {
76 parser.PrintUsageMessage(); 84 parser.PrintUsageMessage();
77 exit(EXIT_SUCCESS); 85 exit(EXIT_SUCCESS);
78 } 86 }
79 parser.PrintEnteredFlags(); 87 parser.PrintEnteredFlags();
80 88
81 int width = strtol((parser.GetFlag("width")).c_str(), NULL, 10); 89 int width = strtol((parser.GetFlag("width")).c_str(), NULL, 10);
82 int height = strtol((parser.GetFlag("height")).c_str(), NULL, 10); 90 int height = strtol((parser.GetFlag("height")).c_str(), NULL, 10);
83 91
84 if (width <= 0 || height <= 0) { 92 if (width <= 0 || height <= 0) {
85 fprintf(stderr, "Error: width or height cannot be <= 0!\n"); 93 fprintf(stderr, "Error: width or height cannot be <= 0!\n");
86 return -1; 94 return -1;
87 } 95 }
88 96
89 webrtc::test::ResultsContainer results; 97 webrtc::test::ResultsContainer results;
90 98
91 webrtc::test::RunAnalysis(parser.GetFlag("reference_file").c_str(), 99 webrtc::test::RunAnalysis(parser.GetFlag("reference_file").c_str(),
92 parser.GetFlag("test_file").c_str(), 100 parser.GetFlag("test_file").c_str(),
93 parser.GetFlag("stats_file").c_str(), width, height, 101 parser.GetFlag("stats_file_ref").c_str(),
94 &results); 102 parser.GetFlag("stats_file_test").c_str(), width,
103 height, &results);
95 104
96 std::string label = parser.GetFlag("label"); 105 std::string label = parser.GetFlag("label");
97 webrtc::test::PrintAnalysisResults(label, &results); 106 webrtc::test::PrintAnalysisResults(label, &results);
98 webrtc::test::PrintMaxRepeatedAndSkippedFrames(label, 107 webrtc::test::PrintMaxRepeatedAndSkippedFrames(
99 parser.GetFlag("stats_file")); 108 label, parser.GetFlag("stats_file_ref"),
109 parser.GetFlag("stats_file_test"));
100 } 110 }
OLDNEW
« no previous file with comments | « webrtc/tools/compare_videos.py ('k') | webrtc/tools/frame_analyzer/video_quality_analysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698