diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-04-15 19:51:06 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-05-01 13:32:03 -0400 |
commit | 6b2636bba68880450749b3d36a99d584c031342e (patch) | |
tree | 4f895fa45d71227bd032e4b5a01091445d955530 /libavcodec/ac3enc.c | |
parent | e0b33d479cf1cb96e4300b82309e26e6f9c50d6c (diff) | |
download | ffmpeg-6b2636bba68880450749b3d36a99d584c031342e.tar.gz |
ac3enc: simplify exponent_init() by calculating exponent_group_tab[] based
on exponent group sizes.
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r-- | libavcodec/ac3enc.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index 55f065bda1..f8136327fb 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -521,11 +521,13 @@ static void apply_rematrixing(AC3EncodeContext *s) */ static av_cold void exponent_init(AC3EncodeContext *s) { - int i; - for (i = 73; i < 256; i++) { - exponent_group_tab[0][i] = (i - 1) / 3; - exponent_group_tab[1][i] = (i + 2) / 6; - exponent_group_tab[2][i] = (i + 8) / 12; + int expstr, i, grpsize; + + for (expstr = EXP_D15-1; expstr <= EXP_D45-1; expstr++) { + grpsize = 3 << expstr; + for (i = 73; i < 256; i++) { + exponent_group_tab[expstr][i] = (i + grpsize - 4) / grpsize; + } } /* LFE */ exponent_group_tab[0][7] = 2; |