[asterisk-commits] murf: branch murf/bug_7731_trunk r39907 - in /team/murf/bug_7731_trunk: ./ ch...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Aug 15 14:08:02 MST 2006


Author: murf
Date: Tue Aug 15 16:08:01 2006
New Revision: 39907

URL: http://svn.digium.com/view/asterisk?rev=39907&view=rev
Log:
updating this branch.


Modified:
    team/murf/bug_7731_trunk/   (props changed)
    team/murf/bug_7731_trunk/channel.c
    team/murf/bug_7731_trunk/channels/Makefile
    team/murf/bug_7731_trunk/channels/chan_misdn.c
    team/murf/bug_7731_trunk/channels/misdn/Makefile
    team/murf/bug_7731_trunk/channels/misdn/isdn_lib.c

Propchange: team/murf/bug_7731_trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug 15 16:08:01 2006
@@ -1,1 +1,1 @@
-/trunk:1-39862
+/trunk:1-39906

Modified: team/murf/bug_7731_trunk/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7731_trunk/channel.c?rev=39907&r1=39906&r2=39907&view=diff
==============================================================================
--- team/murf/bug_7731_trunk/channel.c (original)
+++ team/murf/bug_7731_trunk/channel.c Tue Aug 15 16:08:01 2006
@@ -3807,12 +3807,18 @@
 };
 
 struct tonepair_state {
-	float freq1;
-	float freq2;
-	float vol;
+	int fac1;
+	int fac2;
+	int v1_1;
+	int v2_1;
+	int v3_1;
+	int v1_2;
+	int v2_2;
+	int v3_2;
+	int origwfmt;
+	int pos;
 	int duration;
-	int pos;
-	int origwfmt;
+	int modulate;
 	struct ast_frame f;
 	unsigned char offset[AST_FRIENDLY_OFFSET];
 	short data[4000];
@@ -3840,10 +3846,16 @@
 		tonepair_release(NULL, ts);
 		ts = NULL;
 	} else {
-		ts->freq1 = td->freq1;
-		ts->freq2 = td->freq2;
+		ts->fac1 = 2.0 * cos(2.0 * M_PI * (td->freq1 / 8000.0)) * 32768.0;
+		ts->v1_1 = 0;
+		ts->v2_1 = sin(-4.0 * M_PI * (td->freq1 / 8000.0)) * td->vol;
+		ts->v3_1 = sin(-2.0 * M_PI * (td->freq1 / 8000.0)) * td->vol;
+		ts->v2_1 = 0;
+		ts->fac2 = 2.0 * cos(2.0 * M_PI * (td->freq2 / 8000.0)) * 32768.0;
+		ts->v2_2 = sin(-4.0 * M_PI * (td->freq2 / 8000.0)) * td->vol;
+		ts->v3_2 = sin(-2.0 * M_PI * (td->freq2 / 8000.0)) * td->vol;
 		ts->duration = td->duration;
-		ts->vol = td->vol;
+		ts->modulate = 0;
 	}
 	/* Let interrupts interrupt :) */
 	ast_set_flag(chan, AST_FLAG_WRITE_INT);
@@ -3865,12 +3877,23 @@
 		return -1;
 	}
 	memset(&ts->f, 0, sizeof(ts->f));
-	for (x = 0; x < (len / 2); x++) {
-		ts->data[x] = ts->vol * (
-				sin((ts->freq1 * 2.0 * M_PI / 8000.0) * (ts->pos + x)) +
-				sin((ts->freq2 * 2.0 * M_PI / 8000.0) * (ts->pos + x))
-			);
-	}
+ 	for (x=0;x<len/2;x++) {
+ 		ts->v1_1 = ts->v2_1;
+ 		ts->v2_1 = ts->v3_1;
+ 		ts->v3_1 = (ts->fac1 * ts->v2_1 >> 15) - ts->v1_1;
+ 		
+ 		ts->v1_2 = ts->v2_2;
+ 		ts->v2_2 = ts->v3_2;
+ 		ts->v3_2 = (ts->fac2 * ts->v2_2 >> 15) - ts->v1_2;
+ 		if (ts->modulate) {
+ 			int p;
+ 			p = ts->v3_2 - 32768;
+ 			if (p < 0) p = -p;
+ 			p = ((p * 9) / 10) + 1;
+ 			ts->data[x] = (ts->v3_1 * p) >> 15;
+ 		} else
+ 			ts->data[x] = ts->v3_1 + ts->v3_2; 
+ 	}
 	ts->f.frametype = AST_FRAME_VOICE;
 	ts->f.subclass = AST_FORMAT_SLINEAR;
 	ts->f.datalen = len;

