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

Side by Side Diff: webrtc/modules/audio_processing/test/audioproc_float.cc

Issue 2562593003: Add an optional artificial nearend signal for aecdump call recreation (Closed)
Patch Set: Removed unused variables Created 4 years 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 22 matching lines...) Expand all
33 "Command-line tool to simulate a call using the audio " 33 "Command-line tool to simulate a call using the audio "
34 "processing module, either based on wav files or " 34 "processing module, either based on wav files or "
35 "protobuf debug dump recordings."; 35 "protobuf debug dump recordings.";
36 36
37 DEFINE_string(dump_input, "", "Aec dump input filename"); 37 DEFINE_string(dump_input, "", "Aec dump input filename");
38 DEFINE_string(dump_output, "", "Aec dump output filename"); 38 DEFINE_string(dump_output, "", "Aec dump output filename");
39 DEFINE_string(i, "", "Forward stream input wav filename"); 39 DEFINE_string(i, "", "Forward stream input wav filename");
40 DEFINE_string(o, "", "Forward stream output wav filename"); 40 DEFINE_string(o, "", "Forward stream output wav filename");
41 DEFINE_string(ri, "", "Reverse stream input wav filename"); 41 DEFINE_string(ri, "", "Reverse stream input wav filename");
42 DEFINE_string(ro, "", "Reverse stream output wav filename"); 42 DEFINE_string(ro, "", "Reverse stream output wav filename");
43 DEFINE_string(artificial_nearend, "", "Artificial nearend wav filename");
43 DEFINE_int32(output_num_channels, 44 DEFINE_int32(output_num_channels,
44 kParameterNotSpecifiedValue, 45 kParameterNotSpecifiedValue,
45 "Number of forward stream output channels"); 46 "Number of forward stream output channels");
46 DEFINE_int32(reverse_output_num_channels, 47 DEFINE_int32(reverse_output_num_channels,
47 kParameterNotSpecifiedValue, 48 kParameterNotSpecifiedValue,
48 "Number of Reverse stream output channels"); 49 "Number of Reverse stream output channels");
49 DEFINE_int32(output_sample_rate_hz, 50 DEFINE_int32(output_sample_rate_hz,
50 kParameterNotSpecifiedValue, 51 kParameterNotSpecifiedValue,
51 "Forward stream output sample rate in Hz"); 52 "Forward stream output sample rate in Hz");
52 DEFINE_int32(reverse_output_sample_rate_hz, 53 DEFINE_int32(reverse_output_sample_rate_hz,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 settings.use_aec = rtc::Optional<bool>(true); 202 settings.use_aec = rtc::Optional<bool>(true);
202 settings.use_aecm = rtc::Optional<bool>(false); 203 settings.use_aecm = rtc::Optional<bool>(false);
203 settings.use_ed = rtc::Optional<bool>(false); 204 settings.use_ed = rtc::Optional<bool>(false);
204 } 205 }
205 SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename); 206 SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename);
206 SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename); 207 SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename);
207 SetSettingIfSpecified(FLAGS_i, &settings.input_filename); 208 SetSettingIfSpecified(FLAGS_i, &settings.input_filename);
208 SetSettingIfSpecified(FLAGS_o, &settings.output_filename); 209 SetSettingIfSpecified(FLAGS_o, &settings.output_filename);
209 SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename); 210 SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename);
210 SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename); 211 SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename);
212 SetSettingIfSpecified(FLAGS_artificial_nearend,
213 &settings.artificial_nearend_filename);
211 SetSettingIfSpecified(FLAGS_output_num_channels, 214 SetSettingIfSpecified(FLAGS_output_num_channels,
212 &settings.output_num_channels); 215 &settings.output_num_channels);
213 SetSettingIfSpecified(FLAGS_reverse_output_num_channels, 216 SetSettingIfSpecified(FLAGS_reverse_output_num_channels,
214 &settings.reverse_output_num_channels); 217 &settings.reverse_output_num_channels);
215 SetSettingIfSpecified(FLAGS_output_sample_rate_hz, 218 SetSettingIfSpecified(FLAGS_output_sample_rate_hz,
216 &settings.output_sample_rate_hz); 219 &settings.output_sample_rate_hz);
217 SetSettingIfSpecified(FLAGS_reverse_output_sample_rate_hz, 220 SetSettingIfSpecified(FLAGS_reverse_output_sample_rate_hz,
218 &settings.reverse_output_sample_rate_hz); 221 &settings.reverse_output_sample_rate_hz);
219 SetSettingIfSpecified(FLAGS_mic_positions, &settings.microphone_positions); 222 SetSettingIfSpecified(FLAGS_mic_positions, &settings.microphone_positions);
220 settings.target_angle_degrees = FLAGS_target_angle_degrees; 223 settings.target_angle_degrees = FLAGS_target_angle_degrees;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 exit(1); 273 exit(1);
271 } 274 }
272 } 275 }
273 276
274 void PerformBasicParameterSanityChecks(const SimulationSettings& settings) { 277 void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
275 if (settings.input_filename || settings.reverse_input_filename) { 278 if (settings.input_filename || settings.reverse_input_filename) {
276 ReportConditionalErrorAndExit(!!settings.aec_dump_input_filename, 279 ReportConditionalErrorAndExit(!!settings.aec_dump_input_filename,
277 "Error: The aec dump cannot be specified " 280 "Error: The aec dump cannot be specified "
278 "together with input wav files!\n"); 281 "together with input wav files!\n");
279 282
283 ReportConditionalErrorAndExit(!!settings.artificial_nearend_filename,
284 "Error: The artificial nearend cannot be "
285 "specified together with input wav files!\n");
286
280 ReportConditionalErrorAndExit(!settings.input_filename, 287 ReportConditionalErrorAndExit(!settings.input_filename,
281 "Error: When operating at wav files, the " 288 "Error: When operating at wav files, the "
282 "input wav filename must be " 289 "input wav filename must be "
283 "specified!\n"); 290 "specified!\n");
284 291
285 ReportConditionalErrorAndExit( 292 ReportConditionalErrorAndExit(
286 settings.reverse_output_filename && !settings.reverse_input_filename, 293 settings.reverse_output_filename && !settings.reverse_input_filename,
287 "Error: When operating at wav files, the reverse input wav filename " 294 "Error: When operating at wav files, the reverse input wav filename "
288 "must be specified if the reverse output wav filename is specified!\n"); 295 "must be specified if the reverse output wav filename is specified!\n");
289 } else { 296 } else {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 389
383 ReportConditionalErrorAndExit( 390 ReportConditionalErrorAndExit(
384 settings.reverse_input_filename && 391 settings.reverse_input_filename &&
385 (!valid_wav_name(*settings.reverse_input_filename)), 392 (!valid_wav_name(*settings.reverse_input_filename)),
386 "Error: --ri must be a valid .wav file name.\n"); 393 "Error: --ri must be a valid .wav file name.\n");
387 394
388 ReportConditionalErrorAndExit( 395 ReportConditionalErrorAndExit(
389 settings.reverse_output_filename && 396 settings.reverse_output_filename &&
390 (!valid_wav_name(*settings.reverse_output_filename)), 397 (!valid_wav_name(*settings.reverse_output_filename)),
391 "Error: --ro must be a valid .wav file name.\n"); 398 "Error: --ro must be a valid .wav file name.\n");
399
400 ReportConditionalErrorAndExit(
401 settings.artificial_nearend_filename &&
402 (!valid_wav_name(*settings.artificial_nearend_filename)),
403 "Error: --artifical_nearend must be a valid .wav file name.\n");
392 } 404 }
393 405
394 } // namespace 406 } // namespace
395 407
396 int main(int argc, char* argv[]) { 408 int main(int argc, char* argv[]) {
397 google::SetUsageMessage(kUsageDescription); 409 google::SetUsageMessage(kUsageDescription);
398 google::ParseCommandLineFlags(&argc, &argv, true); 410 google::ParseCommandLineFlags(&argc, &argv, true);
399 411
400 SimulationSettings settings = CreateSettings(); 412 SimulationSettings settings = CreateSettings();
401 PerformBasicParameterSanityChecks(settings); 413 PerformBasicParameterSanityChecks(settings);
402 std::unique_ptr<AudioProcessingSimulator> processor; 414 std::unique_ptr<AudioProcessingSimulator> processor;
403 415
404 if (settings.aec_dump_input_filename) { 416 if (settings.aec_dump_input_filename) {
405 processor.reset(new AecDumpBasedSimulator(settings)); 417 processor.reset(new AecDumpBasedSimulator(settings));
406 } else { 418 } else {
407 processor.reset(new WavBasedSimulator(settings)); 419 processor.reset(new WavBasedSimulator(settings));
aleloi 2016/12/08 13:00:55 IIUC, artificial nearend functionality only works
peah-webrtc 2016/12/09 07:19:25 There is an error message on line 283 that trigger
aleloi 2016/12/09 10:09:23 Ah, I see now. When there is an artificial nearend
408 } 420 }
409 421
410 processor->Process(); 422 processor->Process();
411 423
412 if (settings.report_performance) { 424 if (settings.report_performance) {
413 const auto& proc_time = processor->proc_time(); 425 const auto& proc_time = processor->proc_time();
414 int64_t exec_time_us = proc_time.sum / rtc::kNumNanosecsPerMicrosec; 426 int64_t exec_time_us = proc_time.sum / rtc::kNumNanosecsPerMicrosec;
415 std::cout << std::endl 427 std::cout << std::endl
416 << "Execution time: " << exec_time_us * 1e-6 << " s, File time: " 428 << "Execution time: " << exec_time_us * 1e-6 << " s, File time: "
417 << processor->get_num_process_stream_calls() * 1.f / 429 << processor->get_num_process_stream_calls() * 1.f /
(...skipping 16 matching lines...) Expand all
434 446
435 return 0; 447 return 0;
436 } 448 }
437 449
438 } // namespace test 450 } // namespace test
439 } // namespace webrtc 451 } // namespace webrtc
440 452
441 int main(int argc, char* argv[]) { 453 int main(int argc, char* argv[]) {
442 return webrtc::test::main(argc, argv); 454 return webrtc::test::main(argc, argv);
443 } 455 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698