aboutsummaryrefslogtreecommitdiffstats
path: root/codecs/codec_adpcm.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 13:37:11 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-20 13:37:11 +0000
commite92fd1991763436e32eb2ab5642eba6bfc51d185 (patch)
tree2c14f6bf54ccea719ac4b6cce89ff8633f3ac5fd /codecs/codec_adpcm.c
parent27c5f21d71c3a6b55066375583d18b00dd69fffb (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_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;