diff options
author | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-02-24 19:51:14 +0000 |
---|---|---|
committer | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-02-24 19:51:14 +0000 |
commit | 9ae4104e30ceab7b57df543199253bfa552d42f7 (patch) | |
tree | f8d94b4ec49815d0bd6bec717dea33eff95a05bd /mg2ec.h | |
parent | 8578f623cf23ffe37203d60853eef30e93953d4b (diff) |
Make DC removal compile time option
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@969 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'mg2ec.h')
-rw-r--r-- | mg2ec.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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; |