[FFmpeg-devel] AAC decoder round 5
Robert Swain
robert.swain
Fri Aug 8 16:12:49 CEST 2008
2008/8/8 Michael Niedermayer <michaelni at gmx.at>:
> On Thu, Aug 07, 2008 at 11:53:39PM +0100, Robert Swain wrote:
>> 2008/8/7 Michael Niedermayer <michaelni at gmx.at>:
>> >> > [...]
>> >> >> Index: libavcodec/aac.h
>> >> >> ===================================================================
>> >> >> --- libavcodec/aac.h (revision 14624)
>> >> >> +++ libavcodec/aac.h (working copy)
>> >> >> @@ -42,8 +44,63 @@
>> >> >> ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), sizeof(ff_aac_spectral_codes[num][0]), \
>> >> >> size);
>> >> >>
>> >> >> +#define MAX_CHANNELS 64
>> >> >
>> >> > ok as long as its not causing huge arrays, like if there was a use like
>> >> > array[MAX_FRAME][MAX_TAGS][MAX_BANDS][MAX_CHANNELS] ...
>> >>
>> >> Please define huge.
>> >
>> > huge being 10k for the context IMHO, that is if you can safe 10k by
>> > making MAX_CHANNELS a realistic number please do.
>> > if it just safes 500 bytes its not worth it if it makes the code more
>> > complex ...
>>
>> OK, I'll have a check. Are you mainly concerned about the main
>> AACContext rather than the individual channel elements? Of course it's
>> good to minimise them all as long as they don't cause obfuscated code
>> (though it shouldn't hurt to reduce MAX_CHANNELS I wouldn't have
>> thought).
>
> Iam concerned about all large arrays that are partly unused ...
Struct name Size (bytes)
IndividualChannelStream 48
TemporalNoiseShaping 3108
DynamicRangeControl 476
Pulse 40
ChannelCoupling 36968
which contains:
float gain[18][8][64] which is [gain list][window group][scalefactor band]
SingleChannelElement 21600
which contains:
enum BandType band_type[8][64] which is [window group][scalefactor band]
int band_type_run_end[8][64] which is [window group][scalefactor band]
float sf[8][64] which is [window group][scalefactor band]
float coeffs[1024], saved[1024], ret[1024]
ChannelElement 80688
which contains:
ms_mask[8][64] which is [window group][scalefactor band]
SingleChannelElement * 2
ChannelCoupling
note: each channel element is malloced
AACContext 16912
which contains:
float buf_mdct[2048], revers[1024]
So, it seems the issue is not MAX_CHANNELS so much as the window group
and scalefactor band arrays. I'm going to check the cases for maximum
number of scalefactor bands per window group as I expect it may be
beneficial to flatten these two indices.
buf_mdct and revers can be made half size when changing to imdct_half
so that should help with AACContext. And maybe coeffs/saved can be
reduced too.
Do you have any other comments?
Rob
More information about the ffmpeg-devel
mailing list