[zaptel-commits] kpfleming: branch 1.4 r3652 - /branches/1.4/kb1ec.h

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Thu Jan 10 17:49:05 CST 2008


Author: kpfleming
Date: Thu Jan 10 17:49:04 2008
New Revision: 3652

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3652
Log:
add runtime-controllable aggressive suppression to KB1 as well

Modified:
    branches/1.4/kb1ec.h

Modified: branches/1.4/kb1ec.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/kb1ec.h?view=diff&rev=3652&r1=3651&r2=3652
==============================================================================
--- branches/1.4/kb1ec.h (original)
+++ branches/1.4/kb1ec.h Thu Jan 10 17:49:04 2008
@@ -138,12 +138,12 @@
 	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 @@
 #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
@@ -535,11 +535,7 @@
 	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 @@
 
 	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;




More information about the zaptel-commits mailing list