aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aacenc_utils.h
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-09-21 03:41:26 -0300
committerClaudio Freire <klaussfreire@gmail.com>2015-09-23 02:33:40 -0300
commitb01f3ddad31aba45254dfd553447c7952f86fd31 (patch)
treeaa33c1a7d23fa1a3d2e196723ca5a999626c9856 /libavcodec/aacenc_utils.h
parent91b668acd6decec0a6f8d20bf56e2644f96adcb9 (diff)
downloadffmpeg-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.h11
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;
}