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

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

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: AGC simulated gain Created 3 years, 7 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) 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
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_bool(simulate_mic_gain,
162 false,
163 "Simulate adjustable microphone analog gain");
164 DEFINE_int32(simulated_mic_kind,
165 kParameterNotSpecifiedValue,
166 "Specify which microphone kind to use for microphone simulation");
161 DEFINE_bool(performance_report, false, "Report the APM performance "); 167 DEFINE_bool(performance_report, false, "Report the APM performance ");
162 DEFINE_bool(verbose, false, "Produce verbose output"); 168 DEFINE_bool(verbose, false, "Produce verbose output");
163 DEFINE_bool(bitexactness_report, 169 DEFINE_bool(bitexactness_report,
164 false, 170 false,
165 "Report bitexactness for aec dump result reproduction"); 171 "Report bitexactness for aec dump result reproduction");
166 DEFINE_bool(discard_settings_in_aecdump, 172 DEFINE_bool(discard_settings_in_aecdump,
167 false, 173 false,
168 "Discard any config settings specified in the aec dump"); 174 "Discard any config settings specified in the aec dump");
169 DEFINE_bool(store_intermediate_output, 175 DEFINE_bool(store_intermediate_output,
170 false, 176 false,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); 263 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter);
258 SetSettingIfSpecified(FLAGS_agc_compression_gain, 264 SetSettingIfSpecified(FLAGS_agc_compression_gain,
259 &settings.agc_compression_gain); 265 &settings.agc_compression_gain);
260 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); 266 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood);
261 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); 267 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level);
262 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); 268 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay);
263 SetSettingIfSpecified(FLAGS_stream_drift_samples, 269 SetSettingIfSpecified(FLAGS_stream_drift_samples,
264 &settings.stream_drift_samples); 270 &settings.stream_drift_samples);
265 SetSettingIfSpecified(FLAGS_custom_call_order_file, 271 SetSettingIfSpecified(FLAGS_custom_call_order_file,
266 &settings.custom_call_order_filename); 272 &settings.custom_call_order_filename);
273 settings.simulate_mic_gain = FLAGS_simulate_mic_gain;
274 SetSettingIfSpecified(FLAGS_simulated_mic_kind, &settings.simulated_mic_kind);
267 settings.report_performance = FLAGS_performance_report; 275 settings.report_performance = FLAGS_performance_report;
268 settings.use_verbose_logging = FLAGS_verbose; 276 settings.use_verbose_logging = FLAGS_verbose;
269 settings.report_bitexactness = FLAGS_bitexactness_report; 277 settings.report_bitexactness = FLAGS_bitexactness_report;
270 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; 278 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump;
271 settings.fixed_interface = FLAGS_fixed_interface; 279 settings.fixed_interface = FLAGS_fixed_interface;
272 settings.store_intermediate_output = FLAGS_store_intermediate_output; 280 settings.store_intermediate_output = FLAGS_store_intermediate_output;
273 281
274 return settings; 282 return settings;
275 } 283 }
276 284
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ReportConditionalErrorAndExit( 381 ReportConditionalErrorAndExit(
374 settings.report_bitexactness && !settings.aec_dump_input_filename, 382 settings.report_bitexactness && !settings.aec_dump_input_filename,
375 "Error: --bitexactness_report can only be used when operating on an " 383 "Error: --bitexactness_report can only be used when operating on an "
376 "aecdump\n"); 384 "aecdump\n");
377 385
378 ReportConditionalErrorAndExit( 386 ReportConditionalErrorAndExit(
379 settings.custom_call_order_filename && settings.aec_dump_input_filename, 387 settings.custom_call_order_filename && settings.aec_dump_input_filename,
380 "Error: --custom_call_order_file cannot be used when operating on an " 388 "Error: --custom_call_order_file cannot be used when operating on an "
381 "aecdump\n"); 389 "aecdump\n");
382 390
391
392 ReportConditionalErrorAndExit(
393 settings.simulated_mic_kind && !settings.simulate_mic_gain,
394 "Error: --simulated_mic_kind cannot be specified when mic simulation is "
395 "disabled\n");
396
397 ReportConditionalErrorAndExit(
398 !settings.simulated_mic_kind && settings.simulate_mic_gain,
399 "Error: --simulated_mic_kind must be specified when mic simulation is "
400 "enabled\n");
401
383 auto valid_wav_name = [](const std::string& wav_file_name) { 402 auto valid_wav_name = [](const std::string& wav_file_name) {
384 if (wav_file_name.size() < 5) { 403 if (wav_file_name.size() < 5) {
385 return false; 404 return false;
386 } 405 }
387 if ((wav_file_name.compare(wav_file_name.size() - 4, 4, ".wav") == 0) || 406 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)) { 407 (wav_file_name.compare(wav_file_name.size() - 4, 4, ".WAV") == 0)) {
389 return true; 408 return true;
390 } 409 }
391 return false; 410 return false;
392 }; 411 };
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 477
459 return 0; 478 return 0;
460 } 479 }
461 480
462 } // namespace test 481 } // namespace test
463 } // namespace webrtc 482 } // namespace webrtc
464 483
465 int main(int argc, char* argv[]) { 484 int main(int argc, char* argv[]) {
466 return webrtc::test::main(argc, argv); 485 return webrtc::test::main(argc, argv);
467 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698