From b88c06b8b5883ba65617573bec1423dcbfdd909a Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 20 May 2006 13:37:11 +0000 Subject: 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 --- codecs/codec_adpcm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'codecs/codec_adpcm.c') 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; -- cgit v1.2.3