diff options
author | Russell Bryant <russell@russellbryant.com> | 2006-05-20 13:37:11 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2006-05-20 13:37:11 +0000 |
commit | b88c06b8b5883ba65617573bec1423dcbfdd909a (patch) | |
tree | 2c14f6bf54ccea719ac4b6cce89ff8633f3ac5fd /codecs/codec_a_mu.c | |
parent | 9d53a3e7f5498e8c89df975d9cefb6314cd55dc1 (diff) |
add some code optimizations, see the report for an explanation
(issue #7105, Mithraen)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29018 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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; |