[FFmpeg-devel] MPADecodeContext on stack

Vitor Sessak vitor1001
Fri Jan 23 20:07:37 CET 2009


Michael Niedermayer wrote:
> On Thu, Jan 22, 2009 at 08:03:17PM +0100, Vitor Sessak wrote:
>> 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
>>>  262144 ff_mjpeg_decode_sos            mjpegdec.c:886
>>>  105472 AC3_encode_frame               ac3enc.c:1147
>>>   70656 roq_encode_frame               roqvideoenc.c:998
>> This one can be trivially "fixed" by moving the data to the context, as in 
>> the attached patch...
> [...]
>> Index: libavcodec/roqvideo.h
>> ===================================================================
>> --- libavcodec/roqvideo.h	(revision 16243)
>> +++ libavcodec/roqvideo.h	(working copy)
>> @@ -69,6 +69,7 @@
>>  
>>      AVFrame *frame_to_enc;
>>      uint8_t *out_buf;
>> +    void *tmpData;
>>  } RoqContext;
> 
> void?

I made it void because I didn't want to move the declaration of the 
struct to the header. But now I found a cleaner way.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roq_stack2.diff
Type: text/x-diff
Size: 3011 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090123/34aa1a68/attachment.diff>



More information about the ffmpeg-devel mailing list