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:
@ -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 {
|
||||
|
||||
@ -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", ¶m->downmix);
|
||||
ReadParam(subsection, "adaptive_selection", ¶m->adaptive_selection);
|
||||
ReadParam(subsection, "activity_power_threshold",
|
||||
¶m->activity_power_threshold);
|
||||
ReadParam(subsection, "prefer_first_two_channels",
|
||||
¶m->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", §ion)) {
|
||||
@ -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\": {";
|
||||
|
||||
Reference in New Issue
Block a user