summaryrefslogtreecommitdiff
path: root/mec.h
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-04-12 03:54:18 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-04-12 03:54:18 +0000
commit452aa4004e58f4d4e6e394cea3d80b1710b4f9c1 (patch)
tree06472266e98e00b1a39dac5453669a2af86ea858 /mec.h
parent88de18b1201bda0720d0a5f35749dd81c15b2994 (diff)
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@74 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'mec.h')
-rwxr-xr-xmec.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/mec.h b/mec.h
index 3148ee9..2307c37 100755
--- a/mec.h
+++ b/mec.h
@@ -80,24 +80,49 @@ typedef struct mark_ec {
int lastmax; /* Optimize maximum search */
int maxTy; /* Maximum Ty */
-} mark_ec;
+} echo_can_state_t;
#define INLINE inline
-static INLINE void init_cc(mark_ec *ec)
+#ifdef __KERNEL__
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#define MALLOC(a) kmalloc((a), GFP_KERNEL)
+#define FREE(a) kfree((a))
+#else
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <string.h>
+#define MALLOC(a) malloc(a)
+#define FREE(a) free(a)
+#endif
+
+static INLINE echo_can_state_t *echo_can_create(int len, int adaption_mode)
{
- memset(ec, 0, sizeof(*ec));
+ echo_can_state_t *ec;
+ /* Uhm, we're only one length, sorry. */
+ ec = MALLOC(sizeof(echo_can_state_t));
+ if (ec)
+ memset(ec, 0, sizeof(*ec));
+ return ec;
}
#define PASSPOS 32000
#undef PASSPOS
-static INLINE short process_cc(mark_ec *ec, short tx, short txabs, short rx, short rxabs)
+static INLINE void echo_can_free(echo_can_state_t *ec)
+{
+ FREE(ec);
+}
+
+static INLINE int16_t echo_can_update(echo_can_state_t *ec, int16_t tx, int16_t rx)
{
/* Process a sample, where tx is the near end and rx is the far end + echo */
int suppr;
int nsuppr;
+ short rxabs, txabs;
register int Lu;
register int x;
register int pos;
@@ -110,6 +135,9 @@ static INLINE short process_cc(mark_ec *ec, short tx, short txabs, short rx, sho
int totalupd;
#endif
+ txabs = abs(tx);
+ rxabs = abs(rx);
+
ec->pass++;
r_hat = 0;