blob: 6eb91aa8459eebbcfb836577963a892f65dfdd63 [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 {
23 size_t default_delay = 5;
Gustaf Ullberg26728742018-06-04 19:04:40 +020024 size_t down_sampling_factor = 4;
Per Åhgrenfddaf752018-06-08 10:26:40 +020025 size_t num_filters = 6;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010026 size_t api_call_jitter_blocks = 26;
27 size_t min_echo_path_delay_blocks = 0;
28 size_t delay_headroom_blocks = 2;
29 size_t hysteresis_limit_1_blocks = 1;
30 size_t hysteresis_limit_2_blocks = 1;
Per Åhgren2d9a3b12018-05-17 17:24:29 +020031 size_t skew_hysteresis_blocks = 3;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010032 } delay;
33
34 struct Filter {
35 struct MainConfiguration {
36 size_t length_blocks;
37 float leakage_converged;
38 float leakage_diverged;
39 float error_floor;
40 float noise_gate;
41 };
42
43 struct ShadowConfiguration {
44 size_t length_blocks;
45 float rate;
46 float noise_gate;
47 };
48
Per Åhgrene4db6a12018-07-26 15:32:24 +020049 MainConfiguration main = {13, 0.00005f, 0.01f, 0.1f, 20075344.f};
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010050 ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
51
Gustaf Ullberg51f40142018-07-05 16:03:04 +020052 MainConfiguration main_initial = {12, 0.005f, 0.5f, 0.001f, 20075344.f};
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010053 ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
Per Åhgren5f1a31c2018-03-08 15:54:41 +010054
55 size_t config_change_duration_blocks = 250;
Per Åhgrenc3da6712018-08-17 00:09:15 +020056 float initial_state_seconds = 2.5f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010057 } filter;
58
59 struct Erle {
60 float min = 1.f;
Per Åhgren5c532d32018-03-22 00:29:25 +010061 float max_l = 4.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010062 float max_h = 1.5f;
63 } erle;
64
65 struct EpStrength {
Per Åhgrenced31ba2018-05-09 11:48:49 +020066 float lf = 1.f;
67 float mf = 1.f;
68 float hf = 1.f;
Jesús de Vicente Peñae58bd8a2018-06-26 17:19:15 +020069 float default_len = 0.88f;
Jesús de Vicente Peña075cb2b2018-06-13 15:13:55 +020070 bool reverb_based_on_render = true;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010071 bool echo_can_saturate = true;
72 bool bounded_erl = false;
73 } ep_strength;
74
75 struct Mask {
Per Åhgrenb02644f2018-04-17 11:52:17 +020076 Mask();
77 Mask(const Mask& m);
Gustaf Ullberg0e6375e2018-05-04 11:29:02 +020078 float m0 = 0.1f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010079 float m1 = 0.01f;
80 float m2 = 0.0001f;
81 float m3 = 0.01f;
Per Åhgrenb02644f2018-04-17 11:52:17 +020082 float m5 = 0.01f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010083 float m6 = 0.0001f;
84 float m7 = 0.01f;
85 float m8 = 0.0001f;
86 float m9 = 0.1f;
Per Åhgrenb02644f2018-04-17 11:52:17 +020087
88 float gain_curve_offset = 1.45f;
89 float gain_curve_slope = 5.f;
90 float temporal_masking_lf = 0.9f;
91 float temporal_masking_hf = 0.6f;
92 size_t temporal_masking_lf_bands = 3;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010093 } gain_mask;
94
95 struct EchoAudibility {
96 float low_render_limit = 4 * 64.f;
97 float normal_render_limit = 64.f;
Per Åhgrenb02644f2018-04-17 11:52:17 +020098 float floor_power = 2 * 64.f;
99 float audibility_threshold_lf = 10;
100 float audibility_threshold_mf = 10;
101 float audibility_threshold_hf = 10;
Per Åhgren90e3fbd2018-05-16 15:25:04 +0200102 bool use_stationary_properties = true;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100103 } echo_audibility;
104
105 struct RenderLevels {
106 float active_render_limit = 100.f;
107 float poor_excitation_render_limit = 150.f;
Gustaf Ullbergc4b7f032018-06-01 11:22:05 +0200108 float poor_excitation_render_limit_ds8 = 20.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100109 } render_levels;
110
111 struct GainUpdates {
112 struct GainChanges {
113 float max_inc;
114 float max_dec;
115 float rate_inc;
116 float rate_dec;
117 float min_inc;
118 float min_dec;
119 };
120
121 GainChanges low_noise = {2.f, 2.f, 1.4f, 1.4f, 1.1f, 1.1f};
122 GainChanges initial = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
123 GainChanges normal = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
124 GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f};
125 GainChanges nonlinear = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
126
Gustaf Ullberg0e6375e2018-05-04 11:29:02 +0200127 float max_inc_factor = 2.0f;
128 float max_dec_factor_lf = 0.25f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100129 float floor_first_increase = 0.00001f;
130 } gain_updates;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100131
132 struct EchoRemovalControl {
133 struct GainRampup {
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200134 float initial_gain = 0.0f;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100135 float first_non_zero_gain = 0.001f;
136 int non_zero_gain_blocks = 187;
137 int full_gain_blocks = 312;
138 } gain_rampup;
Per Åhgren461cdf02018-02-27 01:59:37 +0100139 bool has_clock_drift = false;
Per Åhgrene3ca9912018-05-28 22:57:17 +0200140 bool linear_and_stable_echo_path = false;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100141 } echo_removal_control;
Per Åhgren251c7352018-03-28 16:31:57 +0200142
143 struct EchoModel {
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200144 EchoModel();
145 EchoModel(const EchoModel& e);
Per Åhgren251c7352018-03-28 16:31:57 +0200146 size_t noise_floor_hold = 50;
147 float min_noise_floor_power = 1638400.f;
148 float stationary_gate_slope = 10.f;
149 float noise_gate_power = 27509.42f;
150 float noise_gate_slope = 0.3f;
151 size_t render_pre_window_size = 1;
Per Åhgren85eef492018-03-28 16:19:47 +0200152 size_t render_post_window_size = 1;
Jesús de Vicente Peñadd092872018-05-25 16:55:11 +0200153 size_t render_pre_window_size_init = 10;
154 size_t render_post_window_size_init = 10;
Per Åhgren85eef492018-03-28 16:19:47 +0200155 float nonlinear_hold = 1;
156 float nonlinear_release = 0.001f;
Per Åhgren251c7352018-03-28 16:31:57 +0200157 } echo_model;
Per Åhgren47d7fbd2018-04-24 12:44:29 +0200158
159 struct Suppressor {
160 size_t bands_with_reliable_coherence = 5;
Gustaf Ullberg8406c432018-06-19 12:31:33 +0200161 size_t nearend_average_blocks = 4;
Gustaf Ullbergec642172018-07-03 13:48:32 +0200162
163 struct MaskingThresholds {
164 float enr_transparent;
165 float enr_suppress;
166 float emr_transparent;
167 };
168 MaskingThresholds mask_lf = {.2f, .3f, .3f};
169 MaskingThresholds mask_hf = {.07f, .1f, .3f};
Per Åhgren7343f562018-08-17 10:08:34 +0200170 bool enforce_transparent = false;
171 bool enforce_empty_higher_bands = false;
Per Åhgren47d7fbd2018-04-24 12:44:29 +0200172 } suppressor;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100173};
174} // namespace webrtc
175
176#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_