Rework transient suppressor configuration in audioproc_f

The transient suppressor can be configured as:
0 - Deactivated
1 - Activated with key events from aecdump
2 - Activated with continuous key events (for debugging purposes)

Bug: webrtc:5298
Change-Id: I116eb08ad50178dc5116d5d967084e6c9967f258
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211869
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33464}
This commit is contained in:
Gustaf Ullberg 2021-03-15 14:26:40 +01:00 committed by Commit Bot
parent 685be147cb
commit fdd6099348
4 changed files with 29 additions and 23 deletions

View file

@ -164,12 +164,15 @@ void AecDumpBasedSimulator::PrepareProcessStreamCall(
} }
} }
if (!settings_.use_ts) { if (!settings_.use_ts || *settings_.use_ts == 1) {
// Transient suppressor activated (1) or not specified.
if (msg.has_keypress()) { if (msg.has_keypress()) {
ap_->set_stream_key_pressed(msg.keypress()); ap_->set_stream_key_pressed(msg.keypress());
} }
} else { } else {
ap_->set_stream_key_pressed(*settings_.use_ts); // Transient suppressor deactivated (0) or activated with continuous key
// events (2).
ap_->set_stream_key_pressed(*settings_.use_ts == 2);
} }
// Level is always logged in AEC dumps. // Level is always logged in AEC dumps.

View file

