OLD | NEW |
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 |
| 11 #include <string.h> |
| 12 |
11 #include <iostream> | 13 #include <iostream> |
12 #include <memory> | 14 #include <memory> |
13 | 15 |
14 #include <string.h> | |
15 | |
16 #include "gflags/gflags.h" | 16 #include "gflags/gflags.h" |
17 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
18 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" | 18 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" |
19 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" | 19 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" |
20 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h" | 20 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace test { | 23 namespace test { |
24 namespace { | 24 namespace { |
25 | 25 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 "Specify the VAD likelihood (0-3)"); | 151 "Specify the VAD likelihood (0-3)"); |
152 DEFINE_int32(ns_level, | 152 DEFINE_int32(ns_level, |
153 kParameterNotSpecifiedValue, | 153 kParameterNotSpecifiedValue, |
154 "Specify the NS level (0-3)"); | 154 "Specify the NS level (0-3)"); |
155 DEFINE_int32(stream_delay, | 155 DEFINE_int32(stream_delay, |
156 kParameterNotSpecifiedValue, | 156 kParameterNotSpecifiedValue, |
157 "Specify the stream delay in ms to use"); | 157 "Specify the stream delay in ms to use"); |
158 DEFINE_int32(stream_drift_samples, | 158 DEFINE_int32(stream_drift_samples, |
159 kParameterNotSpecifiedValue, | 159 kParameterNotSpecifiedValue, |
160 "Specify the number of stream drift samples to use"); | 160 "Specify the number of stream drift samples to use"); |
| 161 DEFINE_int32(initial_mic_gain, |
| 162 100, |
| 163 "Initial mic gain level (0-255)"); |
| 164 DEFINE_bool(simulate_mic_gain, |
| 165 false, |
| 166 "Simulate adjustable microphone analog gain"); |
| 167 DEFINE_int32(simulated_mic_kind, |
| 168 kParameterNotSpecifiedValue, |
| 169 "Specify which microphone kind to use for microphone simulation"); |
161 DEFINE_bool(performance_report, false, "Report the APM performance "); | 170 DEFINE_bool(performance_report, false, "Report the APM performance "); |
162 DEFINE_bool(verbose, false, "Produce verbose output"); | 171 DEFINE_bool(verbose, false, "Produce verbose output"); |
163 DEFINE_bool(bitexactness_report, | 172 DEFINE_bool(bitexactness_report, |
164 false, | 173 false, |
165 "Report bitexactness for aec dump result reproduction"); | 174 "Report bitexactness for aec dump result reproduction"); |
166 DEFINE_bool(discard_settings_in_aecdump, | 175 DEFINE_bool(discard_settings_in_aecdump, |
167 false, | 176 false, |
168 "Discard any config settings specified in the aec dump"); | 177 "Discard any config settings specified in the aec dump"); |
169 DEFINE_bool(store_intermediate_output, | 178 DEFINE_bool(store_intermediate_output, |
170 false, | 179 false, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); | 266 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); |
258 SetSettingIfSpecified(FLAGS_agc_compression_gain, | 267 SetSettingIfSpecified(FLAGS_agc_compression_gain, |
259 &settings.agc_compression_gain); | 268 &settings.agc_compression_gain); |
260 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); | 269 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); |
261 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); | 270 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); |
262 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); | 271 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); |
263 SetSettingIfSpecified(FLAGS_stream_drift_samples, | 272 SetSettingIfSpecified(FLAGS_stream_drift_samples, |
264 &settings.stream_drift_samples); | 273 &settings.stream_drift_samples); |
265 SetSettingIfSpecified(FLAGS_custom_call_order_file, | 274 SetSettingIfSpecified(FLAGS_custom_call_order_file, |
266 &settings.custom_call_order_filename); | 275 &settings.custom_call_order_filename); |
| 276 settings.initial_mic_gain = FLAGS_initial_mic_gain; |
| 277 settings.simulate_mic_gain = FLAGS_simulate_mic_gain; |
| 278 SetSettingIfSpecified(FLAGS_simulated_mic_kind, &settings.simulated_mic_kind); |
267 settings.report_performance = FLAGS_performance_report; | 279 settings.report_performance = FLAGS_performance_report; |
268 settings.use_verbose_logging = FLAGS_verbose; | 280 settings.use_verbose_logging = FLAGS_verbose; |
269 settings.report_bitexactness = FLAGS_bitexactness_report; | 281 settings.report_bitexactness = FLAGS_bitexactness_report; |
270 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; | 282 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; |
271 settings.fixed_interface = FLAGS_fixed_interface; | 283 settings.fixed_interface = FLAGS_fixed_interface; |
272 settings.store_intermediate_output = FLAGS_store_intermediate_output; | 284 settings.store_intermediate_output = FLAGS_store_intermediate_output; |
273 | 285 |
274 return settings; | 286 return settings; |
275 } | 287 } |
276 | 288 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 ReportConditionalErrorAndExit( | 385 ReportConditionalErrorAndExit( |
374 settings.report_bitexactness && !settings.aec_dump_input_filename, | 386 settings.report_bitexactness && !settings.aec_dump_input_filename, |
375 "Error: --bitexactness_report can only be used when operating on an " | 387 "Error: --bitexactness_report can only be used when operating on an " |
376 "aecdump\n"); | 388 "aecdump\n"); |
377 | 389 |
378 ReportConditionalErrorAndExit( | 390 ReportConditionalErrorAndExit( |
379 settings.custom_call_order_filename && settings.aec_dump_input_filename, | 391 settings.custom_call_order_filename && settings.aec_dump_input_filename, |
380 "Error: --custom_call_order_file cannot be used when operating on an " | 392 "Error: --custom_call_order_file cannot be used when operating on an " |
381 "aecdump\n"); | 393 "aecdump\n"); |
382 | 394 |
| 395 ReportConditionalErrorAndExit( |
| 396 (settings.initial_mic_gain < 0 || settings.initial_mic_gain > 255), |
| 397 "Error: --initial_mic_gain must be specified between 0 and 255.\n"); |
| 398 |
| 399 ReportConditionalErrorAndExit( |
| 400 settings.simulated_mic_kind && !settings.simulate_mic_gain, |
| 401 "Error: --simulated_mic_kind cannot be specified when mic simulation is " |
| 402 "disabled\n"); |
| 403 |
| 404 ReportConditionalErrorAndExit( |
| 405 !settings.simulated_mic_kind && settings.simulate_mic_gain, |
| 406 "Error: --simulated_mic_kind must be specified when mic simulation is " |
| 407 "enabled\n"); |
| 408 |
383 auto valid_wav_name = [](const std::string& wav_file_name) { | 409 auto valid_wav_name = [](const std::string& wav_file_name) { |
384 if (wav_file_name.size() < 5) { | 410 if (wav_file_name.size() < 5) { |
385 return false; | 411 return false; |
386 } | 412 } |
387 if ((wav_file_name.compare(wav_file_name.size() - 4, 4, ".wav") == 0) || | 413 if ((wav_file_name.compare(wav_file_name.size() - 4, 4, ".wav") == 0) || |
388 (wav_file_name.compare(wav_file_name.size() - 4, 4, ".WAV") == 0)) { | 414 (wav_file_name.compare(wav_file_name.size() - 4, 4, ".WAV") == 0)) { |
389 return true; | 415 return true; |
390 } | 416 } |
391 return false; | 417 return false; |
392 }; | 418 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 | 484 |
459 return 0; | 485 return 0; |
460 } | 486 } |
461 | 487 |
462 } // namespace test | 488 } // namespace test |
463 } // namespace webrtc | 489 } // namespace webrtc |
464 | 490 |
465 int main(int argc, char* argv[]) { | 491 int main(int argc, char* argv[]) { |
466 return webrtc::test::main(argc, argv); | 492 return webrtc::test::main(argc, argv); |
467 } | 493 } |
OLD | NEW |