[pulseaudio-commits] 2 commits - src/modules

Arun Raghavan arun at kemper.freedesktop.org
Tue Oct 24 17:03:54 UTC 2017


 src/modules/echo-cancel/speex.c |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

New commits:
commit 2c9a2aa01e95299190aaef105cd1e6003e164436
Author: Arun Raghavan <arun at arunraghavan.net>
Date:   Mon May 15 14:17:58 2017 +0530

    echo-cancel: Expose dereverb in the speex canceller
    
    Enabled by default.

diff --git a/src/modules/echo-cancel/speex.c b/src/modules/echo-cancel/speex.c
index bbf059fd..794399ae 100644
--- a/src/modules/echo-cancel/speex.c
+++ b/src/modules/echo-cancel/speex.c
@@ -33,6 +33,7 @@
 #define DEFAULT_FILTER_SIZE_MS 200
 #define DEFAULT_AGC_ENABLED true
 #define DEFAULT_DENOISE_ENABLED true
+#define DEFAULT_DEREVERB_ENABLED true
 #define DEFAULT_ECHO_SUPPRESS_ENABLED true
 #define DEFAULT_ECHO_SUPPRESS_ATTENUATION 0
 
@@ -41,6 +42,7 @@ static const char* const valid_modargs[] = {
     "filter_size_ms",
     "agc",
     "denoise",
+    "dereverb",
     "echo_suppress",
     "echo_suppress_attenuation",
     "echo_suppress_attenuation_active",
@@ -61,6 +63,7 @@ static void speex_ec_fixate_spec(pa_sample_spec *rec_ss, pa_channel_map *rec_map
 static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec *out_ss, uint32_t nframes, pa_modargs *ma) {
     bool agc;
     bool denoise;
+    bool dereverb;
     bool echo_suppress;
     int32_t echo_suppress_attenuation;
     int32_t echo_suppress_attenuation_active;
@@ -77,6 +80,12 @@ static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec
         goto fail;
     }
 
+    dereverb = DEFAULT_DEREVERB_ENABLED;
+    if (pa_modargs_get_value_boolean(ma, "dereverb", &dereverb) < 0) {
+        pa_log("Failed to parse dereverb value");
+        goto fail;
+    }
+
     echo_suppress = DEFAULT_ECHO_SUPPRESS_ENABLED;
     if (pa_modargs_get_value_boolean(ma, "echo_suppress", &echo_suppress) < 0) {
         pa_log("Failed to parse echo_suppress value");
@@ -103,11 +112,11 @@ static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec
         goto fail;
     }
 
-    if (agc || denoise || echo_suppress) {
+    if (agc || denoise || dereverb || echo_suppress) {
         spx_int32_t tmp;
 
         if (out_ss->channels != 1) {
-            pa_log("AGC, denoising and echo suppression only work with channels=1");
+            pa_log("AGC, denoising, dereverb and echo suppression only work with channels=1");
             goto fail;
         }
 
@@ -119,6 +128,9 @@ static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec
         tmp = denoise;
         speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_DENOISE, &tmp);
 
+        tmp = dereverb;
+        speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_DEREVERB, &tmp);
+
         if (echo_suppress) {
             if (echo_suppress_attenuation)
                 speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS,
@@ -133,8 +145,8 @@ static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec
         speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_ECHO_STATE,
                              ec->params.speex.state);
 
-        pa_log_info("Loaded speex preprocessor with params: agc=%s, denoise=%s, echo_suppress=%s", pa_yes_no(agc),
-                    pa_yes_no(denoise), pa_yes_no(echo_suppress));
+        pa_log_info("Loaded speex preprocessor with params: agc=%s, denoise=%s, dereverb=%s, echo_suppress=%s",
+                    pa_yes_no(agc), pa_yes_no(denoise), pa_yes_no(dereverb), pa_yes_no(echo_suppress));
     } else
         pa_log_info("All preprocessing options are disabled");
 

commit fa228745c1709f9f34f10ae787d28e4588390881
Author: Arun Raghavan <arun at arunraghavan.net>
Date:   Mon May 15 14:17:08 2017 +0530

    echo-cancel: Fix speex echo state setting
    
    The state should be set even if echo suppression is disabled, which is
    not currently the case.

diff --git a/src/modules/echo-cancel/speex.c b/src/modules/echo-cancel/speex.c
index a3ae6467..bbf059fd 100644
--- a/src/modules/echo-cancel/speex.c
+++ b/src/modules/echo-cancel/speex.c
@@ -128,11 +128,11 @@ static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec
                 speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE,
                                      &echo_suppress_attenuation_active);
             }
-
-            speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_ECHO_STATE,
-                                 ec->params.speex.state);
         }
 
+        speex_preprocess_ctl(ec->params.speex.pp_state, SPEEX_PREPROCESS_SET_ECHO_STATE,
+                             ec->params.speex.state);
+
         pa_log_info("Loaded speex preprocessor with params: agc=%s, denoise=%s, echo_suppress=%s", pa_yes_no(agc),
                     pa_yes_no(denoise), pa_yes_no(echo_suppress));
     } else



More information about the pulseaudio-commits mailing list