[zaptel-commits] trunk r969 - /trunk/mg2ec.h

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Fri Feb 24 12:51:14 MST 2006


Author: mattf
Date: Fri Feb 24 13:51:14 2006
New Revision: 969

URL: http://svn.digium.com/view/zaptel?rev=969&view=rev
Log:
Make DC removal compile time option

Modified:
    trunk/mg2ec.h

Modified: trunk/mg2ec.h
URL: http://svn.digium.com/view/zaptel/trunk/mg2ec.h?rev=969&r1=968&r2=969&view=diff
==============================================================================
--- trunk/mg2ec.h (original)
+++ trunk/mg2ec.h Fri Feb 24 13:51:14 2006
@@ -41,6 +41,7 @@
 #define FREE(a) free(a)
 #endif
 
+
 #define ABS(a) abs(a!=-32768?a:-32767)
 
 #define RESTORE_COEFFS {\
@@ -63,6 +64,8 @@
 
 /* Bring in definitions for the various constants and thresholds */
 #include "mg2ec_const.h"
+
+#define DC_NORMALIZE
 
 #ifndef NULL
 #define NULL 0
@@ -155,7 +158,9 @@
 	short lastsig[256];
 	int lastpos;
 	int backup;
+#ifdef DC_NORMALIZE
 	int dc_estimate;
+#endif
 
 };
 
@@ -258,15 +263,19 @@
 
 static inline void echo_can_free(struct echo_can_state *ec)
 {
+#ifdef DC_NORMALIZE
 	printk("EC: DC bias calculated: %d V\n", ec->dc_estimate >> 15);
+#endif
 	FREE(ec);
 }
 
+#ifdef DC_NORMALIZE
 short inline dc_removal(int *dc_estimate, short samp)
 {
 	*dc_estimate += ((((int)samp << 15) - *dc_estimate) >> 9);
 	return samp - (*dc_estimate >> 15);
 }
+#endif
 
 static inline short echo_can_update(struct echo_can_state *ec, short iref, short isig) 
 {
@@ -283,7 +292,9 @@
 	/* ... */
 	int two_beta_i;
 
+#ifdef DC_NORMALIZE
 	isig = dc_removal(&ec->dc_estimate, isig);
+#endif
 	
 	/* flow A on pg. 428 */
 	/* eq. (16): high-pass filter the input to generate the next value;



More information about the zaptel-commits mailing list