You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

193 lines
5.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. #ifndef API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
  11. #define API_AUDIO_ECHO_CANCELLER3_CONFIG_H_
  12. #include <stddef.h> // size_t
  13. #include "rtc_base/system/rtc_export.h"
  14. namespace webrtc {
  15. // Configuration struct for EchoCanceller3
  16. struct RTC_EXPORT EchoCanceller3Config {
  17. // Checks and updates the config parameters to lie within (mostly) reasonable
  18. // ranges. Returns true if and only of the config did not need to be changed.
  19. static bool Validate(EchoCanceller3Config* config);
  20. EchoCanceller3Config();
  21. EchoCanceller3Config(const EchoCanceller3Config& e);
  22. struct Buffering {
  23. size_t excess_render_detection_interval_blocks = 250;
  24. size_t max_allowed_excess_render_blocks = 8;
  25. } buffering;
  26. struct Delay {
  27. Delay();
  28. Delay(const Delay& e);
  29. size_t default_delay = 5;
  30. size_t down_sampling_factor = 4;
  31. size_t num_filters = 5;
  32. size_t delay_headroom_samples = 32;
  33. size_t hysteresis_limit_blocks = 1;
  34. size_t fixed_capture_delay_samples = 0;
  35. float delay_estimate_smoothing = 0.7f;
  36. float delay_candidate_detection_threshold = 0.2f;
  37. struct DelaySelectionThresholds {
  38. int initial;
  39. int converged;
  40. } delay_selection_thresholds = {5, 20};
  41. bool use_external_delay_estimator = false;
  42. bool downmix_before_delay_estimation = true;
  43. bool log_warning_on_delay_changes = false;
  44. } delay;
  45. struct Filter {
  46. struct MainConfiguration {
  47. size_t length_blocks;
  48. float leakage_converged;
  49. float leakage_diverged;
  50. float error_floor;
  51. float error_ceil;
  52. float noise_gate;
  53. };
  54. struct ShadowConfiguration {
  55. size_t length_blocks;
  56. float rate;
  57. float noise_gate;
  58. };
  59. MainConfiguration main = {13, 0.00005f, 0.05f, 0.001f, 2.f, 20075344.f};
  60. ShadowConfiguration shadow = {13, 0.7f, 20075344.f};
  61. MainConfiguration main_initial = {12, 0.005f, 0.5f,
  62. 0.001f, 2.f, 20075344.f};
  63. ShadowConfiguration shadow_initial = {12, 0.9f, 20075344.f};
  64. size_t config_change_duration_blocks = 250;
  65. float initial_state_seconds = 2.5f;
  66. bool conservative_initial_phase = false;
  67. bool enable_shadow_filter_output_usage = true;
  68. bool use_linear_filter = true;
  69. } filter;
  70. struct Erle {
  71. float min = 1.f;
  72. float max_l = 4.f;
  73. float max_h = 1.5f;
  74. bool onset_detection = true;
  75. size_t num_sections = 1;
  76. bool clamp_quality_estimate_to_zero = true;
  77. bool clamp_quality_estimate_to_one = true;
  78. } erle;
  79. struct EpStrength {
  80. float default_gain = 1.f;
  81. float default_len = 0.83f;
  82. bool echo_can_saturate = true;
  83. bool bounded_erl = false;
  84. } ep_strength;
  85. struct EchoAudibility {
  86. float low_render_limit = 4 * 64.f;
  87. float normal_render_limit = 64.f;
  88. float floor_power = 2 * 64.f;
  89. float audibility_threshold_lf = 10;
  90. float audibility_threshold_mf = 10;
  91. float audibility_threshold_hf = 10;
  92. bool use_stationarity_properties = false;
  93. bool use_stationarity_properties_at_init = false;
  94. } echo_audibility;
  95. struct RenderLevels {
  96. float active_render_limit = 100.f;
  97. float poor_excitation_render_limit = 150.f;
  98. float poor_excitation_render_limit_ds8 = 20.f;
  99. } render_levels;
  100. struct EchoRemovalControl {
  101. bool has_clock_drift = false;
  102. bool linear_and_stable_echo_path = false;
  103. } echo_removal_control;
  104. struct EchoModel {
  105. EchoModel();
  106. EchoModel(const EchoModel& e);
  107. size_t noise_floor_hold = 50;
  108. float min_noise_floor_power = 1638400.f;
  109. float stationary_gate_slope = 10.f;
  110. float noise_gate_power = 27509.42f;
  111. float noise_gate_slope = 0.3f;
  112. size_t render_pre_window_size = 1;
  113. size_t render_post_window_size = 1;
  114. } echo_model;
  115. struct Suppressor {
  116. Suppressor();
  117. Suppressor(const Suppressor& e);
  118. size_t nearend_average_blocks = 4;
  119. struct MaskingThresholds {
  120. MaskingThresholds(float enr_transparent,
  121. float enr_suppress,
  122. float emr_transparent);
  123. MaskingThresholds(const MaskingThresholds& e);
  124. float enr_transparent;
  125. float enr_suppress;
  126. float emr_transparent;
  127. };
  128. struct Tuning {
  129. Tuning(MaskingThresholds mask_lf,
  130. MaskingThresholds mask_hf,
  131. float max_inc_factor,
  132. float max_dec_factor_lf);
  133. Tuning(const Tuning& e);
  134. MaskingThresholds mask_lf;
  135. MaskingThresholds mask_hf;
  136. float max_inc_factor;
  137. float max_dec_factor_lf;
  138. };
  139. Tuning normal_tuning = Tuning(MaskingThresholds(.3f, .4f, .3f),
  140. MaskingThresholds(.07f, .1f, .3f),
  141. 2.0f,
  142. 0.25f);
  143. Tuning nearend_tuning = Tuning(MaskingThresholds(1.09f, 1.1f, .3f),
  144. MaskingThresholds(.1f, .3f, .3f),
  145. 2.0f,
  146. 0.25f);
  147. struct DominantNearendDetection {
  148. float enr_threshold = .25f;
  149. float enr_exit_threshold = 10.f;
  150. float snr_threshold = 30.f;
  151. int hold_duration = 50;
  152. int trigger_threshold = 12;
  153. bool use_during_initial_phase = true;
  154. } dominant_nearend_detection;
  155. struct HighBandsSuppression {
  156. float enr_threshold = 1.f;
  157. float max_gain_during_echo = 1.f;
  158. } high_bands_suppression;
  159. float floor_first_increase = 0.00001f;
  160. bool enforce_transparent = false;
  161. bool enforce_empty_higher_bands = false;
  162. } suppressor;
  163. };
  164. } // namespace webrtc
  165. #endif // API_AUDIO_ECHO_CANCELLER3_CONFIG_H_