Hooks up more AEC3 parameters to be read by the AEC3 configuration file

Bug: webrtc:8671
Change-Id: I593ea4965ab2f8215e5d55e0778caf83cf62d4e1
Reviewed-on: https://webrtc-review.googlesource.com/94480
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24304}
This commit is contained in:
Per Åhgren 2018-08-16 09:29:18 +02:00 committed by Commit Bot
parent 315ce5b308
commit aa91b3c67e

View file

@ -141,6 +141,28 @@ void ReadParam(const Json::Value& root,
}
}
void ReadParam(const Json::Value& root,
std::string param_name,
EchoCanceller3Config::Suppressor::MaskingThresholds* param) {
RTC_CHECK(param);
Json::Value json_array;
if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
std::vector<double> v;
rtc::JsonArrayToDoubleVector(json_array, &v);
if (v.size() != 3) {
std::cout << "Incorrect array size for " << param_name << std::endl;
RTC_CHECK(false);
}
param->enr_transparent = static_cast<float>(v[0]);
param->enr_suppress = static_cast<float>(v[1]);
param->emr_transparent = static_cast<float>(v[2]);
std::cout << param_name << ":"
<< "[" << param->enr_transparent << "," << param->enr_suppress
<< "," << param->emr_transparent << "]" << std::endl;
}
}
EchoCanceller3Config ParseAec3Parameters(const std::string& filename) {
EchoCanceller3Config cfg;
Json::Value root;
@ -250,6 +272,9 @@ EchoCanceller3Config ParseAec3Parameters(const std::string& filename) {
ReadParam(section, "normal", &cfg.gain_updates.normal);
ReadParam(section, "saturation", &cfg.gain_updates.saturation);
ReadParam(section, "nonlinear", &cfg.gain_updates.nonlinear);
ReadParam(section, "max_inc_factor", &cfg.gain_updates.max_inc_factor);
ReadParam(section, "max_dec_factor_lf",
&cfg.gain_updates.max_dec_factor_lf);
ReadParam(section, "floor_first_increase",
&cfg.gain_updates.floor_first_increase);
}
@ -293,6 +318,15 @@ EchoCanceller3Config ParseAec3Parameters(const std::string& filename) {
ReadParam(section, "nonlinear_release", &cfg.echo_model.nonlinear_release);
}
if (rtc::GetValueFromJsonObject(root, "suppressor", &section)) {
ReadParam(section, "bands_with_reliable_coherence",
&cfg.suppressor.bands_with_reliable_coherence);
ReadParam(section, "nearend_average_blocks",
&cfg.suppressor.nearend_average_blocks);
ReadParam(section, "mask_lf", &cfg.suppressor.mask_lf);
ReadParam(section, "mask_hf", &cfg.suppressor.mask_hf);
}
std::cout << std::endl;
return cfg;
}