@ -467,7 +467,7 @@ void AudioProcessingSimulator::DetachAecDump() {
void AudioProcessingSimulator::ConfigureAudioProcessor() { void AudioProcessingSimulator::ConfigureAudioProcessor() {
AudioProcessing::Config apm_config; AudioProcessing::Config apm_config;
if (settings_.use_ts) { if (settings_.use_ts) {
apm_config.transient_suppression.enabled = *settings_.use_ts; apm_config.transient_suppression.enabled = *settings_.use_ts != 0;
} }
if (settings_.multi_channel_render) { if (settings_.multi_channel_render) {
apm_config.pipeline.multi_channel_render = *settings_.multi_channel_render; apm_config.pipeline.multi_channel_render = *settings_.multi_channel_render;
@ -574,7 +574,9 @@ void AudioProcessingSimulator::ConfigureAudioProcessor() {
ap_->ApplyConfig(apm_config); ap_->ApplyConfig(apm_config);
if (settings_.use_ts) { if (settings_.use_ts) {
ap_->set_stream_key_pressed(*settings_.use_ts); // Default to key pressed if activating the transient suppressor with
// continuous key events.
ap_->set_stream_key_pressed(*settings_.use_ts == 2);
} }
if (settings_.aec_dump_output_filename) { if (settings_.aec_dump_output_filename) {

View file

@ -101,7 +101,7 @@ struct SimulationSettings {
absl::optional<bool> use_pre_amplifier; absl::optional<bool> use_pre_amplifier;
absl::optional<bool> use_hpf; absl::optional<bool> use_hpf;
absl::optional<bool> use_ns; absl::optional<bool> use_ns;
absl::optional<bool> use_ts; absl::optional<int> use_ts;
absl::optional<bool> use_analog_agc; absl::optional<bool> use_analog_agc;
absl::optional<bool> use_vad; absl::optional<bool> use_vad;
absl::optional<bool> use_le; absl::optional<bool> use_le;

View file

@ -65,11 +65,11 @@ ABSL_FLAG(bool,
ABSL_FLAG(int, ABSL_FLAG(int,
aec, aec,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the echo canceller"); "Activate (1) or deactivate (0) the echo canceller");
ABSL_FLAG(int, ABSL_FLAG(int,
aecm, aecm,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the mobile echo controller"); "Activate (1) or deactivate (0) the mobile echo controller");
ABSL_FLAG(int, ABSL_FLAG(int,
ed, ed,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
@ -81,39 +81,40 @@ ABSL_FLAG(std::string,
ABSL_FLAG(int, ABSL_FLAG(int,
agc, agc,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AGC"); "Activate (1) or deactivate (0) the AGC");
ABSL_FLAG(int, ABSL_FLAG(int,
agc2, agc2,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AGC2"); "Activate (1) or deactivate (0) the AGC2");
ABSL_FLAG(int, ABSL_FLAG(int,
pre_amplifier, pre_amplifier,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the pre amplifier"); "Activate (1) or deactivate (0) the pre amplifier");
ABSL_FLAG(int, ABSL_FLAG(int,
hpf, hpf,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the high-pass filter"); "Activate (1) or deactivate (0) the high-pass filter");
ABSL_FLAG(int, ABSL_FLAG(int,
ns, ns,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the noise suppressor"); "Activate (1) or deactivate (0) the noise suppressor");
ABSL_FLAG(int, ABSL_FLAG(int,
ts, ts,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the transient suppressor"); "Activate (1), deactivate (0) or activate the transient suppressor "
"with continuous key events (2)");
ABSL_FLAG(int, ABSL_FLAG(int,
analog_agc, analog_agc,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the transient suppressor"); "Activate (1) or deactivate (0) the analog AGC");
ABSL_FLAG(int, ABSL_FLAG(int,
vad, vad,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the voice activity detector"); "Activate (1) or deactivate (0) the voice activity detector");
ABSL_FLAG(int, ABSL_FLAG(int,
le, le,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the level estimator"); "Activate (1) or deactivate (0) the level estimator");
ABSL_FLAG(bool, ABSL_FLAG(bool,
all_default, all_default,
false, false,
@ -135,7 +136,7 @@ ABSL_FLAG(int,
ABSL_FLAG(int, ABSL_FLAG(int,
agc_limiter, agc_limiter,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the level estimator"); "Activate (1) or deactivate (0) the level estimator");
ABSL_FLAG(int, ABSL_FLAG(int,
agc_compression_gain, agc_compression_gain,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
@ -143,7 +144,7 @@ ABSL_FLAG(int,
ABSL_FLAG(int, ABSL_FLAG(int,
agc2_enable_adaptive_gain, agc2_enable_adaptive_gain,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) the AGC2 adaptive gain"); "Activate (1) or deactivate (0) the AGC2 adaptive gain");
ABSL_FLAG(float, ABSL_FLAG(float,
agc2_fixed_gain_db, agc2_fixed_gain_db,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
@ -177,7 +178,7 @@ ABSL_FLAG(int,
ABSL_FLAG(int, ABSL_FLAG(int,
use_stream_delay, use_stream_delay,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) reporting the stream delay"); "Activate (1) or deactivate (0) reporting the stream delay");
ABSL_FLAG(int, ABSL_FLAG(int,
stream_drift_samples, stream_drift_samples,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
@ -186,16 +187,16 @@ ABSL_FLAG(int, initial_mic_level, 100, "Initial mic level (0-255)");
ABSL_FLAG(int, ABSL_FLAG(int,
simulate_mic_gain, simulate_mic_gain,
0, 0,
"Activate (1) or deactivate(0) the analog mic gain simulation"); "Activate (1) or deactivate (0) the analog mic gain simulation");
ABSL_FLAG(int, ABSL_FLAG(int,
multi_channel_render, multi_channel_render,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) multi-channel render processing in " "Activate (1) or deactivate (0) multi-channel render processing in "
"APM pipeline"); "APM pipeline");
ABSL_FLAG(int, ABSL_FLAG(int,
multi_channel_capture, multi_channel_capture,
kParameterNotSpecifiedValue, kParameterNotSpecifiedValue,
"Activate (1) or deactivate(0) multi-channel capture processing in " "Activate (1) or deactivate (0) multi-channel capture processing in "
"APM pipeline"); "APM pipeline");
ABSL_FLAG(int, ABSL_FLAG(int,
simulated_mic_kind, simulated_mic_kind,
@ -415,7 +416,7 @@ SimulationSettings CreateSettings() {
&settings.use_pre_amplifier); &settings.use_pre_amplifier);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_hpf), &settings.use_hpf); SetSettingIfFlagSet(absl::GetFlag(FLAGS_hpf), &settings.use_hpf);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_ns), &settings.use_ns); SetSettingIfFlagSet(absl::GetFlag(FLAGS_ns), &settings.use_ns);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_ts), &settings.use_ts); SetSettingIfSpecified(absl::GetFlag(FLAGS_ts), &settings.use_ts);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_analog_agc), SetSettingIfFlagSet(absl::GetFlag(FLAGS_analog_agc),
&settings.use_analog_agc); &settings.use_analog_agc);
SetSettingIfFlagSet(absl::GetFlag(FLAGS_vad), &settings.use_vad); SetSettingIfFlagSet(absl::GetFlag(FLAGS_vad), &settings.use_vad);