[FFmpeg-devel] MPADecodeContext on stack

Benjamin Larsson banan
Thu Jan 22 11:48:23 CET 2009


M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
>
>   
>> On Mon, Jan 19, 2009 at 05:56:54PM +0100, Andreas ?man wrote:
>>     
>>> Hi
>>>
>>> MPADecodeContext is allocated on the stack at two places:
>>>
>>> libavformat/mp3.c
>>> libavcodec/mpegaudio_parser.c
>>>
>>> sizeof(MPADecodeContext) = ~23k
>>>
>>>       
>>> This is, by far, the biggest stack consumer in ffmpeg.
>>>       
>> i do not belive this entirely
>>     
>
> You believe correctly.  Here's a list of stack offenders on ARM:
>
> 6553600 encode_frame                   nellymoserenc.c:339
>   
Found the culprit.

#*define* OPT_SIZE ((1<<15) + 3000)

**
*static* *void* *get_exponent_dynamic*(NellyMoserEncodeContext *s, *float* *cand, *int* *idx_table)
{
    *int* i, j, band, best_idx;
    *float* power_candidate, best_val;

    *float* opt[NELLY_BANDS][OPT_SIZE];
    *int* path[NELLY_BANDS][OPT_SIZE];

3290656 * 2 = 6581312


Should I move the tables to the context ?

MvH
Benjamin Larsson






More information about the ffmpeg-devel mailing list