diff options
author | Claudio Freire <klaussfreire@gmail.com> | 2015-09-21 09:41:26 +0300 |
---|---|---|
committer | Claudio Freire <klaussfreire@gmail.com> | 2015-09-23 08:33:40 +0300 |
commit | b01f3ddad31aba45254dfd553447c7952f86fd31 (patch) | |
tree | aa33c1a7d23fa1a3d2e196723ca5a999626c9856 /libavcodec/mips | |
parent | 91b668acd6decec0a6f8d20bf56e2644f96adcb9 (diff) |
AAC encoder: simplify and speed up find_min_book
Trivial change to simplify the small but hot
find_min_book function. The new form is easier to
understand and faster.
Diffstat (limited to 'libavcodec/mips')
-rw-r--r-- | libavcodec/mips/aaccoder_mips.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavcodec/mips/aaccoder_mips.c b/libavcodec/mips/aaccoder_mips.c index 8c5fe271be..18d3f88743 100644 --- a/libavcodec/mips/aaccoder_mips.c +++ b/libavcodec/mips/aaccoder_mips.c @@ -178,14 +178,10 @@ static int find_min_book(float maxval, int sf) { float Q = ff_aac_pow2sf_tab[POW_SF2_ZERO - sf + SCALE_ONE_POS - SCALE_DIV_512]; float Q34 = sqrtf(Q * sqrtf(Q)); int qmaxval, cb; - qmaxval = maxval * Q34 + 0.4054f; - if (qmaxval == 0) cb = 0; - else if (qmaxval == 1) cb = 1; - else if (qmaxval == 2) cb = 3; - else if (qmaxval <= 4) cb = 5; - else if (qmaxval <= 7) cb = 7; - else if (qmaxval <= 12) cb = 9; - else cb = 11; + if (qmaxval >= (FF_ARRAY_ELEMS(aac_maxval_cb))) + cb = 11; + else + cb = aac_maxval_cb[qmaxval]; return cb; } |