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

Side by Side Diff: webrtc/modules/video_coding/codecs/tools/video_quality_measurement.cc

Issue 1228913003: Remove empty-string comparisons. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 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
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
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 va_end(args); 104 va_end(args);
105 } 105 }
106 return result; 106 return result;
107 } 107 }
108 108
109 // Validates the arguments given as command line flags and fills in the 109 // Validates the arguments given as command line flags and fills in the
110 // TestConfig struct with all configurations needed for video processing. 110 // TestConfig struct with all configurations needed for video processing.
111 // Returns 0 if everything is OK, otherwise an exit code. 111 // Returns 0 if everything is OK, otherwise an exit code.
112 int HandleCommandLineFlags(webrtc::test::TestConfig* config) { 112 int HandleCommandLineFlags(webrtc::test::TestConfig* config) {
113 // Validate the mandatory flags: 113 // Validate the mandatory flags:
114 if (FLAGS_input_filename == "" || FLAGS_width == -1 || FLAGS_height == -1) { 114 if (FLAGS_input_filename.empty() || FLAGS_width == -1 || FLAGS_height == -1) {
115 printf("%s\n", google::ProgramUsage()); 115 printf("%s\n", google::ProgramUsage());
116 return 1; 116 return 1;
117 } 117 }
118 config->name = FLAGS_test_name; 118 config->name = FLAGS_test_name;
119 config->description = FLAGS_test_description; 119 config->description = FLAGS_test_description;
120 120
121 // Verify the input file exists and is readable. 121 // Verify the input file exists and is readable.
122 FILE* test_file; 122 FILE* test_file;
123 test_file = fopen(FLAGS_input_filename.c_str(), "rb"); 123 test_file = fopen(FLAGS_input_filename.c_str(), "rb");
124 if (test_file == NULL) { 124 if (test_file == NULL) {
125 fprintf(stderr, "Cannot read the specified input file: %s\n", 125 fprintf(stderr, "Cannot read the specified input file: %s\n",
126 FLAGS_input_filename.c_str()); 126 FLAGS_input_filename.c_str());
127 return 2; 127 return 2;
128 } 128 }
129 fclose(test_file); 129 fclose(test_file);
130 config->input_filename = FLAGS_input_filename; 130 config->input_filename = FLAGS_input_filename;
131 131
132 // Verify the output dir exists. 132 // Verify the output dir exists.
133 struct stat dir_info; 133 struct stat dir_info;
134 if (!(stat(FLAGS_output_dir.c_str(), &dir_info) == 0 && 134 if (!(stat(FLAGS_output_dir.c_str(), &dir_info) == 0 &&
135 S_ISDIR(dir_info.st_mode))) { 135 S_ISDIR(dir_info.st_mode))) {
136 fprintf(stderr, "Cannot find output directory: %s\n", 136 fprintf(stderr, "Cannot find output directory: %s\n",
137 FLAGS_output_dir.c_str()); 137 FLAGS_output_dir.c_str());
138 return 3; 138 return 3;
139 } 139 }
140 config->output_dir = FLAGS_output_dir; 140 config->output_dir = FLAGS_output_dir;
141 141
142 // Manufacture an output filename if none was given. 142 // Manufacture an output filename if none was given.
143 if (FLAGS_output_filename == "") { 143 if (FLAGS_output_filename.empty()) {
144 // Cut out the filename without extension from the given input file 144 // Cut out the filename without extension from the given input file
145 // (which may include a path) 145 // (which may include a path)
146 int startIndex = FLAGS_input_filename.find_last_of("/") + 1; 146 int startIndex = FLAGS_input_filename.find_last_of("/") + 1;
147 if (startIndex == 0) { 147 if (startIndex == 0) {
148 startIndex = 0; 148 startIndex = 0;
149 } 149 }
150 FLAGS_output_filename = 150 FLAGS_output_filename =
151 FLAGS_input_filename.substr(startIndex, 151 FLAGS_input_filename.substr(startIndex,
152 FLAGS_input_filename.find_last_of(".") 152 FLAGS_input_filename.find_last_of(".")
153 - startIndex) + "_out.yuv"; 153 - startIndex) + "_out.yuv";
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 519 }
520 if (FLAGS_python) { 520 if (FLAGS_python) {
521 PrintPythonOutput(config, stats, ssim_result, psnr_result); 521 PrintPythonOutput(config, stats, ssim_result, psnr_result);
522 } 522 }
523 delete processor; 523 delete processor;
524 delete encoder; 524 delete encoder;
525 delete decoder; 525 delete decoder;
526 Log("Quality test finished!"); 526 Log("Quality test finished!");
527 return 0; 527 return 0;
528 } 528 }
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc ('k') | webrtc/modules/video_coding/main/test/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698