Modified: team/murf/bug_7731_trunk/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7731_trunk/channels/Makefile?rev=39907&r1=39906&r2=39907&view=diff
==============================================================================
--- team/murf/bug_7731_trunk/channels/Makefile (original)
+++ team/murf/bug_7731_trunk/channels/Makefile Tue Aug 15 16:08:01 2006
@@ -47,11 +47,6 @@
   C_MODS:=$(filter-out chan_misdn,$(C_MODS))
 endif
 
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libbnec.so),)
-  EC_CFLAGS=-DWITH_BEROEC
-  EC_LIBS=-lbnec
-endif
-
 ifndef OPENH323DIR
   OPENH323DIR=$(HOME)/openh323
 endif
@@ -99,9 +94,9 @@
 misdn/chan_misdn_lib.a:
 	make -C misdn
 
-chan_misdn.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\" $(EC_CFLAGS)
+chan_misdn.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\" 
 
-misdn_config.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\" $(EC_CFLAGS)
+misdn_config.o: CFLAGS+=-Imisdn -DCHAN_MISDN_VERSION=\"0.3.0\" 
 
 chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
-chan_misdn.so: LIBS+=-lisdnnet -lmISDN -lsuppserv $(EC_LIBS)
+chan_misdn.so: LIBS+=-lisdnnet -lmISDN -lsuppserv 

Modified: team/murf/bug_7731_trunk/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7731_trunk/channels/chan_misdn.c?rev=39907&r1=39906&r2=39907&view=diff
==============================================================================
--- team/murf/bug_7731_trunk/channels/chan_misdn.c (original)
+++ team/murf/bug_7731_trunk/channels/chan_misdn.c Tue Aug 15 16:08:01 2006
@@ -957,13 +957,6 @@
 			"  --> state: %s\n"
 			"  --> capability: %s\n"
 			"  --> echo_cancel: %d\n"
-#ifdef WITH_BEROEC
-			"  --> bnec_tail: %d\n"
-			"  --> bnec_nlp: %d\n"
-			"  --> bnec_ah: %d\n"
-			"  --> bnec_td: %d\n"
-			"  --> bnec_zerocoeff: %d\n"
-#endif
 			"  --> notone : rx %d tx:%d\n"
 			"  --> bc_hold: %d holded_bc :%d\n",
 			help->ast->name,
@@ -978,13 +971,6 @@
 			bearer2str(bc->capability),
 			bc->ec_enable,
 
-#ifdef WITH_BEROEC
-			bc->bnec_tail,
-			bc->bnec_nlp,
-			bc->bnec_ah,
-			bc->bnec_td,
-			bc->bnec_zero,
-#endif
 			help->norxtone,help->notxtone,
 			bc->holded, help->holded_bc?1:0
 			);
@@ -1663,19 +1649,6 @@
 	}
 #endif
 
-#ifdef WITH_BEROEC
-	misdn_cfg_get(port, MISDN_CFG_BNECHOCANCEL,&bc->bnec_tail, sizeof(int));
-	misdn_cfg_get(port, MISDN_CFG_BNEC_ANTIHOWL, &bc->bnec_ah, sizeof(int));
-	misdn_cfg_get(port, MISDN_CFG_BNEC_NLP, &bc->bnec_nlp, sizeof(int));
-	misdn_cfg_get(port, MISDN_CFG_BNEC_TD, &bc->bnec_td, sizeof(int));
-	misdn_cfg_get(port, MISDN_CFG_BNEC_ADAPT, &bc->bnec_adapt, sizeof(int));
-	misdn_cfg_get(port, MISDN_CFG_BNEC_ZEROCOEFF, &bc->bnec_zero, sizeof(int));
-
-	if (bc->bnec_tail && bc->ec_enable) {
-		ast_log(LOG_WARNING,"Are you sure you wan't to mix BNEC with Zapec ? This might cause bad audio quality!\n");
-		bc->ec_enable=0;
-	}
-#endif
 	return 0;
 }
 
