AEC3: Add signal dependent mixing before alignment

This CL adds code for doing signal-dependent downmixing
before the delay estimation in the multichannel case.

As part of the CL, the unittests of the render delay
controller are corrected. However, as that caused some of
them to fail, the CL (for now) as well disables the failing
test.

Bug: webrtc:11153,chromium:1029740, webrtc:11161
Change-Id: I0b765c28fa5e547aabd6dfbd24b626ff9a16346f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161045
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29980}
This commit is contained in:
Per Åhgren
2019-12-03 11:24:59 +01:00
committed by Commit Bot
parent 3a77f93589
commit 6a05bb1b12
19 changed files with 610 additions and 91 deletions

View File

@ -47,8 +47,15 @@ struct RTC_EXPORT EchoCanceller3Config {
int converged;
} delay_selection_thresholds = {5, 20};
bool use_external_delay_estimator = false;
bool downmix_before_delay_estimation = false;
bool log_warning_on_delay_changes = false;
struct AlignmentMixing {
bool downmix;
bool adaptive_selection;
float activity_power_threshold;
bool prefer_first_two_channels;
};
AlignmentMixing render_alignment_mixing = {false, true, 10000.f, true};
AlignmentMixing capture_alignment_mixing = {false, true, 10000.f, false};
} delay;
struct Filter {

View File

@ -92,6 +92,22 @@ void ReadParam(const Json::Value& root,
}
}
void ReadParam(const Json::Value& root,
std::string param_name,
EchoCanceller3Config::Delay::AlignmentMixing* param) {
RTC_DCHECK(param);
Json::Value subsection;
if (rtc::GetValueFromJsonObject(root, param_name, &subsection)) {
ReadParam(subsection, "downmix", &param->downmix);
ReadParam(subsection, "adaptive_selection", &param->adaptive_selection);
ReadParam(subsection, "activity_power_threshold",
&param->activity_power_threshold);
ReadParam(subsection, "prefer_first_two_channels",
&param->prefer_first_two_channels);
}
}
void ReadParam(
const Json::Value& root,
std::string param_name,
@ -189,10 +205,13 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
ReadParam(section, "use_external_delay_estimator",
&cfg.delay.use_external_delay_estimator);
ReadParam(section, "downmix_before_delay_estimation",
&cfg.delay.downmix_before_delay_estimation);
ReadParam(section, "log_warning_on_delay_changes",
&cfg.delay.log_warning_on_delay_changes);
ReadParam(section, "render_alignment_mixing",
&cfg.delay.render_alignment_mixing);
ReadParam(section, "capture_alignment_mixing",
&cfg.delay.capture_alignment_mixing);
}
if (rtc::GetValueFromJsonObject(aec3_root, "filter", &section)) {
@ -403,11 +422,40 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"use_external_delay_estimator\": "
<< (config.delay.use_external_delay_estimator ? "true" : "false") << ",";
ost << "\"downmix_before_delay_estimation\": "
<< (config.delay.downmix_before_delay_estimation ? "true" : "false")
<< ",";
ost << "\"log_warning_on_delay_changes\": "
<< (config.delay.log_warning_on_delay_changes ? "true" : "false");
<< (config.delay.log_warning_on_delay_changes ? "true" : "false") << ",";
ost << "\"render_alignment_mixing\": {";
ost << "\"downmix\": "
<< (config.delay.render_alignment_mixing.downmix ? "true" : "false")
<< ",";
ost << "\"adaptive_selection\": "
<< (config.delay.render_alignment_mixing.adaptive_selection ? "true"
: "false")
<< ",";
ost << "\"activity_power_threshold\": "
<< config.delay.render_alignment_mixing.activity_power_threshold << ",";
ost << "\"prefer_first_two_channels\": "
<< (config.delay.render_alignment_mixing.prefer_first_two_channels
? "true"
: "false");
ost << "},";
ost << "\"capture_alignment_mixing\": {";
ost << "\"downmix\": "
<< (config.delay.capture_alignment_mixing.downmix ? "true" : "false")
<< ",";
ost << "\"adaptive_selection\": "
<< (config.delay.capture_alignment_mixing.adaptive_selection ? "true"
: "false")
<< ",";
ost << "\"activity_power_threshold\": "
<< config.delay.capture_alignment_mixing.activity_power_threshold << ",";
ost << "\"prefer_first_two_channels\": "
<< (config.delay.capture_alignment_mixing.prefer_first_two_channels
? "true"
: "false");
ost << "}";
ost << "},";
ost << "\"filter\": {";