mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-22 15:00:10 +01:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user