[zaptel-commits] kpfleming: branch 1.4 r3650 - /branches/1.4/mg2ec.h
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Thu Jan 10 17:33:14 CST 2008
Author: kpfleming
Date: Thu Jan 10 17:33:14 2008
New Revision: 3650
URL: http://svn.digium.com/view/zaptel?view=rev&rev=3650
Log:
add runtime-control to MG2 aggressive suppression (compile-time control is still available, but only sets the default mode of operation)
Modified:
branches/1.4/mg2ec.h
Modified: branches/1.4/mg2ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/mg2ec.h?view=diff&rev=3650&r1=3649&r2=3650
==============================================================================
--- branches/1.4/mg2ec.h (original)
+++ branches/1.4/mg2ec.h Thu Jan 10 17:33:14 2008
@@ -158,6 +158,7 @@
int avg_Lu_i_toolow;
int avg_Lu_i_ok;
#endif
+ unsigned int aggressive:1;
short lastsig;
int lastcount;
int backup;
@@ -169,7 +170,7 @@
static void echo_can_init(void)
{
- printk("Zaptel Echo Canceller: MG2%s\n", ZAPTEL_ECHO_AGGRESSIVE);
+ printk("Zaptel Echo Canceller: MG2\n");
}
static void echo_can_identify(char *buf, size_t len)
@@ -569,38 +570,38 @@
#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);
- }
-#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)));
-#endif
-#ifdef MEC2_STATS
- ++ec->cntr_residualcorrected_frames;
-#endif
- }
-#else
- if (ec->HCNTR_d == 0) {
- if ((ec->Ly_i/(ec->Lu_i + 1)) > DEFAULT_SUPPR_I) {
+ 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 + 2)) + 1);
+ u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 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)));
-#endif
-#ifdef MEC2_STATS
- ++ec->cntr_residualcorrected_frames;
+ 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;
#endif
}
-#ifdef MEC2_STATS
- else {
- ++ec->cntr_residualcorrected_framesskipped;
+ } 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)));
+#endif
+#ifdef MEC2_STATS
+ ++ec->cntr_residualcorrected_frames;
+#endif
+ }
+#ifdef MEC2_STATS
+ else {
+ ++ec->cntr_residualcorrected_framesskipped;
+ }
+#endif
}
-#endif
- }
-#endif
+ }
#endif
#if 0
@@ -656,11 +657,7 @@
int maxy;
int maxu;
size_t size;
-
- if (ecp->param_count > 0) {
- printk(KERN_WARNING "MG2 echo canceler does not support parameters; failing request\n");
- return -EINVAL;
- }
+ unsigned int x;
maxy = ecp->tap_length + DEFAULT_M;
maxu = DEFAULT_M;
@@ -686,6 +683,21 @@
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 MG2 echo canceler: '%s'\n", p[x].name);
+ kfree(*ec);
+
+ return -EINVAL;
+ }
+ }
+
init_cc(*ec, ecp->tap_length, maxy, maxu);
return 0;
More information about the zaptel-commits
mailing list