@@ -4914,10 +4887,6 @@
 			if (neglect) {
 				chan_misdn_log(1, ch->bc->port, " --> disabled\n");
 				ch->bc->ec_enable=0;
-
-#ifdef WITH_BEROEC
-				ch->bc->bnec_tail=0;
-#endif
 			} else {
 				ch->bc->ec_enable=1;
 				ch->bc->orig=ch->orginator;

Modified: team/murf/bug_7731_trunk/channels/misdn/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7731_trunk/channels/misdn/Makefile?rev=39907&r1=39906&r2=39907&view=diff
==============================================================================
--- team/murf/bug_7731_trunk/channels/misdn/Makefile (original)
+++ team/murf/bug_7731_trunk/channels/misdn/Makefile Tue Aug 15 16:08:01 2006
@@ -12,11 +12,6 @@
 SOURCES		= isdn_lib.c isdn_msg_parser.c 
 OBJDIR		= .
 OBJS		= isdn_lib.o isdn_msg_parser.o
-
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/lib/libbnec.so),)
-CFLAGS+=-DBEROEC_VERSION=1
-CFLAGS+=-DWITH_BEROEC
-endif
 
 all: chan_misdn_lib.a 
 

Modified: team/murf/bug_7731_trunk/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7731_trunk/channels/misdn/isdn_lib.c?rev=39907&r1=39906&r2=39907&view=diff
==============================================================================
--- team/murf/bug_7731_trunk/channels/misdn/isdn_lib.c (original)
+++ team/murf/bug_7731_trunk/channels/misdn/isdn_lib.c Tue Aug 15 16:08:01 2006
@@ -24,10 +24,6 @@
 int misdn_lib_get_l2_up(struct misdn_stack *stack);
 
 struct misdn_stack* get_misdn_stack( void );
-
-#ifdef WITH_BEROEC
-static int bec_initialized=0;
-#endif
 
 int misdn_lib_port_is_pri(int port)
 {
@@ -2196,14 +2192,6 @@
 		
 		if (jlen < len) {
 			cb_log(7,bc->port,"Jitterbuffer Underrun.\n");
-		} else {
-#ifdef WITH_BEROEC
-			if (bc->ec) {
-				flip_buf_bits(data,len);
-				beroec_cancel_alaw_chunk(bc->ec, data, bc->bframe, len);
-				flip_buf_bits(data,len);
-			}
-#endif
 		}
 		
 		txfrm->prim = DL_DATA|REQUEST;
@@ -3036,10 +3024,6 @@
 
 	if (++mypid>5000) mypid=1;
 	bc->pid=mypid;
-
-#ifdef WITH_BEROEC
-	bc->ec=NULL;
-#endif
 
 #if 0
 	bc->addr=0;
@@ -3750,17 +3734,6 @@
 	midev=te_lib_init();
 	mgr->midev=midev;
 
-#ifdef WITH_BEROEC
-	int bec_ver=beroec_version();
-	if (bec_ver>=BEROEC_VERSION) {
-		beroec_init();
-		bec_initialized=1;
-	} else {
-		cb_log(0,0,"!! Please update the BEROEC binary\n");
-		bec_initialized=0;
-	}
-#endif
-
 	port_count=mISDN_get_stack_count(midev);
   
 	msg_queue_init(&mgr->activatequeue);
@@ -4194,22 +4167,6 @@
 		cb_log(1, stack?stack->port:0, " --> no speech? cannot enable EC\n");
 		return;
 	}
-
-#ifdef WITH_BEROEC
-	if (bc->ec) {
-		cb_log(1, stack?stack->port:0, " --> EC already loaded\n");
-		return;
-	}
-
-	if (!bec_initialized) bc->bnec_tail=0;
-
-	if (bc->bnec_tail) {
-		bc->ec=beroec_new(bc->bnec_tail, BEROEC_SUBBAND,
-		bc->bnec_ah,
-		bc->bnec_td, bc->bnec_zero, bc->bnec_adapt, bc->bnec_nlp);
-	}	
-	return ;
-#endif
 
 	if (bc->ec_enable) {
 		cb_log(1, stack?stack->port:0,"Sending Control ECHOCAN_ON taps:%d training:%d\n",bc->ec_deftaps, bc->ec_training);
@@ -4254,13 +4211,6 @@
 		cb_log(1, stack?stack->port:0, " --> no speech? cannot disable EC\n");
 		return;
 	}
-
-#ifdef WITH_BEROEC
-	if (bc->ec)
-		beroec_destroy(bc->ec);
-	bc->ec=NULL;
-	return;
-#endif
 
 	if ( bc->ec_enable) {
 		cb_log(1, stack?stack->port:0, "Sending Control ECHOCAN_OFF\n");



More information about the asterisk-commits mailing list