diff options
author | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-01-10 23:49:04 +0000 |
---|---|---|
committer | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-01-10 23:49:04 +0000 |
commit | c3dd2a52496ed2396af4a5b083b0ba61ac1835bd (patch) | |
tree | 2a25a0460186ed13ad0b08c7f7e9f931c433657e | |
parent | 35377c123c278a5988978d826e419e0577a022c5 (diff) |
add runtime-controllable aggressive suppression to KB1 as well
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3652 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r-- | kb1ec.h | 67 |
1 files changed, 39 insertions, 28 deletions
@@ -138,12 +138,12 @@ struct echo_can_state { int avg_Lu_i_toolow; int avg_Lu_i_ok; #endif - + unsigned int aggressive:1; }; static void echo_can_init(void) { - printk("Zaptel Echo Canceller: KB1%s\n", ZAPTEL_ECHO_AGGRESSIVE); + printk("Zaptel Echo Canceller: KB1\n"); } static void echo_can_identify(char *buf, size_t len) @@ -448,38 +448,38 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short #endif #ifndef NO_ECHO_SUPPRESSOR -#ifdef AGGRESSIVE_SUPPRESSOR - 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); - } + if (ec->aggressive) { + 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); + } #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); + printk( KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); #endif #ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; + ++ec->cntr_residualcorrected_frames; #endif - } -#else - if (ec->HCNTR_d == 0) { - if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { - for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { - u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1); - } + } + } else { + if (ec->HCNTR_d == 0) { + if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) { + for (k=0; k < RESIDUAL_SUPRESSION_PASSES; k++) { + u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1); + } #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); + printk( KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); #endif #ifdef MEC2_STATS - ++ec->cntr_residualcorrected_frames; + ++ec->cntr_residualcorrected_frames; #endif - } + } #ifdef MEC2_STATS - else { - ++ec->cntr_residualcorrected_framesskipped; - } + else { + ++ec->cntr_residualcorrected_framesskipped; + } #endif + } } -#endif #endif #if 0 @@ -535,11 +535,7 @@ static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam int maxy; int maxu; size_t size; - - if (ecp->param_count > 0) { - printk(KERN_WARNING "KB1 echo canceler does not support parameters; failing request\n"); - return -EINVAL; - } + unsigned int x; maxy = ecp->tap_length + DEFAULT_M; maxu = DEFAULT_M; @@ -564,6 +560,21 @@ static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam memset(*ec, 0, size); +#ifdef AGGRESSIVE_SUPPRESSOR + (*ec)->aggressive = 1; +#endif + + for (x = 0; x < ecp->param_count; x++) { + if (!strcasecmp(p[x].name, "aggressive")) { + (*ec)->aggressive = p[x].value; + } else { + printk(KERN_WARNING "Unknown parameter supplied to KB1 echo canceler: '%s'\n", p[x].name); + kfree(*ec); + + return -EINVAL; + } + } + init_cc(*ec, ecp->tap_length, maxy, maxu); return 0; |