blob: 9a1510b138ba4fdbc621f89709e221b9deb3b381 [file] [log] [blame]
Gustaf Ullbergbffa3002018-02-14 15:12:00 +01001/*
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
11#ifndef API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
12#define API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
13
Gustaf Ullberg3646f972018-02-14 15:19:04 +010014#include <stddef.h> // size_t
15
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010016namespace webrtc {
17
18// Configuration struct for EchoCanceller3
19struct EchoCanceller3Config {
Per Åhgrenb6b00dc2018-02-20 22:18:27 +010020 EchoCanceller3Config();
Per Åhgren251c7352018-03-28 16:31:57 +020021 EchoCanceller3Config(const EchoCanceller3Config& e);
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010022 struct Delay {
Per Åhgren398689f2018-08-23 11:38:27 +020023 Delay();
24 Delay(const Delay& e);
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010025 size_t default_delay = 5;
Gustaf Ullberg26728742018-06-04 19:04:40 +020026 size_t down_sampling_factor = 4;
Per Åhgrenfddaf752018-06-08 10:26:40 +020027 size_t num_filters = 6;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010028 size_t api_call_jitter_blocks = 26;
29 size_t min_echo_path_delay_blocks = 0;
30 size_t delay_headroom_blocks = 2;
31 size_t hysteresis_limit_1_blocks = 1;
32 size_t hysteresis_limit_2_blocks = 1;
Per Åhgren2d9a3b12018-05-17 17:24:29 +020033 size_t skew_hysteresis_blocks = 3;
Per Åhgren398689f2018-08-23 11:38:27 +020034 size_t fixed_capture_delay_samples = 0;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010035 } delay;
36
37 struct Filter {
38 struct MainConfiguration {
39 size_t length_blocks;
40 float leakage_converged;
41 float leakage_diverged;
42 float error_floor;
43 float noise_gate;
44 };
45
46 struct ShadowConfiguration {
47 size_t length_blocks;
48 float rate;
49 float noise_gate;
50 };
51
Per Åhgrene4db6a12018-07-26 15:32:24 +020052 MainConfiguration main = {13, 0.00005f, 0.01f, 0.1f, 20075344.f};
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010053 ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
54
Gustaf Ullberg51f40142018-07-05 16:03:04 +020055 MainConfiguration main_initial = {12, 0.005f, 0.5f, 0.001f, 20075344.f};
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010056 ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
Per Åhgren5f1a31c2018-03-08 15:54:41 +010057
58 size_t config_change_duration_blocks = 250;
Per Åhgrenc3da6712018-08-17 00:09:15 +020059 float initial_state_seconds = 2.5f;
Jesús de Vicente Peña8459b172018-08-21 16:09:49 +020060 bool conservative_initial_phase = false;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010061 } filter;
62
63 struct Erle {
64 float min = 1.f;
Per Åhgren5c532d32018-03-22 00:29:25 +010065 float max_l = 4.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010066 float max_h = 1.5f;
67 } erle;
68
69 struct EpStrength {
Per Åhgrenced31ba2018-05-09 11:48:49 +020070 float lf = 1.f;
71 float mf = 1.f;
72 float hf = 1.f;
Jesús de Vicente Peñae58bd8a2018-06-26 17:19:15 +020073 float default_len = 0.88f;
Jesús de Vicente Peña075cb2b2018-06-13 15:13:55 +020074 bool reverb_based_on_render = true;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010075 bool echo_can_saturate = true;
76 bool bounded_erl = false;
77 } ep_strength;
78
79 struct Mask {
Per Åhgrenb02644f2018-04-17 11:52:17 +020080 Mask();
81 Mask(const Mask& m);
Gustaf Ullberg0e6375e2018-05-04 11:29:02 +020082 float m0 = 0.1f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010083 float m1 = 0.01f;
84 float m2 = 0.0001f;
85 float m3 = 0.01f;
Per Åhgrenb02644f2018-04-17 11:52:17 +020086 float m5 = 0.01f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010087 float m6 = 0.0001f;
88 float m7 = 0.01f;
89 float m8 = 0.0001f;
90 float m9 = 0.1f;
Per Åhgrenb02644f2018-04-17 11:52:17 +020091
92 float gain_curve_offset = 1.45f;
93 float gain_curve_slope = 5.f;
94 float temporal_masking_lf = 0.9f;
95 float temporal_masking_hf = 0.6f;
96 size_t temporal_masking_lf_bands = 3;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010097 } gain_mask;
98
99 struct EchoAudibility {
100 float low_render_limit = 4 * 64.f;
101 float normal_render_limit = 64.f;
Per Åhgrenb02644f2018-04-17 11:52:17 +0200102 float floor_power = 2 * 64.f;
103 float audibility_threshold_lf = 10;
104 float audibility_threshold_mf = 10;
105 float audibility_threshold_hf = 10;
Per Åhgren90e3fbd2018-05-16 15:25:04 +0200106 bool use_stationary_properties = true;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100107 } echo_audibility;
108
109 struct RenderLevels {
110 float active_render_limit = 100.f;
111 float poor_excitation_render_limit = 150.f;
Gustaf Ullbergc4b7f032018-06-01 11:22:05 +0200112 float poor_excitation_render_limit_ds8 = 20.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100113 } render_levels;
114
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100115 struct EchoRemovalControl {
116 struct GainRampup {
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200117 float initial_gain = 0.0f;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100118 float first_non_zero_gain = 0.001f;
119 int non_zero_gain_blocks = 187;
120 int full_gain_blocks = 312;
121 } gain_rampup;
Per Åhgren461cdf02018-02-27 01:59:37 +0100122 bool has_clock_drift = false;
Per Åhgrene3ca9912018-05-28 22:57:17 +0200123 bool linear_and_stable_echo_path = false;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100124 } echo_removal_control;
Per Åhgren251c7352018-03-28 16:31:57 +0200125
126 struct EchoModel {
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200127 EchoModel();
128 EchoModel(const EchoModel& e);
Per Åhgren251c7352018-03-28 16:31:57 +0200129 size_t noise_floor_hold = 50;
130 float min_noise_floor_power = 1638400.f;
131 float stationary_gate_slope = 10.f;
132 float noise_gate_power = 27509.42f;
133 float noise_gate_slope = 0.3f;
134 size_t render_pre_window_size = 1;
Per Åhgren85eef492018-03-28 16:19:47 +0200135 size_t render_post_window_size = 1;
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200136 size_t render_pre_window_size_init = 10;
137 size_t render_post_window_size_init = 10;
Per Åhgren85eef492018-03-28 16:19:47 +0200138 float nonlinear_hold = 1;
139 float nonlinear_release = 0.001f;
Per Åhgren251c7352018-03-28 16:31:57 +0200140 } echo_model;
Per Åhgren47d7fbd2018-04-24 12:44:29 +0200141
142 struct Suppressor {
Per Åhgren524e8782018-08-24 22:48:49 +0200143 Suppressor();
144 Suppressor(const Suppressor& e);
145
Gustaf Ullberg8406c432018-06-19 12:31:33 +0200146 size_t nearend_average_blocks = 4;
Gustaf Ullbergec642172018-07-03 13:48:32 +0200147
148 struct MaskingThresholds {
Per Åhgren524e8782018-08-24 22:48:49 +0200149 MaskingThresholds(float enr_transparent,
150 float enr_suppress,
151 float emr_transparent);
152 MaskingThresholds(const MaskingThresholds& e);
Gustaf Ullbergec642172018-07-03 13:48:32 +0200153 float enr_transparent;
154 float enr_suppress;
155 float emr_transparent;
156 };
Per Åhgren524e8782018-08-24 22:48:49 +0200157
158 struct Tuning {
159 Tuning(MaskingThresholds mask_lf,
160 MaskingThresholds mask_hf,
161 float max_inc_factor,
162 float max_dec_factor_lf);
163 Tuning(const Tuning& e);
164 MaskingThresholds mask_lf;
165 MaskingThresholds mask_hf;
166 float max_inc_factor;
167 float max_dec_factor_lf;
168 };
169
170 Tuning normal_tuning = Tuning(MaskingThresholds(.2f, .3f, .3f),
171 MaskingThresholds(.07f, .1f, .3f),
172 2.0f,
173 0.25f);
174 Tuning nearend_tuning = Tuning(MaskingThresholds(.2f, .3f, .3f),
175 MaskingThresholds(.07f, .1f, .3f),
176 2.0f,
177 0.25f);
178
179 struct DominantNearendDetection {
180 float enr_threshold = 10.f;
181 float snr_threshold = 10.f;
182 int hold_duration = 25;
183 int trigger_threshold = 15;
184 } dominant_nearend_detection;
185
186 float floor_first_increase = 0.00001f;
Per Åhgren7343f562018-08-17 10:08:34 +0200187 bool enforce_transparent = false;
188 bool enforce_empty_higher_bands = false;
Per Åhgren47d7fbd2018-04-24 12:44:29 +0200189 } suppressor;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100190};
191} // namespace webrtc
192
193#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_