diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2008-12-06 15:46:23 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2008-12-06 15:46:23 +0000 |
commit | 96f229d6c0d442a084ed52fbb04feb2c2a6d0ca8 (patch) | |
tree | 1cd2065c51a193ec34ed30e43bb619c217554745 /libavcodec/ac3dec.c | |
parent | 806703243e3b6168c6b7896c2bc68ebe8186eefc (diff) | |
download | ffmpeg-streaming-96f229d6c0d442a084ed52fbb04feb2c2a6d0ca8.zip ffmpeg-streaming-96f229d6c0d442a084ed52fbb04feb2c2a6d0ca8.tar.gz |
ac3dec: unroll inner loop in exponent decoding. 46% faster decode_exponents().
Originally committed as revision 16018 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r-- | libavcodec/ac3dec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 9e33db0..b8f5796 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -390,12 +390,15 @@ static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps, /* convert to absolute exps and expand groups */ prevexp = absexp; - for(i=0; i<ngrps*3; i++) { + for(i=0,j=0; i<ngrps*3; i++) { prevexp += dexp[i] - 2; if (prevexp < 0 || prevexp > 24) return -1; - for(j=0; j<group_size; j++) { - dexps[(i*group_size)+j] = prevexp; + switch (group_size) { + case 4: dexps[j++] = prevexp; + dexps[j++] = prevexp; + case 2: dexps[j++] = prevexp; + case 1: dexps[j++] = prevexp; } } return 0; |