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

Side by Side Diff: media/bench/bench.cc

Issue 373013: Use GetSwitchValueASCII. (Closed)
Patch Set: Created 11 years, 1 month 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 | « courgette/courgette_tool.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Standalone benchmarking application based on FFmpeg. This tool is used to 5 // Standalone benchmarking application based on FFmpeg. This tool is used to
6 // measure decoding performance between different FFmpeg compile and run-time 6 // measure decoding performance between different FFmpeg compile and run-time
7 // options. We also use this tool to measure performance regressions when 7 // options. We also use this tool to measure performance regressions when
8 // testing newer builds of FFmpeg from trunk. 8 // testing newer builds of FFmpeg from trunk.
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } else if (stream.compare("video") == 0) { 132 } else if (stream.compare("video") == 0) {
133 target_codec = CODEC_TYPE_VIDEO; 133 target_codec = CODEC_TYPE_VIDEO;
134 } else { 134 } else {
135 std::cerr << "Unknown --stream option " << stream << std::endl; 135 std::cerr << "Unknown --stream option " << stream << std::endl;
136 return 1; 136 return 1;
137 } 137 }
138 } 138 }
139 139
140 // Determine number of threads to use for video decoding (optional). 140 // Determine number of threads to use for video decoding (optional).
141 int video_threads = 0; 141 int video_threads = 0;
142 std::wstring threads(cmd_line->GetSwitchValue(switches::kVideoThreads)); 142 std::string threads(cmd_line->GetSwitchValueASCII(switches::kVideoThreads));
143 if (!threads.empty() && 143 if (!threads.empty() &&
144 !StringToInt(WideToUTF16Hack(threads), &video_threads)) { 144 !StringToInt(threads, &video_threads)) {
145 video_threads = 0; 145 video_threads = 0;
146 } 146 }
147 147
148 // FFmpeg verbosity. See libavutil/log.h for values: -8 quiet..48 verbose. 148 // FFmpeg verbosity. See libavutil/log.h for values: -8 quiet..48 verbose.
149 int verbose_level = AV_LOG_FATAL; 149 int verbose_level = AV_LOG_FATAL;
150 std::wstring verbose(cmd_line->GetSwitchValue(switches::kVerbose)); 150 std::string verbose(cmd_line->GetSwitchValueASCII(switches::kVerbose));
151 if (!verbose.empty() && 151 if (!verbose.empty() &&
152 !StringToInt(WideToUTF16Hack(verbose), &verbose_level)) { 152 !StringToInt(verbose, &verbose_level)) {
153 verbose_level = AV_LOG_FATAL; 153 verbose_level = AV_LOG_FATAL;
154 } 154 }
155 155
156 // Determine number of frames to decode (optional). 156 // Determine number of frames to decode (optional).
157 int max_frames = 0; 157 int max_frames = 0;
158 std::wstring frames_opt(cmd_line->GetSwitchValue(switches::kFrames)); 158 std::string frames_opt(cmd_line->GetSwitchValueASCII(switches::kFrames));
159 if (!frames_opt.empty() && 159 if (!frames_opt.empty() &&
160 !StringToInt(WideToUTF16Hack(frames_opt), &max_frames)) { 160 !StringToInt(frames_opt, &max_frames)) {
161 max_frames = 0; 161 max_frames = 0;
162 } 162 }
163 163
164 // Determine number of times to loop (optional). 164 // Determine number of times to loop (optional).
165 int max_loops = 0; 165 int max_loops = 0;
166 std::wstring loop_opt(cmd_line->GetSwitchValue(switches::kLoop)); 166 std::string loop_opt(cmd_line->GetSwitchValueASCII(switches::kLoop));
167 if (!loop_opt.empty() && 167 if (!loop_opt.empty() &&
168 !StringToInt(WideToUTF16Hack(loop_opt), &max_loops)) { 168 !StringToInt(loop_opt, &max_loops)) {
169 max_loops = 0; 169 max_loops = 0;
170 } 170 }
171 171
172 bool fast2 = false; 172 bool fast2 = false;
173 if (cmd_line->HasSwitch(switches::kFast2)) { 173 if (cmd_line->HasSwitch(switches::kFast2)) {
174 fast2 = true; 174 fast2 = true;
175 } 175 }
176 176
177 bool flush = false; 177 bool flush = false;
178 if (cmd_line->HasSwitch(switches::kFlush)) { 178 if (cmd_line->HasSwitch(switches::kFlush)) {
179 flush = true; 179 flush = true;
180 } 180 }
181 181
182 unsigned int hash_value = 5381u; // Seed for DJB2. 182 unsigned int hash_value = 5381u; // Seed for DJB2.
183 bool hash_djb2 = false; 183 bool hash_djb2 = false;
184 if (cmd_line->HasSwitch(switches::kDjb2)) { 184 if (cmd_line->HasSwitch(switches::kDjb2)) {
185 hash_djb2 = true; 185 hash_djb2 = true;
186 } 186 }
187 187
188 MD5Context ctx; // Intermediate MD5 data: do not use 188 MD5Context ctx; // Intermediate MD5 data: do not use
189 MD5Init(&ctx); 189 MD5Init(&ctx);
190 bool hash_md5 = false; 190 bool hash_md5 = false;
191 if (cmd_line->HasSwitch(switches::kMd5)) { 191 if (cmd_line->HasSwitch(switches::kMd5)) {
192 hash_md5 = true; 192 hash_md5 = true;
193 } 193 }
194 194
195 int skip = 0; 195 int skip = 0;
196 if (cmd_line->HasSwitch(switches::kSkip)) { 196 if (cmd_line->HasSwitch(switches::kSkip)) {
197 std::wstring skip_opt(cmd_line->GetSwitchValue(switches::kSkip)); 197 std::string skip_opt(cmd_line->GetSwitchValueASCII(switches::kSkip));
198 if (!StringToInt(WideToUTF16Hack(skip_opt), &skip)) { 198 if (!StringToInt(skip_opt, &skip)) {
199 skip = 0; 199 skip = 0;
200 } 200 }
201 } 201 }
202 202
203 std::ostream* log_out = &std::cout; 203 std::ostream* log_out = &std::cout;
204 #if defined(OS_WIN) 204 #if defined(OS_WIN)
205 // Catch exceptions so this tool can be used in automated testing. 205 // Catch exceptions so this tool can be used in automated testing.
206 __try { 206 __try {
207 #endif 207 #endif
208 208
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 #if defined(OS_WIN) 535 #if defined(OS_WIN)
536 } __except(EXCEPTION_EXECUTE_HANDLER) { 536 } __except(EXCEPTION_EXECUTE_HANDLER) {
537 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() 537 *log_out << " Exception:" << std::setw(11) << GetExceptionCode()
538 << " " << in_path << std::endl; 538 << " " << in_path << std::endl;
539 return 1; 539 return 1;
540 } 540 }
541 #endif 541 #endif
542 CommandLine::Reset(); 542 CommandLine::Reset();
543 return 0; 543 return 0;
544 } 544 }
OLDNEW
« no previous file with comments | « courgette/courgette_tool.cc ('k') | net/tools/fetch/fetch_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698