summaryrefslogtreecommitdiff
path: root/codecs/codec_adpcm.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2006-05-20 13:37:11 +0000
committerRussell Bryant <russell@russellbryant.com>2006-05-20 13:37:11 +0000
commitb88c06b8b5883ba65617573bec1423dcbfdd909a (patch)
tree2c14f6bf54ccea719ac4b6cce89ff8633f3ac5fd /codecs/codec_adpcm.c
parent9d53a3e7f5498e8c89df975d9cefb6314cd55dc1 (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_adpcm.c')
-rw-r--r--codecs/codec_adpcm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/codecs/codec_adpcm.c b/codecs/codec_adpcm.c
index e9ee5b35d..80ec375f8 100644
--- a/codecs/codec_adpcm.c
+++ b/codecs/codec_adpcm.c
@@ -239,13 +239,13 @@ struct adpcm_decoder_pvt {
static int adpcmtolin_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
{
struct adpcm_decoder_pvt *tmp = pvt->pvt;
- int x;
+ int x = f->datalen;
unsigned char *src = f->data;
int16_t *dst = (int16_t *)pvt->outbuf + pvt->samples;
- for (x=0; x < f->datalen; x++) {
- *dst++ = decode((src[x] >> 4) & 0xf, &tmp->state);
- *dst++ = decode(src[x] & 0x0f, &tmp->state);
+ while (x--) {
+ *dst++ = decode((*src >> 4) & 0xf, &tmp->state);
+ *dst++ = decode(*src++ & 0x0f, &tmp->state);
}
pvt->samples += f->samples;
pvt->datalen += 2*f->samples;