| 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 | bool conservative_initial_phase = false; |
| 90 | bool enable_coarse_filter_output_usage = true; |
| 91 | bool use_linear_filter = true; |
| 92 | bool export_linear_aec_output = false; |
| 93 | } filter; |
| 94 |
| 95 | struct Erle { |
| 96 | float min = 1.f; |
| 97 | float max_l = 4.f; |
| 98 | float max_h = 1.5f; |
| 99 | bool onset_detection = true; |
| 100 | size_t num_sections = 1; |
| 101 | bool clamp_quality_estimate_to_zero = true; |
| 102 | bool clamp_quality_estimate_to_one = true; |
| 103 | } erle; |
| 104 |
| 105 | struct EpStrength { |
| 106 | float default_gain = 1.f; |
| 107 | float default_len = 0.83f; |
| 108 | bool echo_can_saturate = true; |
| 109 | bool bounded_erl = false; |
| 110 | } ep_strength; |
| 111 |
| 112 | struct EchoAudibility { |
| 113 | float low_render_limit = 4 * 64.f; |
| 114 | float normal_render_limit = 64.f; |
| 115 | float floor_power = 2 * 64.f; |
| 116 | float audibility_threshold_lf = 10; |
| 117 | float audibility_threshold_mf = 10; |
| 118 | float audibility_threshold_hf = 10; |
| 119 | bool use_stationarity_properties = false; |
| 120 | bool use_stationarity_properties_at_init = false; |
| 121 | } echo_audibility; |
| 122 |
| 123 | struct RenderLevels { |
| 124 | float active_render_limit = 100.f; |
| 125 | float poor_excitation_render_limit = 150.f; |
| 126 | float poor_excitation_render_limit_ds8 = 20.f; |
| 127 | float render_power_gain_db = 0.f; |
| 128 | } render_levels; |
| 129 |
| 130 | struct EchoRemovalControl { |
| 131 | bool has_clock_drift = false; |
| 132 | bool linear_and_stable_echo_path = false; |
| 133 | } echo_removal_control; |
| 134 |
| 135 | struct EchoModel { |
| 136 | EchoModel(); |
| 137 | EchoModel(const EchoModel& e); |
| 138 | EchoModel& operator=(const EchoModel& e); |
| 139 | size_t noise_floor_hold = 50; |
| 140 | float min_noise_floor_power = 1638400.f; |
| 141 | float stationary_gate_slope = 10.f; |
| 142 | float noise_gate_power = 27509.42f; |
| 143 | float noise_gate_slope = 0.3f; |
| 144 | size_t render_pre_window_size = 1; |
| 145 | size_t render_post_window_size = 1; |
| 146 | } echo_model; |
| 147 |
| 148 | struct ComfortNoise { |
| 149 | float noise_floor_dbfs = -96.03406f; |
| 150 | } comfort_noise; |
| 151 |
| 152 | struct Suppressor { |
| 153 | Suppressor(); |
| 154 | Suppressor(const Suppressor& e); |
| 155 | Suppressor& operator=(const Suppressor& e); |
| 156 |
| 157 | size_t nearend_average_blocks = 4; |
| 158 |
| 159 | struct MaskingThresholds { |
| 160 | MaskingThresholds(float enr_transparent, |
| 161 | float enr_suppress, |
| 162 | float emr_transparent); |
| 163 | MaskingThresholds(const MaskingThresholds& e); |
| 164 | MaskingThresholds& operator=(const MaskingThresholds& e); |
| 165 | float enr_transparent; |
| 166 | float enr_suppress; |
| 167 | float emr_transparent; |
| 168 | }; |
| 169 |
| 170 | struct Tuning { |
| 171 | Tuning(MaskingThresholds mask_lf, |
| 172 | MaskingThresholds mask_hf, |
| 173 | float max_inc_factor, |
| 174 | float max_dec_factor_lf); |
| 175 | Tuning(const Tuning& e); |
| 176 | Tuning& operator=(const Tuning& e); |
| 177 | MaskingThresholds mask_lf; |
| 178 | MaskingThresholds mask_hf; |
| 179 | float max_inc_factor; |
| 180 | float max_dec_factor_lf; |
| 181 | }; |
| 182 |
| 183 | Tuning normal_tuning = Tuning(MaskingThresholds(.3f, .4f, .3f), |
| 184 | MaskingThresholds(.07f, .1f, .3f), |
| 185 | 2.0f, |
| 186 | 0.25f); |
| 187 | Tuning nearend_tuning = Tuning(MaskingThresholds(1.09f, 1.1f, .3f), |
| 188 | MaskingThresholds(.1f, .3f, .3f), |
| 189 | 2.0f, |
| 190 | 0.25f); |
| 191 |
| 192 | struct DominantNearendDetection { |
| 193 | float enr_threshold = .25f; |
| 194 | float enr_exit_threshold = 10.f; |
| 195 | float snr_threshold = 30.f; |
| 196 | int hold_duration = 50; |
| 197 | int trigger_threshold = 12; |
| 198 | bool use_during_initial_phase = true; |
| 199 | } dominant_nearend_detection; |
| 200 |
| 201 | struct SubbandNearendDetection { |
| 202 | size_t nearend_average_blocks = 1; |
| 203 | struct SubbandRegion { |
| 204 | size_t low; |
| 205 | size_t high; |
| 206 | }; |
| 207 | SubbandRegion subband1 = {1, 1}; |
| 208 | SubbandRegion subband2 = {1, 1}; |
| 209 | float nearend_threshold = 1.f; |
| 210 | float snr_threshold = 1.f; |
| 211 | } subband_nearend_detection; |
| 212 |
| 213 | bool use_subband_nearend_detection = false; |
| 214 |
| 215 | struct HighBandsSuppression { |
| 216 | float enr_threshold = 1.f; |
| 217 | float max_gain_during_echo = 1.f; |
| 218 | float anti_howling_activation_threshold = 25.f; |
| 219 | float anti_howling_gain = 0.01f; |
| 220 | } high_bands_suppression; |
| 221 |
| 222 | float floor_first_increase = 0.00001f; |
| 223 | } suppressor; |
| 224 | }; |
| 225 | } // namespace webrtc |
| 226 |
| 227 | #endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_ |
| 228 |