Debian Codegraph @

Xpjproject/third_party/webrtc_aec3/src/api/audio/echo_canceller3_config.h

raw symbols SCIP
1 /*
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
14 #include <stddef.h> // size_t
15
16 #include "rtc_base/system/rtc_export.h"
17
18 namespace webrtc {
19
20 // Configuration struct for EchoCanceller3
21 struct RTC_EXPORT EchoCanceller3Config {
22 // Checks and updates the config parameters to lie within (mostly) reasonable
23 // ranges. Returns true if and only of the config did not need to be changed.
24 static bool Validate(EchoCanceller3Config* config);
25
26 EchoCanceller3Config();
27 EchoCanceller3Config(const EchoCanceller3Config& e);
28 EchoCanceller3Config& operator=(const EchoCanceller3Config& other);
29
30 struct Buffering {
31 size_t excess_render_detection_interval_blocks = 250;
32 size_t max_allowed_excess_render_blocks = 8;
33 } buffering;
34
35 struct Delay {
36 Delay();
37 Delay(const Delay& e);
38 Delay& operator=(const Delay& e);
39 size_t default_delay = 5;
40 size_t down_sampling_factor = 4;
41 size_t num_filters = 5;
42 size_t delay_headroom_samples = 32;
43 size_t hysteresis_limit_blocks = 1;
44 size_t fixed_capture_delay_samples = 0;
45 float delay_estimate_smoothing = 0.7f;
46 float delay_candidate_detection_threshold = 0.2f;
47 struct DelaySelectionThresholds {
48 int initial;
49 int converged;
50 } delay_selection_thresholds = {5, 20};
51 bool use_external_delay_estimator = false;
52 bool log_warning_on_delay_changes = false;
53 struct AlignmentMixing {
54 bool downmix;
55 bool adaptive_selection;
56 float activity_power_threshold;
57 bool prefer_first_two_channels;
58 };
59 AlignmentMixing render_alignment_mixing = {false, true, 10000.f, true};
60 AlignmentMixing capture_alignment_mixing = {false, true, 10000.f, false};
61 } delay;
62
63 struct Filter {
64 struct RefinedConfiguration {
65 size_t length_blocks;
66 float leakage_converged;
67 float leakage_diverged;
68 float error_floor;
69 float error_ceil;
70 float noise_gate;
71 };
72
73 struct CoarseConfiguration {
74 size_t length_blocks;
75 float rate;
76 float noise_gate;
77 };
78
79 RefinedConfiguration refined = {13, 0.00005f, 0.05f,
80 0.001f, 2.f, 20075344.f};
81 CoarseConfiguration coarse = {13, 0.7f, 20075344.f};
82
83 RefinedConfiguration refined_initial = {12, 0.005f, 0.5f,
84 0.001f, 2.f, 20075344.f};
85 CoarseConfiguration coarse_initial = {12, 0.9f, 20075344.f};
86
87 size_t config_change_duration_blocks = 250;
88 float initial_state_seconds = 2.5f;
89 int coarse_reset_hangover_blocks = 25;
90 bool conservative_initial_phase = false;
91 bool enable_coarse_filter_output_usage = true;
92 bool use_linear_filter = true;
93 bool high_pass_filter_echo_reference = false;
94 bool export_linear_aec_output = false;
95 } filter;
96
97 struct Erle {
98 float min = 1.f;
99 float max_l = 4.f;
100 float max_h = 1.5f;
101 bool onset_detection = true;
102 size_t num_sections = 1;
103 bool clamp_quality_estimate_to_zero = true;
104 bool clamp_quality_estimate_to_one = true;
105 } erle;
106
107 struct EpStrength {
108 float default_gain = 1.f;
109 float default_len = 0.83f;
110 bool echo_can_saturate = true;
111 bool bounded_erl = false;
112 bool erle_onset_compensation_in_dominant_nearend = false;
113 } ep_strength;
114
115 struct EchoAudibility {
116 float low_render_limit = 4 * 64.f;
117 float normal_render_limit = 64.f;
118 float floor_power = 2 * 64.f;
119 float audibility_threshold_lf = 10;
120 float audibility_threshold_mf = 10;
121 float audibility_threshold_hf = 10;
122 bool use_stationarity_properties = false;
123 bool use_stationarity_properties_at_init = false;
124 } echo_audibility;
125
126 struct RenderLevels {
127 float active_render_limit = 100.f;
128 float poor_excitation_render_limit = 150.f;
129 float poor_excitation_render_limit_ds8 = 20.f;
130 float render_power_gain_db = 0.f;
131 } render_levels;
132
133 struct EchoRemovalControl {
134 bool has_clock_drift = false;
135 bool linear_and_stable_echo_path = false;
136 } echo_removal_control;
137
138 struct EchoModel {
139 EchoModel();
140 EchoModel(const EchoModel& e);
141 EchoModel& operator=(const EchoModel& e);
142 size_t noise_floor_hold = 50;
143 float min_noise_floor_power = 1638400.f;
144 float stationary_gate_slope = 10.f;
145 float noise_gate_power = 27509.42f;
146 float noise_gate_slope = 0.3f;
147 size_t render_pre_window_size = 1;
148 size_t render_post_window_size = 1;
149 bool model_reverb_in_nonlinear_mode = true;
150 } echo_model;
151
152 struct ComfortNoise {
153 float noise_floor_dbfs = -96.03406f;
154 } comfort_noise;
155
156 struct Suppressor {
157 Suppressor();
158 Suppressor(const Suppressor& e);
159 Suppressor& operator=(const Suppressor& e);
160
161 size_t nearend_average_blocks = 4;
162
163 struct MaskingThresholds {
164 MaskingThresholds(float enr_transparent,
165 float enr_suppress,
166 float emr_transparent);
167 MaskingThresholds(const MaskingThresholds& e);
168 MaskingThresholds& operator=(const MaskingThresholds& e);
169 float enr_transparent;
170 float enr_suppress;
171 float emr_transparent;
172 };
173
174 struct Tuning {
175 Tuning(MaskingThresholds mask_lf,
176 MaskingThresholds mask_hf,
177 float max_inc_factor,
178 float max_dec_factor_lf);
179 Tuning(const Tuning& e);
180 Tuning& operator=(const Tuning& e);
181 MaskingThresholds mask_lf;
182 MaskingThresholds mask_hf;
183 float max_inc_factor;
184 float max_dec_factor_lf;
185 };
186
187 Tuning normal_tuning = Tuning(MaskingThresholds(.3f, .4f, .3f),
188 MaskingThresholds(.07f, .1f, .3f),
189 2.0f,
190 0.25f);
191 Tuning nearend_tuning = Tuning(MaskingThresholds(1.09f, 1.1f, .3f),
192 MaskingThresholds(.1f, .3f, .3f),
193 2.0f,
194 0.25f);
195
196 struct DominantNearendDetection {
197 float enr_threshold = .25f;
198 float enr_exit_threshold = 10.f;
199 float snr_threshold = 30.f;
200 int hold_duration = 50;
201 int trigger_threshold = 12;
202 bool use_during_initial_phase = true;
203 } dominant_nearend_detection;
204
205 struct SubbandNearendDetection {
206 size_t nearend_average_blocks = 1;
207 struct SubbandRegion {
208 size_t low;
209 size_t high;
210 };
211 SubbandRegion subband1 = {1, 1};
212 SubbandRegion subband2 = {1, 1};
213 float nearend_threshold = 1.f;
214 float snr_threshold = 1.f;
215 } subband_nearend_detection;
216
217 bool use_subband_nearend_detection = false;
218
219 struct HighBandsSuppression {
220 float enr_threshold = 1.f;
221 float max_gain_during_echo = 1.f;
222 float anti_howling_activation_threshold = 400.f;
223 float anti_howling_gain = 1.f;
224 } high_bands_suppression;
225
226 float floor_first_increase = 0.00001f;
227 bool conservative_hf_suppression = false;
228 } suppressor;
229 };
230 } // namespace webrtc
231
232 #endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_