[FFmpeg-devel] [PATCH] AAC: use table for cbrtf(n)*n

Alex Converse alex.converse
Mon Jan 11 17:10:33 CET 2010


On Mon, Jan 11, 2010 at 10:45 AM, Alex Converse <alex.converse at gmail.com> wrote:
> On Mon, Jan 11, 2010 at 8:31 AM, Mans Rullgard <mans at mansr.com> wrote:
>> The maximum length of escape_sequence is 21 bits, so adjust limit in
>> code to match this.
>>
>> Up to 10% faster on Cortex-A8.
>> ---
>> ?libavcodec/aac.c | ? 13 +++++++++----
>> ?1 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/libavcodec/aac.c b/libavcodec/aac.c
>> index 2bb05b8..d6aa364 100644
>> --- a/libavcodec/aac.c
>> +++ b/libavcodec/aac.c
>> @@ -101,6 +101,7 @@ union float754 {
>> ?static VLC vlc_scalefactors;
>> ?static VLC vlc_spectral[11];
>>
>> +static float cbrt_tab[1<<13];
>>
>> ?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( 7);
>>
>> + ? ?if (!cbrt_tab[(1<<13) - 1])
>> + ? ? ? ?for (i = 0; i < 1<<13; i++)
>> + ? ? ? ? ? ?cbrt_tab[i] = cbrtf(i) * i;
>> +
>> ? ? return 0;
>> ?}
>>
>> @@ -942,14 +947,14 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (vq_ptr[j] == 64.0f) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int n = 4;
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* The total length of escape_sequence must be < 22 bits according
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? to the specification (i.e. max is 11111111110xxxxxxxxxx). */
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?while (get_bits1(gb) && n < 15) n++;
>> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (n == 15) {
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? to the specification (i.e. max is 111111110xxxxxxxxxxxx). */
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?while (get_bits1(gb) && n < 13) n++;
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if (n == 13) {
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? av_log(ac->avccontext, AV_LOG_ERROR, "error in spectral data, ESC overflow\n");
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return -1;
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
>
> ^^ This chunk changes decoder output on some non illegal files and as
> such should probably be committed separately.
>

10l: Just plain illegal. no "non"



More information about the ffmpeg-devel mailing list