blob: ed79a014e38f8d7872ef51d9b5c06a02728e9618 [file] [log] [blame]
Sam Zackrissona4c85142018-10-10 10:44:43 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10#include "api/audio/echo_canceller3_config_json.h"
11
12#include <string>
13#include <vector>
14
15#include "rtc_base/logging.h"
16#include "rtc_base/strings/json.h"
17#include "rtc_base/strings/string_builder.h"
18
19namespace webrtc {
20namespace {
21void ReadParam(const Json::Value& root, std::string param_name, bool* param) {
22 RTC_DCHECK(param);
23 bool v;
24 if (rtc::GetBoolFromJsonObject(root, param_name, &v)) {
25 *param = v;
26 }
27}
28
29void ReadParam(const Json::Value& root, std::string param_name, size_t* param) {
30 RTC_DCHECK(param);
31 int v;
32 if (rtc::GetIntFromJsonObject(root, param_name, &v)) {
33 *param = v;
34 }
35}
36
37void ReadParam(const Json::Value& root, std::string param_name, int* param) {
38 RTC_DCHECK(param);
39 int v;
40 if (rtc::GetIntFromJsonObject(root, param_name, &v)) {
41 *param = v;
42 }
43}
44
45void ReadParam(const Json::Value& root, std::string param_name, float* param) {
46 RTC_DCHECK(param);
47 double v;
48 if (rtc::GetDoubleFromJsonObject(root, param_name, &v)) {
49 *param = static_cast<float>(v);
50 }
51}
52
53void ReadParam(const Json::Value& root,
54 std::string param_name,
55 EchoCanceller3Config::Filter::MainConfiguration* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020056 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020057 Json::Value json_array;
58 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
59 std::vector<double> v;
60 rtc::JsonArrayToDoubleVector(json_array, &v);
61 if (v.size() != 6) {
62 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +020063 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +020064 }
65 param->length_blocks = static_cast<size_t>(v[0]);
66 param->leakage_converged = static_cast<float>(v[1]);
67 param->leakage_diverged = static_cast<float>(v[2]);
68 param->error_floor = static_cast<float>(v[3]);
69 param->error_ceil = static_cast<float>(v[4]);
70 param->noise_gate = static_cast<float>(v[5]);
71 }
72}
73
74void ReadParam(const Json::Value& root,
75 std::string param_name,
76 EchoCanceller3Config::Filter::ShadowConfiguration* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020077 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020078 Json::Value json_array;
79 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
80 std::vector<double> v;
81 rtc::JsonArrayToDoubleVector(json_array, &v);
82 if (v.size() != 3) {
83 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +020084 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +020085 }
86 param->length_blocks = static_cast<size_t>(v[0]);
87 param->rate = static_cast<float>(v[1]);
88 param->noise_gate = static_cast<float>(v[2]);
89 }
90}
91
92void ReadParam(const Json::Value& root,
93 std::string param_name,
94 EchoCanceller3Config::Suppressor::MaskingThresholds* param) {
Sam Zackrisson703259c2018-10-10 17:17:43 +020095 RTC_DCHECK(param);
Sam Zackrissona4c85142018-10-10 10:44:43 +020096 Json::Value json_array;
97 if (rtc::GetValueFromJsonObject(root, param_name, &json_array)) {
98 std::vector<double> v;
99 rtc::JsonArrayToDoubleVector(json_array, &v);
100 if (v.size() != 3) {
101 RTC_LOG(LS_ERROR) << "Incorrect array size for " << param_name;
Sam Zackrisson703259c2018-10-10 17:17:43 +0200102 return;
Sam Zackrissona4c85142018-10-10 10:44:43 +0200103 }
104 param->enr_transparent = static_cast<float>(v[0]);
105 param->enr_suppress = static_cast<float>(v[1]);
106 param->emr_transparent = static_cast<float>(v[2]);
107 }
108}
109} // namespace
110
111EchoCanceller3Config Aec3ConfigFromJsonString(absl::string_view json_string) {
112 EchoCanceller3Config cfg;
113
114 Json::Value root;
115 bool success = Json::Reader().parse(std::string(json_string), root);
116 if (!success) {
117 RTC_LOG(LS_ERROR) << "Incorrect JSON format: " << json_string;
118 return EchoCanceller3Config();
119 }
120
121 Json::Value aec3_root;
122 success = rtc::GetValueFromJsonObject(root, "aec3", &aec3_root);
123 if (!success) {
124 RTC_LOG(LS_ERROR) << "Missing AEC3 config field: " << json_string;
125 return EchoCanceller3Config();
126 }
127
128 Json::Value section;
Gustaf Ullberg11539f02018-10-15 13:40:29 +0200129 if (rtc::GetValueFromJsonObject(root, "buffering", &section)) {
130 ReadParam(section, "use_new_render_buffering",
131 &cfg.buffering.use_new_render_buffering);
132 ReadParam(section, "excess_render_detection_interval_blocks",
133 &cfg.buffering.excess_render_detection_interval_blocks);
134 ReadParam(section, "max_allowed_excess_render_blocks",
135 &cfg.buffering.max_allowed_excess_render_blocks);
136 }
137
Sam Zackrissona4c85142018-10-10 10:44:43 +0200138 if (rtc::GetValueFromJsonObject(aec3_root, "delay", &section)) {
139 ReadParam(section, "default_delay", &cfg.delay.default_delay);
140 ReadParam(section, "down_sampling_factor", &cfg.delay.down_sampling_factor);
141 ReadParam(section, "num_filters", &cfg.delay.num_filters);
142 ReadParam(section, "api_call_jitter_blocks",
143 &cfg.delay.api_call_jitter_blocks);
144 ReadParam(section, "min_echo_path_delay_blocks",
145 &cfg.delay.min_echo_path_delay_blocks);
146 ReadParam(section, "delay_headroom_blocks",
147 &cfg.delay.delay_headroom_blocks);
148 ReadParam(section, "hysteresis_limit_1_blocks",
149 &cfg.delay.hysteresis_limit_1_blocks);
150 ReadParam(section, "hysteresis_limit_2_blocks",
151 &cfg.delay.hysteresis_limit_2_blocks);
152 ReadParam(section, "skew_hysteresis_blocks",
153 &cfg.delay.skew_hysteresis_blocks);
154 ReadParam(section, "fixed_capture_delay_samples",
155 &cfg.delay.fixed_capture_delay_samples);
156 ReadParam(section, "delay_estimate_smoothing",
157 &cfg.delay.delay_estimate_smoothing);
158 ReadParam(section, "delay_candidate_detection_threshold",
159 &cfg.delay.delay_candidate_detection_threshold);
160
161 Json::Value subsection;
162 if (rtc::GetValueFromJsonObject(section, "delay_selection_thresholds",
163 &subsection)) {
164 ReadParam(subsection, "initial",
165 &cfg.delay.delay_selection_thresholds.initial);
166 ReadParam(subsection, "converged",
167 &cfg.delay.delay_selection_thresholds.converged);
168 }
169 }
170
171 if (rtc::GetValueFromJsonObject(aec3_root, "filter", &section)) {
172 ReadParam(section, "main", &cfg.filter.main);
173 ReadParam(section, "shadow", &cfg.filter.shadow);
174 ReadParam(section, "main_initial", &cfg.filter.main_initial);
175 ReadParam(section, "shadow_initial", &cfg.filter.shadow_initial);
176 ReadParam(section, "config_change_duration_blocks",
177 &cfg.filter.config_change_duration_blocks);
178 ReadParam(section, "initial_state_seconds",
179 &cfg.filter.initial_state_seconds);
180 ReadParam(section, "conservative_initial_phase",
181 &cfg.filter.conservative_initial_phase);
182 ReadParam(section, "enable_shadow_filter_output_usage",
183 &cfg.filter.enable_shadow_filter_output_usage);
184 }
185
186 if (rtc::GetValueFromJsonObject(aec3_root, "erle", &section)) {
187 ReadParam(section, "min", &cfg.erle.min);
188 ReadParam(section, "max_l", &cfg.erle.max_l);
189 ReadParam(section, "max_h", &cfg.erle.max_h);
190 ReadParam(section, "onset_detection", &cfg.erle.onset_detection);
191 }
192
193 if (rtc::GetValueFromJsonObject(aec3_root, "ep_strength", &section)) {
194 ReadParam(section, "lf", &cfg.ep_strength.lf);
195 ReadParam(section, "mf", &cfg.ep_strength.mf);
196 ReadParam(section, "hf", &cfg.ep_strength.hf);
197 ReadParam(section, "default_len", &cfg.ep_strength.default_len);
198 ReadParam(section, "reverb_based_on_render",
199 &cfg.ep_strength.reverb_based_on_render);
200 ReadParam(section, "echo_can_saturate", &cfg.ep_strength.echo_can_saturate);
201 ReadParam(section, "bounded_erl", &cfg.ep_strength.bounded_erl);
202 }
203
Sam Zackrissona4c85142018-10-10 10:44:43 +0200204 if (rtc::GetValueFromJsonObject(aec3_root, "echo_audibility", &section)) {
205 ReadParam(section, "low_render_limit",
206 &cfg.echo_audibility.low_render_limit);
207 ReadParam(section, "normal_render_limit",
208 &cfg.echo_audibility.normal_render_limit);
209
210 ReadParam(section, "floor_power", &cfg.echo_audibility.floor_power);
211 ReadParam(section, "audibility_threshold_lf",
212 &cfg.echo_audibility.audibility_threshold_lf);
213 ReadParam(section, "audibility_threshold_mf",
214 &cfg.echo_audibility.audibility_threshold_mf);
215 ReadParam(section, "audibility_threshold_hf",
216 &cfg.echo_audibility.audibility_threshold_hf);
217 ReadParam(section, "use_stationary_properties",
218 &cfg.echo_audibility.use_stationary_properties);
219 ReadParam(section, "use_stationary_properties_at_init",
220 &cfg.echo_audibility.use_stationarity_properties_at_init);
221 }
222
223 if (rtc::GetValueFromJsonObject(aec3_root, "echo_removal_control",
224 &section)) {
225 Json::Value subsection;
226 if (rtc::GetValueFromJsonObject(section, "gain_rampup", &subsection)) {
227 ReadParam(subsection, "initial_gain",
228 &cfg.echo_removal_control.gain_rampup.initial_gain);
229 ReadParam(subsection, "first_non_zero_gain",
230 &cfg.echo_removal_control.gain_rampup.first_non_zero_gain);
231 ReadParam(subsection, "non_zero_gain_blocks",
232 &cfg.echo_removal_control.gain_rampup.non_zero_gain_blocks);
233 ReadParam(subsection, "full_gain_blocks",
234 &cfg.echo_removal_control.gain_rampup.full_gain_blocks);
235 }
236 ReadParam(section, "has_clock_drift",
237 &cfg.echo_removal_control.has_clock_drift);
238 ReadParam(section, "linear_and_stable_echo_path",
239 &cfg.echo_removal_control.linear_and_stable_echo_path);
240 }
241
242 if (rtc::GetValueFromJsonObject(aec3_root, "echo_model", &section)) {
243 Json::Value subsection;
244 ReadParam(section, "noise_floor_hold", &cfg.echo_model.noise_floor_hold);
245 ReadParam(section, "min_noise_floor_power",
246 &cfg.echo_model.min_noise_floor_power);
247 ReadParam(section, "stationary_gate_slope",
248 &cfg.echo_model.stationary_gate_slope);
249 ReadParam(section, "noise_gate_power", &cfg.echo_model.noise_gate_power);
250 ReadParam(section, "noise_gate_slope", &cfg.echo_model.noise_gate_slope);
251 ReadParam(section, "render_pre_window_size",
252 &cfg.echo_model.render_pre_window_size);
253 ReadParam(section, "render_post_window_size",
254 &cfg.echo_model.render_post_window_size);
255 ReadParam(section, "render_pre_window_size_init",
256 &cfg.echo_model.render_pre_window_size_init);
257 ReadParam(section, "render_post_window_size_init",
258 &cfg.echo_model.render_post_window_size_init);
259 ReadParam(section, "nonlinear_hold", &cfg.echo_model.nonlinear_hold);
260 ReadParam(section, "nonlinear_release", &cfg.echo_model.nonlinear_release);
261 }
262
263 Json::Value subsection;
264 if (rtc::GetValueFromJsonObject(aec3_root, "suppressor", &section)) {
265 ReadParam(section, "nearend_average_blocks",
266 &cfg.suppressor.nearend_average_blocks);
267
268 if (rtc::GetValueFromJsonObject(section, "normal_tuning", &subsection)) {
269 ReadParam(subsection, "mask_lf", &cfg.suppressor.normal_tuning.mask_lf);
270 ReadParam(subsection, "mask_hf", &cfg.suppressor.normal_tuning.mask_hf);
271 ReadParam(subsection, "max_inc_factor",
272 &cfg.suppressor.normal_tuning.max_inc_factor);
273 ReadParam(subsection, "max_dec_factor_lf",
274 &cfg.suppressor.normal_tuning.max_dec_factor_lf);
275 }
276
277 if (rtc::GetValueFromJsonObject(section, "nearend_tuning", &subsection)) {
278 ReadParam(subsection, "mask_lf", &cfg.suppressor.nearend_tuning.mask_lf);
279 ReadParam(subsection, "mask_hf", &cfg.suppressor.nearend_tuning.mask_hf);
280 ReadParam(subsection, "max_inc_factor",
281 &cfg.suppressor.nearend_tuning.max_inc_factor);
282 ReadParam(subsection, "max_dec_factor_lf",
283 &cfg.suppressor.nearend_tuning.max_dec_factor_lf);
284 }
285
286 if (rtc::GetValueFromJsonObject(section, "dominant_nearend_detection",
287 &subsection)) {
288 ReadParam(subsection, "enr_threshold",
289 &cfg.suppressor.dominant_nearend_detection.enr_threshold);
Gustaf Ullbergc9f9b872018-10-22 15:15:36 +0200290 ReadParam(subsection, "enr_exit_threshold",
291 &cfg.suppressor.dominant_nearend_detection.enr_exit_threshold);
Sam Zackrissona4c85142018-10-10 10:44:43 +0200292 ReadParam(subsection, "snr_threshold",
293 &cfg.suppressor.dominant_nearend_detection.snr_threshold);
294 ReadParam(subsection, "hold_duration",
295 &cfg.suppressor.dominant_nearend_detection.hold_duration);
296 ReadParam(subsection, "trigger_threshold",
297 &cfg.suppressor.dominant_nearend_detection.trigger_threshold);
298 }
299
300 if (rtc::GetValueFromJsonObject(section, "high_bands_suppression",
301 &subsection)) {
302 ReadParam(subsection, "enr_threshold",
303 &cfg.suppressor.high_bands_suppression.enr_threshold);
304 ReadParam(subsection, "max_gain_during_echo",
305 &cfg.suppressor.high_bands_suppression.max_gain_during_echo);
306 }
307
308 ReadParam(section, "floor_first_increase",
309 &cfg.suppressor.floor_first_increase);
310 ReadParam(section, "enforce_transparent",
311 &cfg.suppressor.enforce_transparent);
312 ReadParam(section, "enforce_empty_higher_bands",
313 &cfg.suppressor.enforce_empty_higher_bands);
314 }
315 return cfg;
316}
317
318std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
319 rtc::StringBuilder ost;
320 ost << "{";
321 ost << "\"aec3\": {";
322 ost << "\"delay\": {";
323 ost << "\"default_delay\": " << config.delay.default_delay << ",";
324 ost << "\"down_sampling_factor\": " << config.delay.down_sampling_factor
325 << ",";
326 ost << "\"num_filters\": " << config.delay.num_filters << ",";
327 ost << "\"api_call_jitter_blocks\": " << config.delay.api_call_jitter_blocks
328 << ",";
329 ost << "\"min_echo_path_delay_blocks\": "
330 << config.delay.min_echo_path_delay_blocks << ",";
331 ost << "\"delay_headroom_blocks\": " << config.delay.delay_headroom_blocks
332 << ",";
333 ost << "\"hysteresis_limit_1_blocks\": "
334 << config.delay.hysteresis_limit_1_blocks << ",";
335 ost << "\"hysteresis_limit_2_blocks\": "
336 << config.delay.hysteresis_limit_2_blocks << ",";
337 ost << "\"skew_hysteresis_blocks\": " << config.delay.skew_hysteresis_blocks
338 << ",";
339 ost << "\"fixed_capture_delay_samples\": "
340 << config.delay.fixed_capture_delay_samples << ",";
341 ost << "\"delay_estimate_smoothing\": "
342 << config.delay.delay_estimate_smoothing << ",";
343 ost << "\"delay_candidate_detection_threshold\": "
344 << config.delay.delay_candidate_detection_threshold << ",";
345
346 ost << "\"delay_selection_thresholds\": {";
347 ost << "\"initial\": " << config.delay.delay_selection_thresholds.initial
348 << ",";
349 ost << "\"converged\": " << config.delay.delay_selection_thresholds.converged;
350 ost << "}";
351
352 ost << "},";
353
354 ost << "\"filter\": {";
355 ost << "\"main\": [";
356 ost << config.filter.main.length_blocks << ",";
357 ost << config.filter.main.leakage_converged << ",";
358 ost << config.filter.main.leakage_diverged << ",";
359 ost << config.filter.main.error_floor << ",";
360 ost << config.filter.main.error_ceil << ",";
361 ost << config.filter.main.noise_gate;
362 ost << "],";
363
364 ost << "\"shadow\": [";
365 ost << config.filter.shadow.length_blocks << ",";
366 ost << config.filter.shadow.rate << ",";
367 ost << config.filter.shadow.noise_gate;
368 ost << "],";
369
370 ost << "\"main_initial\": [";
371 ost << config.filter.main_initial.length_blocks << ",";
372 ost << config.filter.main_initial.leakage_converged << ",";
373 ost << config.filter.main_initial.leakage_diverged << ",";
374 ost << config.filter.main_initial.error_floor << ",";
375 ost << config.filter.main_initial.error_ceil << ",";
376 ost << config.filter.main_initial.noise_gate;
377 ost << "],";
378
379 ost << "\"shadow_initial\": [";
380 ost << config.filter.shadow_initial.length_blocks << ",";
381 ost << config.filter.shadow_initial.rate << ",";
382 ost << config.filter.shadow_initial.noise_gate;
383 ost << "],";
384
385 ost << "\"config_change_duration_blocks\": "
386 << config.filter.config_change_duration_blocks << ",";
387 ost << "\"initial_state_seconds\": " << config.filter.initial_state_seconds
388 << ",";
389 ost << "\"conservative_initial_phase\": "
390 << (config.filter.conservative_initial_phase ? "true" : "false") << ",";
391 ost << "\"enable_shadow_filter_output_usage\": "
392 << (config.filter.enable_shadow_filter_output_usage ? "true" : "false");
393
394 ost << "},";
395
396 ost << "\"erle\": {";
397 ost << "\"min\": " << config.erle.min << ",";
398 ost << "\"max_l\": " << config.erle.max_l << ",";
399 ost << "\"max_h\": " << config.erle.max_h << ",";
400 ost << "\"onset_detection\": "
401 << (config.erle.onset_detection ? "true" : "false");
402 ost << "},";
403
404 ost << "\"ep_strength\": {";
405 ost << "\"lf\": " << config.ep_strength.lf << ",";
406 ost << "\"mf\": " << config.ep_strength.mf << ",";
407 ost << "\"hf\": " << config.ep_strength.hf << ",";
408 ost << "\"default_len\": " << config.ep_strength.default_len << ",";
409 ost << "\"reverb_based_on_render\": "
410 << (config.ep_strength.reverb_based_on_render ? "true" : "false") << ",";
411 ost << "\"echo_can_saturate\": "
412 << (config.ep_strength.echo_can_saturate ? "true" : "false") << ",";
413 ost << "\"bounded_erl\": "
414 << (config.ep_strength.bounded_erl ? "true" : "false");
415
416 ost << "},";
417
Sam Zackrissona4c85142018-10-10 10:44:43 +0200418 ost << "\"echo_audibility\": {";
419 ost << "\"low_render_limit\": " << config.echo_audibility.low_render_limit
420 << ",";
421 ost << "\"normal_render_limit\": "
422 << config.echo_audibility.normal_render_limit << ",";
423 ost << "\"floor_power\": " << config.echo_audibility.floor_power << ",";
424 ost << "\"audibility_threshold_lf\": "
425 << config.echo_audibility.audibility_threshold_lf << ",";
426 ost << "\"audibility_threshold_mf\": "
427 << config.echo_audibility.audibility_threshold_mf << ",";
428 ost << "\"audibility_threshold_hf\": "
429 << config.echo_audibility.audibility_threshold_hf << ",";
430 ost << "\"use_stationary_properties\": "
431 << (config.echo_audibility.use_stationary_properties ? "true" : "false")
432 << ",";
433 ost << "\"use_stationarity_properties_at_init\": "
434 << (config.echo_audibility.use_stationarity_properties_at_init ? "true"
435 : "false");
436 ost << "},";
437
438 ost << "\"render_levels\": {";
439 ost << "\"active_render_limit\": " << config.render_levels.active_render_limit
440 << ",";
441 ost << "\"poor_excitation_render_limit\": "
442 << config.render_levels.poor_excitation_render_limit << ",";
443 ost << "\"poor_excitation_render_limit_ds8\": "
444 << config.render_levels.poor_excitation_render_limit_ds8;
445 ost << "},";
446
447 ost << "\"echo_removal_control\": {";
448 ost << "\"gain_rampup\": {";
449 ost << "\"initial_gain\": "
450 << config.echo_removal_control.gain_rampup.initial_gain << ",";
451 ost << "\"first_non_zero_gain\": "
452 << config.echo_removal_control.gain_rampup.first_non_zero_gain << ",";
453 ost << "\"non_zero_gain_blocks\": "
454 << config.echo_removal_control.gain_rampup.non_zero_gain_blocks << ",";
455 ost << "\"full_gain_blocks\": "
456 << config.echo_removal_control.gain_rampup.full_gain_blocks;
457 ost << "},";
458 ost << "\"has_clock_drift\": "
459 << (config.echo_removal_control.has_clock_drift ? "true" : "false")
460 << ",";
461 ost << "\"linear_and_stable_echo_path\": "
462 << (config.echo_removal_control.linear_and_stable_echo_path ? "true"
463 : "false");
464
465 ost << "},";
466
467 ost << "\"echo_model\": {";
468 ost << "\"noise_floor_hold\": " << config.echo_model.noise_floor_hold << ",";
469 ost << "\"min_noise_floor_power\": "
470 << config.echo_model.min_noise_floor_power << ",";
471 ost << "\"stationary_gate_slope\": "
472 << config.echo_model.stationary_gate_slope << ",";
473 ost << "\"noise_gate_power\": " << config.echo_model.noise_gate_power << ",";
474 ost << "\"noise_gate_slope\": " << config.echo_model.noise_gate_slope << ",";
475 ost << "\"render_pre_window_size\": "
476 << config.echo_model.render_pre_window_size << ",";
477 ost << "\"render_post_window_size\": "
478 << config.echo_model.render_post_window_size << ",";
479 ost << "\"render_pre_window_size_init\": "
480 << config.echo_model.render_pre_window_size_init << ",";
481 ost << "\"render_post_window_size_init\": "
482 << config.echo_model.render_post_window_size_init << ",";
483 ost << "\"nonlinear_hold\": " << config.echo_model.nonlinear_hold << ",";
484 ost << "\"nonlinear_release\": " << config.echo_model.nonlinear_release;
485 ost << "},";
486
487 ost << "\"suppressor\": {";
488 ost << "\"nearend_average_blocks\": "
489 << config.suppressor.nearend_average_blocks << ",";
490 ost << "\"normal_tuning\": {";
491 ost << "\"mask_lf\": [";
492 ost << config.suppressor.normal_tuning.mask_lf.enr_transparent << ",";
493 ost << config.suppressor.normal_tuning.mask_lf.enr_suppress << ",";
494 ost << config.suppressor.normal_tuning.mask_lf.emr_transparent;
495 ost << "],";
496 ost << "\"mask_hf\": [";
497 ost << config.suppressor.normal_tuning.mask_hf.enr_transparent << ",";
498 ost << config.suppressor.normal_tuning.mask_hf.enr_suppress << ",";
499 ost << config.suppressor.normal_tuning.mask_hf.emr_transparent;
500 ost << "],";
501 ost << "\"max_inc_factor\": "
502 << config.suppressor.normal_tuning.max_inc_factor << ",";
503 ost << "\"max_dec_factor_lf\": "
504 << config.suppressor.normal_tuning.max_dec_factor_lf;
505 ost << "},";
506 ost << "\"nearend_tuning\": {";
507 ost << "\"mask_lf\": [";
508 ost << config.suppressor.nearend_tuning.mask_lf.enr_transparent << ",";
509 ost << config.suppressor.nearend_tuning.mask_lf.enr_suppress << ",";
510 ost << config.suppressor.nearend_tuning.mask_lf.emr_transparent;
511 ost << "],";
512 ost << "\"mask_hf\": [";
513 ost << config.suppressor.nearend_tuning.mask_hf.enr_transparent << ",";
514 ost << config.suppressor.nearend_tuning.mask_hf.enr_suppress << ",";
515 ost << config.suppressor.nearend_tuning.mask_hf.emr_transparent;
516 ost << "],";
517 ost << "\"max_inc_factor\": "
518 << config.suppressor.nearend_tuning.max_inc_factor << ",";
519 ost << "\"max_dec_factor_lf\": "
520 << config.suppressor.nearend_tuning.max_dec_factor_lf;
521 ost << "},";
522 ost << "\"dominant_nearend_detection\": {";
523 ost << "\"enr_threshold\": "
524 << config.suppressor.dominant_nearend_detection.enr_threshold << ",";
Gustaf Ullbergc9f9b872018-10-22 15:15:36 +0200525 ost << "\"enr_exit_threshold\": "
526 << config.suppressor.dominant_nearend_detection.enr_exit_threshold << ",";
Sam Zackrissona4c85142018-10-10 10:44:43 +0200527 ost << "\"snr_threshold\": "
528 << config.suppressor.dominant_nearend_detection.snr_threshold << ",";
529 ost << "\"hold_duration\": "
530 << config.suppressor.dominant_nearend_detection.hold_duration << ",";
531 ost << "\"trigger_threshold\": "
532 << config.suppressor.dominant_nearend_detection.trigger_threshold;
533 ost << "},";
534 ost << "\"high_bands_suppression\": {";
535 ost << "\"enr_threshold\": "
536 << config.suppressor.high_bands_suppression.enr_threshold << ",";
537 ost << "\"max_gain_during_echo\": "
538 << config.suppressor.high_bands_suppression.max_gain_during_echo;
539 ost << "},";
540 ost << "\"floor_first_increase\": " << config.suppressor.floor_first_increase
541 << ",";
542 ost << "\"enforce_transparent\": "
543 << (config.suppressor.enforce_transparent ? "true" : "false") << ",";
544 ost << "\"enforce_empty_higher_bands\": "
545 << (config.suppressor.enforce_empty_higher_bands ? "true" : "false");
546 ost << "}";
547 ost << "}";
548 ost << "}";
549
550 return ost.Release();
551}
552} // namespace webrtc