[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-13562 r9147 - in /linux/team/sruf...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Aug 17 15:32:15 CDT 2010


Author: sruffell
Date: Tue Aug 17 15:32:11 2010
New Revision: 9147

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9147
Log:
dahdi: Add 'echocan_hpf_tx' in dahdi_echocan_ops.

It's necessary to have low frequency filter for tx signal of DAHDI.
Otherwise, low-frequency signal from IP can reach a leased line, and return
back with nonlinear distortions. This will break an echo canceler.

(issue #13562)
Reported by: biohumanoid
Patches:
      dahdi_echocan_oslec.c.patch uploaded by biohumanoid (license 459)
      kernel.h.patch uploaded by biohumanoid (license 459)
      dahdi-base.c.#2.patch uploaded by biohumanoid (license 459)

Modified:
    linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi-base.c
    linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi_echocan_oslec.c
    linux/team/sruffell/dahdi-linux-13562/include/dahdi/kernel.h

Modified: linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi-base.c?view=diff&rev=9147&r1=9146&r2=9147
==============================================================================
--- linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi-base.c Tue Aug 17 15:32:11 2010
@@ -2257,6 +2257,15 @@
 				return -EFAULT;
 			}
 			chan->writen[res] = amnt;
+		}
+		if (chan->ec_state && (ECHO_MODE_ACTIVE == chan->ec_state->status.mode) &&
+		    chan->ec_state->ops->echocan_hpf_tx) {
+			for (x=0; x < chan->writen[res]; ++x) {
+				short tx;
+				tx = DAHDI_XLAW(chan->writebuf[res][x], chan);
+				chan->ec_state->ops->echocan_hpf_tx(chan->ec_state, &tx, 1);
+				chan->writebuf[res][x] = DAHDI_LIN2X((int) tx, chan);
+			}
 		}
 		chan->writeidx[res] = 0;
 		if (chan->flags & DAHDI_FLAG_FCS)

Modified: linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi_echocan_oslec.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi_echocan_oslec.c?view=diff&rev=9147&r1=9146&r2=9147
==============================================================================
--- linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi_echocan_oslec.c (original)
+++ linux/team/sruffell/dahdi-linux-13562/drivers/dahdi/dahdi_echocan_oslec.c Tue Aug 17 15:32:11 2010
@@ -43,6 +43,7 @@
 static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
 static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
 static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
+static void echo_can_hpf_tx(struct dahdi_echocan_state *ec, short *tx, u32 size);
 
 static const struct dahdi_echocan_factory my_factory = {
 	.name = "OSLEC",
@@ -55,6 +56,7 @@
 	.echocan_free = echo_can_free,
 	.echocan_process = echo_can_process,
 	.echocan_traintap = echo_can_traintap,
+        .echocan_hpf_tx = echo_can_hpf_tx,
 };
 
 struct ec_pvt {
@@ -118,6 +120,19 @@
 	return 1;
 }
 
+static void echo_can_hpf_tx(struct dahdi_echocan_state *ec, short *tx, u32 size)
+{
+	struct ec_pvt *pvt = dahdi_to_pvt(ec);
+	u32 SampleNum;
+
+	for (SampleNum = 0; SampleNum < size; SampleNum++, tx++) {
+		short iCleanSample;
+
+		iCleanSample = oslec_hpf_tx (pvt->oslec, *tx);
+		*tx = iCleanSample;
+	}
+}
+
 static int __init mod_init(void)
 {
 	if (dahdi_register_echocan_factory(&my_factory)) {

Modified: linux/team/sruffell/dahdi-linux-13562/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-13562/include/dahdi/kernel.h?view=diff&rev=9147&r1=9146&r2=9147
==============================================================================
--- linux/team/sruffell/dahdi-linux-13562/include/dahdi/kernel.h (original)
+++ linux/team/sruffell/dahdi-linux-13562/include/dahdi/kernel.h Tue Aug 17 15:32:11 2010
@@ -255,6 +255,12 @@
 	 * \return Nothing.
 	 */
 	void (*echocan_NLP_toggle)(struct dahdi_echocan_state *ec, unsigned int enable);
+
+	/*! \brief Process an array of TX audio samples through the HPF.
+	 *
+	 * \return Nothing.
+	 */
+	void (*echocan_hpf_tx)(struct dahdi_echocan_state *ec, short *tx, u32 size);
 };
 
 /*! A factory for creating instances of software echo cancelers to be used on DAHDI channels. */




More information about the svn-commits mailing list