diff options
author | Claudio Freire <klaussfreire@gmail.com> | 2015-09-21 03:41:26 -0300 |
---|---|---|
committer | Claudio Freire <klaussfreire@gmail.com> | 2015-09-23 02:33:40 -0300 |
commit | b01f3ddad31aba45254dfd553447c7952f86fd31 (patch) | |
tree | aa33c1a7d23fa1a3d2e196723ca5a999626c9856 /libavcodec/aacenc_utils.h | |
parent | 91b668acd6decec0a6f8d20bf56e2644f96adcb9 (diff) | |
download | ffmpeg-b01f3ddad31aba45254dfd553447c7952f86fd31.tar.gz |
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/aacenc_utils.h')
-rw-r--r-- | libavcodec/aacenc_utils.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h index 0ab15a3e5e..dbc9554379 100644 --- a/libavcodec/aacenc_utils.h +++ b/libavcodec/aacenc_utils.h @@ -89,13 +89,10 @@ static inline int find_min_book(float maxval, int sf) float Q34 = sqrtf(Q * sqrtf(Q)); int qmaxval, cb; qmaxval = maxval * Q34 + C_QUANT; - 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; } |