blob: 41b26d0484933c35618fee5c738a101be15b9ac8 [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();
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010021 struct Delay {
22 size_t default_delay = 5;
23 size_t down_sampling_factor = 4;
Per Åhgren75b57d32018-02-15 09:17:41 +010024 size_t num_filters = 5;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010025 size_t api_call_jitter_blocks = 26;
26 size_t min_echo_path_delay_blocks = 0;
27 size_t delay_headroom_blocks = 2;
28 size_t hysteresis_limit_1_blocks = 1;
29 size_t hysteresis_limit_2_blocks = 1;
Per Åhgren8447e912018-02-28 13:28:34 +010030 size_t skew_hysteresis_blocks = 1;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010031 } delay;
32
33 struct Filter {
34 struct MainConfiguration {
35 size_t length_blocks;
36 float leakage_converged;
37 float leakage_diverged;
38 float error_floor;
39 float noise_gate;
40 };
41
42 struct ShadowConfiguration {
43 size_t length_blocks;
44 float rate;
45 float noise_gate;
46 };
47
48 MainConfiguration main = {13, 0.005f, 0.1f, 0.001f, 20075344.f};
49 ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
50
51 MainConfiguration main_initial = {12, 0.05f, 5.f, 0.001f, 20075344.f};
52 ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
Per Åhgren5f1a31c2018-03-08 15:54:41 +010053
54 size_t config_change_duration_blocks = 250;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010055 } filter;
56
57 struct Erle {
58 float min = 1.f;
Per Åhgren5c532d32018-03-22 00:29:25 +010059 float max_l = 4.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010060 float max_h = 1.5f;
61 } erle;
62
63 struct EpStrength {
Per Åhgren5c532d32018-03-22 00:29:25 +010064 float lf = 2.f;
65 float mf = 2.f;
66 float hf = 2.f;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +010067 float default_len = 0.f;
68 bool echo_can_saturate = true;
69 bool bounded_erl = false;
70 } ep_strength;
71
72 struct Mask {
73 float m1 = 0.01f;
74 float m2 = 0.0001f;
75 float m3 = 0.01f;
76 float m4 = 0.1f;
77 float m5 = 0.1f;
78 float m6 = 0.0001f;
79 float m7 = 0.01f;
80 float m8 = 0.0001f;
81 float m9 = 0.1f;
82 } gain_mask;
83
84 struct EchoAudibility {
85 float low_render_limit = 4 * 64.f;
86 float normal_render_limit = 64.f;
87 } echo_audibility;
88
89 struct RenderLevels {
90 float active_render_limit = 100.f;
91 float poor_excitation_render_limit = 150.f;
92 } render_levels;
93
94 struct GainUpdates {
95 struct GainChanges {
96 float max_inc;
97 float max_dec;
98 float rate_inc;
99 float rate_dec;
100 float min_inc;
101 float min_dec;
102 };
103
104 GainChanges low_noise = {2.f, 2.f, 1.4f, 1.4f, 1.1f, 1.1f};
105 GainChanges initial = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
106 GainChanges normal = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
107 GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f};
108 GainChanges nonlinear = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
109
110 float floor_first_increase = 0.00001f;
111 } gain_updates;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100112
113 struct EchoRemovalControl {
114 struct GainRampup {
115 float first_non_zero_gain = 0.001f;
116 int non_zero_gain_blocks = 187;
117 int full_gain_blocks = 312;
118 } gain_rampup;
Per Åhgren461cdf02018-02-27 01:59:37 +0100119
120 bool has_clock_drift = false;
Per Åhgrenb6b00dc2018-02-20 22:18:27 +0100121 } echo_removal_control;
Gustaf Ullbergbffa3002018-02-14 15:12:00 +0100122};
123} // namespace webrtc
124
125#endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_