AAC: use table for cbrtf(n)*n

The maximum length of escape_sequence is 21 bits, so adjust limit in
code to match this.

Up to 10% faster on Cortex-A8.

Originally committed as revision 21153 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Måns Rullgård 2010-01-11 20:21:26 +00:00
parent 4bf0faaafe
commit dc0d86face

View File

@ -101,6 +101,7 @@ union float754 {
static VLC vlc_scalefactors; static VLC vlc_scalefactors;
static VLC vlc_spectral[11]; static VLC vlc_spectral[11];
static float cbrt_tab[1<<13];
static ChannelElement *get_che(AACContext *ac, int type, int elem_id) static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
{ {
@ -555,6 +556,10 @@ static av_cold int aac_decode_init(AVCodecContext *avccontext)
ff_init_ff_sine_windows(10); ff_init_ff_sine_windows(10);
ff_init_ff_sine_windows( 7); ff_init_ff_sine_windows( 7);
if (!cbrt_tab[(1<<13) - 1])
for (i = 0; i < 1<<13; i++)
cbrt_tab[i] = cbrtf(i) * i;
return 0; return 0;
} }
@ -949,7 +954,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
return -1; return -1;
} }
n = (1 << n) + get_bits(gb, n); n = (1 << n) + get_bits(gb, n);
coef[coef_tmp_idx + j] *= cbrtf(n) * n; coef[coef_tmp_idx + j] *= cbrt_tab[n];
} else } else
coef[coef_tmp_idx + j] *= vq_ptr[j]; coef[coef_tmp_idx + j] *= vq_ptr[j];
} }