diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-20 13:37:11 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-20 13:37:11 +0000 |
commit | e92fd1991763436e32eb2ab5642eba6bfc51d185 (patch) | |
tree | 2c14f6bf54ccea719ac4b6cce89ff8633f3ac5fd /codecs/codec_a_mu.c | |
parent | 27c5f21d71c3a6b55066375583d18b00dd69fffb (diff) |
add some code optimizations, see the report for an explanation
(issue #7105, Mithraen)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@29018 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'codecs/codec_a_mu.c')
-rw-r--r-- | codecs/codec_a_mu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/codecs/codec_a_mu.c b/codecs/codec_a_mu.c index 6ab79be61..f1b35299a 100644 --- a/codecs/codec_a_mu.c +++ b/codecs/codec_a_mu.c @@ -55,12 +55,12 @@ static unsigned char a2mu[256]; /*! \brief convert frame data and store into the buffer */ static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { - int i; + int x = f->samples; int in_samples = f->samples; unsigned char *src = f->data; unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples; - for (i = 0; i < in_samples; i++) + while (x--) *dst++ = a2mu[*src++]; pvt->samples += in_samples; pvt->datalen += in_samples; @@ -70,12 +70,12 @@ static int alawtoulaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) /*! \brief convert frame data and store into the buffer */ static int ulawtoalaw_framein(struct ast_trans_pvt *pvt, struct ast_frame *f) { - int i; + int x = f->samples; int in_samples = f->samples; unsigned char *src = f->data; unsigned char *dst = (unsigned char *)pvt->outbuf + pvt->samples; - for (i = 0; i < in_samples; i++) + while (x--) *dst++ = mu2a[*src++]; pvt->samples += in_samples; pvt->datalen += in_samples; |