From 9ae4104e30ceab7b57df543199253bfa552d42f7 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 24 Feb 2006 19:51:14 +0000 Subject: Make DC removal compile time option git-svn-id: http://svn.digium.com/svn/zaptel/trunk@969 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- mg2ec.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'mg2ec.h') diff --git a/mg2ec.h b/mg2ec.h index 8ad9a92..b175388 100644 --- a/mg2ec.h +++ b/mg2ec.h @@ -41,6 +41,7 @@ #define FREE(a) free(a) #endif + #define ABS(a) abs(a!=-32768?a:-32767) #define RESTORE_COEFFS {\ @@ -64,6 +65,8 @@ /* Bring in definitions for the various constants and thresholds */ #include "mg2ec_const.h" +#define DC_NORMALIZE + #ifndef NULL #define NULL 0 #endif @@ -155,7 +158,9 @@ struct echo_can_state { short lastsig[256]; int lastpos; int backup; +#ifdef DC_NORMALIZE int dc_estimate; +#endif }; @@ -258,15 +263,19 @@ static inline void init_cc(struct echo_can_state *ec, int N, int maxy, int maxu) 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 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short /* ... */ 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; -- cgit v1.2.3