Chromium Code Reviews| 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_int(agc_target_level, | 143 DEFINE_int(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_int(agc_limiter, | 146 DEFINE_int(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_int(agc_compression_gain, | 149 DEFINE_int(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_float(agc2_fixed_gain_db, 0.0, "AGC2 fixed gain (dB) to apply"); | |
| 152 DEFINE_int(vad_likelihood, | 153 DEFINE_int(vad_likelihood, |
| 153 kParameterNotSpecifiedValue, | 154 kParameterNotSpecifiedValue, |
| 154 "Specify the VAD likelihood (0-3)"); | 155 "Specify the VAD likelihood (0-3)"); |
| 155 DEFINE_int(ns_level, | 156 DEFINE_int(ns_level, |
| 156 kParameterNotSpecifiedValue, | 157 kParameterNotSpecifiedValue, |
| 157 "Specify the NS level (0-3)"); | 158 "Specify the NS level (0-3)"); |
| 158 DEFINE_int(stream_delay, | 159 DEFINE_int(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_int(stream_drift_samples, | 162 DEFINE_int(stream_drift_samples, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 181 *parameter = rtc::Optional<std::string>(value); | 182 *parameter = rtc::Optional<std::string>(value); |
| 182 } | 183 } |
| 183 } | 184 } |
| 184 | 185 |
| 185 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) { | 186 void SetSettingIfSpecified(int value, rtc::Optional<int>* parameter) { |
| 186 if (value != kParameterNotSpecifiedValue) { | 187 if (value != kParameterNotSpecifiedValue) { |
| 187 *parameter = rtc::Optional<int>(value); | 188 *parameter = rtc::Optional<int>(value); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 192 void SetSettingIfSpecified(double value, rtc::Optional<double>* parameter) { | |
| 193 if (value != kParameterNotSpecifiedValue) { | |
|
peah-webrtc
2017/09/15 07:44:25
I'm not 100 % sure this comparison can be done for
AleBzk
2017/09/29 09:39:06
Right. I removed this function, since it was only
| |
| 194 *parameter = rtc::Optional<double>(value); | |
| 195 } | |
| 196 } | |
| 197 | |
| 191 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) { | 198 void SetSettingIfFlagSet(int32_t flag, rtc::Optional<bool>* parameter) { |
| 192 if (flag == 0) { | 199 if (flag == 0) { |
| 193 *parameter = rtc::Optional<bool>(false); | 200 *parameter = rtc::Optional<bool>(false); |
| 194 } else if (flag == 1) { | 201 } else if (flag == 1) { |
| 195 *parameter = rtc::Optional<bool>(true); | 202 *parameter = rtc::Optional<bool>(true); |
| 196 } | 203 } |
| 197 } | 204 } |
| 198 | 205 |
| 199 SimulationSettings CreateSettings() { | 206 SimulationSettings CreateSettings() { |
| 200 SimulationSettings settings; | 207 SimulationSettings settings; |
| 201 if (FLAG_all_default) { | 208 if (FLAG_all_default) { |
| 202 settings.use_le = rtc::Optional<bool>(true); | 209 settings.use_le = rtc::Optional<bool>(true); |
| 203 settings.use_vad = rtc::Optional<bool>(true); | 210 settings.use_vad = rtc::Optional<bool>(true); |
| 204 settings.use_ie = rtc::Optional<bool>(false); | 211 settings.use_ie = rtc::Optional<bool>(false); |
| 205 settings.use_bf = rtc::Optional<bool>(false); | 212 settings.use_bf = rtc::Optional<bool>(false); |
| 206 settings.use_ts = rtc::Optional<bool>(true); | 213 settings.use_ts = rtc::Optional<bool>(true); |
| 207 settings.use_ns = rtc::Optional<bool>(true); | 214 settings.use_ns = rtc::Optional<bool>(true); |
| 208 settings.use_hpf = rtc::Optional<bool>(true); | 215 settings.use_hpf = rtc::Optional<bool>(true); |
| 209 settings.use_agc = rtc::Optional<bool>(true); | 216 settings.use_agc = rtc::Optional<bool>(true); |
| 217 settings.use_agc2 = rtc::Optional<bool>(false); | |
| 210 settings.use_aec = rtc::Optional<bool>(true); | 218 settings.use_aec = rtc::Optional<bool>(true); |
| 211 settings.use_aecm = rtc::Optional<bool>(false); | 219 settings.use_aecm = rtc::Optional<bool>(false); |
| 212 settings.use_ed = rtc::Optional<bool>(false); | 220 settings.use_ed = rtc::Optional<bool>(false); |
| 213 } | 221 } |
| 214 SetSettingIfSpecified(FLAG_dump_input, &settings.aec_dump_input_filename); | 222 SetSettingIfSpecified(FLAG_dump_input, &settings.aec_dump_input_filename); |
| 215 SetSettingIfSpecified(FLAG_dump_output, &settings.aec_dump_output_filename); | 223 SetSettingIfSpecified(FLAG_dump_output, &settings.aec_dump_output_filename); |
| 216 SetSettingIfSpecified(FLAG_i, &settings.input_filename); | 224 SetSettingIfSpecified(FLAG_i, &settings.input_filename); |
| 217 SetSettingIfSpecified(FLAG_o, &settings.output_filename); | 225 SetSettingIfSpecified(FLAG_o, &settings.output_filename); |
| 218 SetSettingIfSpecified(FLAG_ri, &settings.reverse_input_filename); | 226 SetSettingIfSpecified(FLAG_ri, &settings.reverse_input_filename); |
| 219 SetSettingIfSpecified(FLAG_ro, &settings.reverse_output_filename); | 227 SetSettingIfSpecified(FLAG_ro, &settings.reverse_output_filename); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 SetSettingIfFlagSet(FLAG_lc, &settings.use_lc); | 263 SetSettingIfFlagSet(FLAG_lc, &settings.use_lc); |
| 256 SetSettingIfFlagSet(FLAG_experimental_agc, &settings.use_experimental_agc); | 264 SetSettingIfFlagSet(FLAG_experimental_agc, &settings.use_experimental_agc); |
| 257 SetSettingIfSpecified(FLAG_aecm_routing_mode, &settings.aecm_routing_mode); | 265 SetSettingIfSpecified(FLAG_aecm_routing_mode, &settings.aecm_routing_mode); |
| 258 SetSettingIfFlagSet(FLAG_aecm_comfort_noise, | 266 SetSettingIfFlagSet(FLAG_aecm_comfort_noise, |
| 259 &settings.use_aecm_comfort_noise); | 267 &settings.use_aecm_comfort_noise); |
| 260 SetSettingIfSpecified(FLAG_agc_mode, &settings.agc_mode); | 268 SetSettingIfSpecified(FLAG_agc_mode, &settings.agc_mode); |
| 261 SetSettingIfSpecified(FLAG_agc_target_level, &settings.agc_target_level); | 269 SetSettingIfSpecified(FLAG_agc_target_level, &settings.agc_target_level); |
| 262 SetSettingIfFlagSet(FLAG_agc_limiter, &settings.use_agc_limiter); | 270 SetSettingIfFlagSet(FLAG_agc_limiter, &settings.use_agc_limiter); |
| 263 SetSettingIfSpecified(FLAG_agc_compression_gain, | 271 SetSettingIfSpecified(FLAG_agc_compression_gain, |
| 264 &settings.agc_compression_gain); | 272 &settings.agc_compression_gain); |
| 273 SetSettingIfSpecified(FLAG_agc2_fixed_gain_db, &settings.agc2_fixed_gain_db); | |
| 265 SetSettingIfSpecified(FLAG_vad_likelihood, &settings.vad_likelihood); | 274 SetSettingIfSpecified(FLAG_vad_likelihood, &settings.vad_likelihood); |
| 266 SetSettingIfSpecified(FLAG_ns_level, &settings.ns_level); | 275 SetSettingIfSpecified(FLAG_ns_level, &settings.ns_level); |
| 267 SetSettingIfSpecified(FLAG_stream_delay, &settings.stream_delay); | 276 SetSettingIfSpecified(FLAG_stream_delay, &settings.stream_delay); |
| 268 SetSettingIfSpecified(FLAG_stream_drift_samples, | 277 SetSettingIfSpecified(FLAG_stream_drift_samples, |
| 269 &settings.stream_drift_samples); | 278 &settings.stream_drift_samples); |
| 270 SetSettingIfSpecified(FLAG_custom_call_order_file, | 279 SetSettingIfSpecified(FLAG_custom_call_order_file, |
| 271 &settings.custom_call_order_filename); | 280 &settings.custom_call_order_filename); |
| 272 settings.report_performance = FLAG_performance_report; | 281 settings.report_performance = FLAG_performance_report; |
| 273 settings.use_verbose_logging = FLAG_verbose; | 282 settings.use_verbose_logging = FLAG_verbose; |
| 274 settings.report_bitexactness = FLAG_bitexactness_report; | 283 settings.report_bitexactness = FLAG_bitexactness_report; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 settings.agc_target_level && ((*settings.agc_target_level) < 0 || | 368 settings.agc_target_level && ((*settings.agc_target_level) < 0 || |
| 360 (*settings.agc_target_level) > 31), | 369 (*settings.agc_target_level) > 31), |
| 361 "Error: --agc_target_level must be specified between 0 and 31.\n"); | 370 "Error: --agc_target_level must be specified between 0 and 31.\n"); |
| 362 | 371 |
| 363 ReportConditionalErrorAndExit( | 372 ReportConditionalErrorAndExit( |
| 364 settings.agc_compression_gain && ((*settings.agc_compression_gain) < 0 || | 373 settings.agc_compression_gain && ((*settings.agc_compression_gain) < 0 || |
| 365 (*settings.agc_compression_gain) > 90), | 374 (*settings.agc_compression_gain) > 90), |
| 366 "Error: --agc_compression_gain must be specified between 0 and 90.\n"); | 375 "Error: --agc_compression_gain must be specified between 0 and 90.\n"); |
| 367 | 376 |
| 368 ReportConditionalErrorAndExit( | 377 ReportConditionalErrorAndExit( |
| 378 *settings.use_agc && *settings.use_agc2, | |
| 379 "Error: --agc and --agc2 cannot be both active.\n"); | |
| 380 | |
| 381 ReportConditionalErrorAndExit( | |
| 369 settings.vad_likelihood && | 382 settings.vad_likelihood && |
| 370 ((*settings.vad_likelihood) < 0 || (*settings.vad_likelihood) > 3), | 383 ((*settings.vad_likelihood) < 0 || (*settings.vad_likelihood) > 3), |
| 371 "Error: --vad_likelihood must be specified between 0 and 3.\n"); | 384 "Error: --vad_likelihood must be specified between 0 and 3.\n"); |
| 372 | 385 |
| 373 ReportConditionalErrorAndExit( | 386 ReportConditionalErrorAndExit( |
| 374 settings.ns_level && | 387 settings.ns_level && |
| 375 ((*settings.ns_level) < 0 || (*settings.ns_level) > 3), | 388 ((*settings.ns_level) < 0 || (*settings.ns_level) > 3), |
| 376 "Error: --ns_level must be specified between 0 and 3.\n"); | 389 "Error: --ns_level must be specified between 0 and 3.\n"); |
| 377 | 390 |
| 378 ReportConditionalErrorAndExit( | 391 ReportConditionalErrorAndExit( |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 | 483 |
| 471 return 0; | 484 return 0; |
| 472 } | 485 } |
| 473 | 486 |
| 474 } // namespace test | 487 } // namespace test |
| 475 } // namespace webrtc | 488 } // namespace webrtc |
| 476 | 489 |
| 477 int main(int argc, char* argv[]) { | 490 int main(int argc, char* argv[]) { |
| 478 return webrtc::test::main(argc, argv); | 491 return webrtc::test::main(argc, argv); |
| 479 } | 492 } |
| OLD | NEW |