| 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 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 "Specify the AGC mode (0-2)"); | 142 "Specify the AGC mode (0-2)"); |
| 143 DEFINE_int32(agc_target_level, | 143 DEFINE_int32(agc_target_level, |
| 144 kParameterNotSpecifiedValue, | 144 kParameterNotSpecifiedValue, |
| 145 "Specify the AGC target level (0-31)"); | 145 "Specify the AGC target level (0-31)"); |
| 146 DEFINE_int32(agc_limiter, | 146 DEFINE_int32(agc_limiter, |
| 147 kParameterNotSpecifiedValue, | 147 kParameterNotSpecifiedValue, |
| 148 "Activate (1) or deactivate(0) the level estimator"); | 148 "Activate (1) or deactivate(0) the level estimator"); |
| 149 DEFINE_int32(agc_compression_gain, | 149 DEFINE_int32(agc_compression_gain, |
| 150 kParameterNotSpecifiedValue, | 150 kParameterNotSpecifiedValue, |
| 151 "Specify the AGC compression gain (0-90)"); | 151 "Specify the AGC compression gain (0-90)"); |
| 152 DEFINE_double(agc2_fixed_gain_db, 0.0, "AGC2 fixed gain (dB) to apply"); |
| 152 DEFINE_int32(vad_likelihood, | 153 DEFINE_int32(vad_likelihood, |
| 153 kParameterNotSpecifiedValue, | 154 kParameterNotSpecifiedValue, |
| 154 "Specify the VAD likelihood (0-3)"); | 155 "Specify the VAD likelihood (0-3)"); |
| 155 DEFINE_int32(ns_level, | 156 DEFINE_int32(ns_level, |
| 156 kParameterNotSpecifiedValue, | 157 kParameterNotSpecifiedValue, |
| 157 "Specify the NS level (0-3)"); | 158 "Specify the NS level (0-3)"); |
| 158 DEFINE_int32(stream_delay, | 159 DEFINE_int32(stream_delay, |
| 159 kParameterNotSpecifiedValue, | 160 kParameterNotSpecifiedValue, |
| 160 "Specify the stream delay in ms to use"); | 161 "Specify the stream delay in ms to use"); |
| 161 DEFINE_int32(stream_drift_samples, | 162 DEFINE_int32(stream_drift_samples, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 180 *parameter = rtc::Optional<std::string>(value); | 181 *parameter = rtc::Optional<std::string>(value); |
| 181 } | 182 } |
| 182 } | 183 } |
| 183 | 184 |
| 184 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) { | 185 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) { |
| 185 if (value != kParameterNotSpecifiedValue) { | 186 if (value != kParameterNotSpecifiedValue) { |
| 186 *parameter = rtc::Optional<int>(value); | 187 *parameter = rtc::Optional<int>(value); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 | 190 |
| 191 void SetSettingIfSpecified(double value, rtc::Optional<double>* parameter) { |
| 192 if (value != kParameterNotSpecifiedValue) { |
| 193 *parameter = rtc::Optional<double>(value); |
| 194 } |
| 195 } |
| 196 |
| 190 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) { | 197 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) { |
| 191 if (flag == 0) { | 198 if (flag == 0) { |
| 192 *parameter = rtc::Optional<bool>(false); | 199 *parameter = rtc::Optional<bool>(false); |
| 193 } else if (flag == 1) { | 200 } else if (flag == 1) { |
| 194 *parameter = rtc::Optional<bool>(true); | 201 *parameter = rtc::Optional<bool>(true); |
| 195 } | 202 } |
| 196 } | 203 } |
| 197 | 204 |
| 198 SimulationSettings CreateSettings() { | 205 SimulationSettings CreateSettings() { |
| 199 SimulationSettings settings; | 206 SimulationSettings settings; |
| 200 if (FLAGS_all_default) { | 207 if (FLAGS_all_default) { |
| 201 settings.use_le = rtc::Optional<bool>(true); | 208 settings.use_le = rtc::Optional<bool>(true); |
| 202 settings.use_vad = rtc::Optional<bool>(true); | 209 settings.use_vad = rtc::Optional<bool>(true); |
| 203 settings.use_ie = rtc::Optional<bool>(false); | 210 settings.use_ie = rtc::Optional<bool>(false); |
| 204 settings.use_bf = rtc::Optional<bool>(false); | 211 settings.use_bf = rtc::Optional<bool>(false); |
| 205 settings.use_ts = rtc::Optional<bool>(true); | 212 settings.use_ts = rtc::Optional<bool>(true); |
| 206 settings.use_ns = rtc::Optional<bool>(true); | 213 settings.use_ns = rtc::Optional<bool>(true); |
| 207 settings.use_hpf = rtc::Optional<bool>(true); | 214 settings.use_hpf = rtc::Optional<bool>(true); |
| 208 settings.use_agc = rtc::Optional<bool>(true); | 215 settings.use_agc = rtc::Optional<bool>(true); |
| 216 settings.use_agc2 = rtc::Optional<bool>(false); |
| 209 settings.use_aec = rtc::Optional<bool>(true); | 217 settings.use_aec = rtc::Optional<bool>(true); |
| 210 settings.use_aecm = rtc::Optional<bool>(false); | 218 settings.use_aecm = rtc::Optional<bool>(false); |
| 211 settings.use_ed = rtc::Optional<bool>(false); | 219 settings.use_ed = rtc::Optional<bool>(false); |
| 212 } | 220 } |
| 213 SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename); | 221 SetSettingIfSpecified(FLAGS_dump_input, &settings.aec_dump_input_filename); |
| 214 SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename); | 222 SetSettingIfSpecified(FLAGS_dump_output, &settings.aec_dump_output_filename); |
| 215 SetSettingIfSpecified(FLAGS_i, &settings.input_filename); | 223 SetSettingIfSpecified(FLAGS_i, &settings.input_filename); |
| 216 SetSettingIfSpecified(FLAGS_o, &settings.output_filename); | 224 SetSettingIfSpecified(FLAGS_o, &settings.output_filename); |
| 217 SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename); | 225 SetSettingIfSpecified(FLAGS_ri, &settings.reverse_input_filename); |
| 218 SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename); | 226 SetSettingIfSpecified(FLAGS_ro, &settings.reverse_output_filename); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 SetSettingIfFlagSet(FLAGS_lc, &settings.use_lc); | 262 SetSettingIfFlagSet(FLAGS_lc, &settings.use_lc); |
| 255 SetSettingIfFlagSet(FLAGS_experimental_agc, &settings.use_experimental_agc); | 263 SetSettingIfFlagSet(FLAGS_experimental_agc, &settings.use_experimental_agc); |
| 256 SetSettingIfSpecified(FLAGS_aecm_routing_mode, &settings.aecm_routing_mode); | 264 SetSettingIfSpecified(FLAGS_aecm_routing_mode, &settings.aecm_routing_mode); |
| 257 SetSettingIfFlagSet(FLAGS_aecm_comfort_noise, | 265 SetSettingIfFlagSet(FLAGS_aecm_comfort_noise, |
| 258 &settings.use_aecm_comfort_noise); | 266 &settings.use_aecm_comfort_noise); |
| 259 SetSettingIfSpecified(FLAGS_agc_mode, &settings.agc_mode); | 267 SetSettingIfSpecified(FLAGS_agc_mode, &settings.agc_mode); |
| 260 SetSettingIfSpecified(FLAGS_agc_target_level, &settings.agc_target_level); | 268 SetSettingIfSpecified(FLAGS_agc_target_level, &settings.agc_target_level); |
| 261 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); | 269 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); |
| 262 SetSettingIfSpecified(FLAGS_agc_compression_gain, | 270 SetSettingIfSpecified(FLAGS_agc_compression_gain, |
| 263 &settings.agc_compression_gain); | 271 &settings.agc_compression_gain); |
| 272 SetSettingIfSpecified(FLAGS_agc2_fixed_gain_db, &settings.agc2_fixed_gain_db); |
| 264 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); | 273 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); |
| 265 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); | 274 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); |
| 266 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); | 275 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); |
| 267 SetSettingIfSpecified(FLAGS_stream_drift_samples, | 276 SetSettingIfSpecified(FLAGS_stream_drift_samples, |
| 268 &settings.stream_drift_samples); | 277 &settings.stream_drift_samples); |
| 269 SetSettingIfSpecified(FLAGS_custom_call_order_file, | 278 SetSettingIfSpecified(FLAGS_custom_call_order_file, |
| 270 &settings.custom_call_order_filename); | 279 &settings.custom_call_order_filename); |
| 271 settings.report_performance = FLAGS_performance_report; | 280 settings.report_performance = FLAGS_performance_report; |
| 272 settings.use_verbose_logging = FLAGS_verbose; | 281 settings.use_verbose_logging = FLAGS_verbose; |
| 273 settings.report_bitexactness = FLAGS_bitexactness_report; | 282 settings.report_bitexactness = FLAGS_bitexactness_report; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 settings.agc_target_level && ((*settings.agc_target_level) < 0 || | 367 settings.agc_target_level && ((*settings.agc_target_level) < 0 || |
| 359 (*settings.agc_target_level) > 31), | 368 (*settings.agc_target_level) > 31), |
| 360 "Error: --agc_target_level must be specified between 0 and 31.\n"); | 369 "Error: --agc_target_level must be specified between 0 and 31.\n"); |
| 361 | 370 |
| 362 ReportConditionalErrorAndExit( | 371 ReportConditionalErrorAndExit( |
| 363 settings.agc_compression_gain && ((*settings.agc_compression_gain) < 0 || | 372 settings.agc_compression_gain && ((*settings.agc_compression_gain) < 0 || |
| 364 (*settings.agc_compression_gain) > 90), | 373 (*settings.agc_compression_gain) > 90), |
| 365 "Error: --agc_compression_gain must be specified between 0 and 90.\n"); | 374 "Error: --agc_compression_gain must be specified between 0 and 90.\n"); |
| 366 | 375 |
| 367 ReportConditionalErrorAndExit( | 376 ReportConditionalErrorAndExit( |
| 377 *settings.use_agc && *settings.use_agc2, |
| 378 "Error: --agc and --agc2 cannot be both active.\n"); |
| 379 |
| 380 ReportConditionalErrorAndExit( |
| 368 settings.vad_likelihood && | 381 settings.vad_likelihood && |
| 369 ((*settings.vad_likelihood) < 0 || (*settings.vad_likelihood) > 3), | 382 ((*settings.vad_likelihood) < 0 || (*settings.vad_likelihood) > 3), |
| 370 "Error: --vad_likelihood must be specified between 0 and 3.\n"); | 383 "Error: --vad_likelihood must be specified between 0 and 3.\n"); |
| 371 | 384 |
| 372 ReportConditionalErrorAndExit( | 385 ReportConditionalErrorAndExit( |
| 373 settings.ns_level && | 386 settings.ns_level && |
| 374 ((*settings.ns_level) < 0 || (*settings.ns_level) > 3), | 387 ((*settings.ns_level) < 0 || (*settings.ns_level) > 3), |
| 375 "Error: --ns_level must be specified between 0 and 3.\n"); | 388 "Error: --ns_level must be specified between 0 and 3.\n"); |
| 376 | 389 |
| 377 ReportConditionalErrorAndExit( | 390 ReportConditionalErrorAndExit( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 475 |
| 463 return 0; | 476 return 0; |
| 464 } | 477 } |
| 465 | 478 |
| 466 } // namespace test | 479 } // namespace test |
| 467 } // namespace webrtc | 480 } // namespace webrtc |
| 468 | 481 |
| 469 int main(int argc, char* argv[]) { | 482 int main(int argc, char* argv[]) { |
| 470 return webrtc::test::main(argc, argv); | 483 return webrtc::test::main(argc, argv); |
| 471 } | 484 } |
| OLD | NEW |