diff options
author | qwell <qwell@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-05-17 17:17:42 +0000 |
---|---|---|
committer | qwell <qwell@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-05-17 17:17:42 +0000 |
commit | 94317b45c73ae3b754c79d2fded509ee68ca23f5 (patch) | |
tree | e400d762b829005d5d8373ac65fbee433bc02422 | |
parent | 674b54763cf42fc3f04d821be3e063313564f8f2 (diff) |
Add support for "Timed Agressive Echo Cancellation" for mg2 and kb1.
Issue 9703, patch by SoloFlyer.
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2526 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | kb1ec.h | 13 | ||||
-rw-r--r-- | kb1ec_const.h | 6 | ||||
-rw-r--r-- | mg2ec.h | 13 | ||||
-rw-r--r-- | mg2ec_const.h | 6 |
4 files changed, 36 insertions, 2 deletions
@@ -435,6 +435,9 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short #ifndef NO_ECHO_SUPPRESSOR #ifdef AGGRESSIVE_SUPPRESSOR +#ifdef AGGRESSIVE_TIMELIMIT + if (ec->i_d < AGGRESSIVE_TIMELIMIT ) { +#endif if ((ec->HCNTR_d < AGGRESSIVE_HCNTR) && (ec->Ly_i > (ec->Lu_i << 1))) { for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1); @@ -446,7 +449,12 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short ++ec->cntr_residualcorrected_frames; #endif } -#else +#ifdef AGGRESSIVE_TIMELIMIT + } + else { +#endif +#endif +#if (defined AGGRESSIVE_SUPPRESSOR && defined AGGRESSIVE_TIMELIMIT) || !defined AGGRESSIVE_SUPPRESSOR if (ec->HCNTR_d == 0) { if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { @@ -465,6 +473,9 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short } #endif } +#ifdef AGGRESSIVE_TIMELIMIT + } +#endif #endif #endif diff --git a/kb1ec_const.h b/kb1ec_const.h index fb2daef..836000f 100644 --- a/kb1ec_const.h +++ b/kb1ec_const.h @@ -57,6 +57,12 @@ #define RESIDUAL_SUPRESSION_PASSES 1 #endif +/* If defined then agressive echo cancellation will only be used for + * this amount of time then we will go back to normal cancelation. + * This is helpful if you have bad echo while training + */ +/* #define AGGRESSIVE_TIMELIMIT 150000 */ /* 8 = 1ms */ + /***************************************************************/ /* The following knobs are not implemented in the current code */ @@ -556,6 +556,9 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short #ifndef NO_ECHO_SUPPRESSOR #ifdef AGGRESSIVE_SUPPRESSOR +#ifdef AGGRESSIVE_TIMELIMIT + if (ec->i_d < AGGRESSIVE_TIMELIMIT ) { +#endif if ((ec->HCNTR_d < AGGRESSIVE_HCNTR) && (ec->Ly_i > (ec->Lu_i << 1))) { for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1); @@ -567,7 +570,12 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short ++ec->cntr_residualcorrected_frames; #endif } -#else +#ifdef AGGRESSIVE_TIMELIMIT + } + else { +#endif +#endif +#if (defined AGGRESSIVE_SUPPRESSOR && defined AGGRESSIVE_TIMELIMIT) || !defined AGGRESSIVE_SUPPRESSOR if (ec->HCNTR_d == 0) { if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { @@ -586,6 +594,9 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short } #endif } +#ifdef AGGRESSIVE_TIMELIMIT + } +#endif #endif #endif diff --git a/mg2ec_const.h b/mg2ec_const.h index f2256c7..732f081 100644 --- a/mg2ec_const.h +++ b/mg2ec_const.h @@ -74,6 +74,12 @@ /* Backup coefficients every this number of samples */ #define BACKUP 256 +/* If defined then agressive echo cancellation will only be used for + * this amount of time then we will go back to normal cancelation. + * This is helpful if you have bad echo while training + */ +/* #define AGGRESSIVE_TIMELIMIT 150000 */ /* 8 = 1ms */ + /***************************************************************/ /* The following knobs are not implemented in the current code */ |