Mercurial > libavcodec.hg
changeset 8271:52af55b08c1d libavcodec
ac3dec: unroll inner loop in exponent decoding. 46% faster decode_exponents().
author | jbr |
---|---|
date | Sat, 06 Dec 2008 15:46:23 +0000 |
parents | 0fc2b35a1c14 |
children | c15abcb0209a |
files | ac3dec.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ac3dec.c Sat Dec 06 15:38:21 2008 +0000 +++ b/ac3dec.c Sat Dec 06 15:46:23 2008 +0000 @@ -390,12 +390,15 @@ /* 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;