[asterisk-commits] trunk r29880 - in /trunk/codecs: codec_a_mu.c codec_ulaw.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 23 15:57:03 MST 2006


Author: russell
Date: Tue May 23 17:57:03 2006
New Revision: 29880

URL: http://svn.digium.com/view/asterisk?rev=29880&view=rev
Log:
further codec module optimization based on codec_alaw changes by rizzo
(issue #7190, Mithraen)

Modified:
    trunk/codecs/codec_a_mu.c
    trunk/codecs/codec_ulaw.c

Modified: trunk/codecs/codec_a_mu.c
URL: http://svn.digium.com/view/asterisk/trunk/codecs/codec_a_mu.c?rev=29880&r1=29879&r2=29880&view=diff
==============================================================================
--- trunk/codecs/codec_a_mu.c (original)
+++ trunk/codecs/codec_a_mu.c Tue May 23 17:57:03 2006
@@ -56,14 +56,15 @@
 static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
 	int x = f->samples;
-	int in_samples = f->samples;
 	unsigned char *src = f->data;
 	unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples;
 
+	pvt->samples += x;
+	pvt->datalen += x;
+
 	while (x--)
 		*dst++ = a2mu[*src++];
-	pvt->samples += in_samples;
-	pvt->datalen += in_samples;
+
 	return 0;
 }
 
@@ -71,14 +72,15 @@
 static int ulawtoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
 	int x = f->samples;
-	int in_samples = f->samples;
 	unsigned char *src = f->data;
 	unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples;
 
+	pvt->samples += x;
+	pvt->datalen += x;
+
 	while (x--)
 		*dst++ = mu2a[*src++];
-	pvt->samples += in_samples;
-	pvt->datalen += in_samples;
+
 	return 0;
 }
 

Modified: trunk/codecs/codec_ulaw.c
URL: http://svn.digium.com/view/asterisk/trunk/codecs/codec_ulaw.c?rev=29880&r1=29879&r2=29880&view=diff
==============================================================================
--- trunk/codecs/codec_ulaw.c (original)
+++ trunk/codecs/codec_ulaw.c Tue May 23 17:57:03 2006
@@ -57,14 +57,14 @@
 	int i = f->samples;
 	unsigned char *src = f->data;
 	int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples;
-	int in_samples = f->samples;
+
+	pvt->samples += i;
+	pvt->datalen += i * 2;	/* 2 bytes/sample */
 
 	/* convert and copy in outbuf */
 	while (i--)
 		*dst++ = AST_MULAW(*src++);
 
-	pvt->samples += in_samples;
-	pvt->datalen += in_samples * 2;	/* 2 bytes/sample */
 	return 0;
 }
 
@@ -74,13 +74,13 @@
 	int i = f->samples;
 	char *dst = pvt->outbuf + pvt->samples;
 	int16_t *src = f->data;
-	int in_samples = f->samples;
+
+	pvt->samples += i;
+	pvt->datalen += i;	/* 1 byte/sample */
 
 	while (i--)
 		*dst++ = AST_LIN2MU(*src++);
 
-	pvt->samples += in_samples;
-	pvt->datalen += in_samples;	/* 1 byte/sample */
 	return 0;
 }
 



More information about the asterisk-commits mailing list