[FFmpeg-devel] MPADecodeContext on stack

Michael Niedermayer michaelni
Sat Jan 24 02:35:27 CET 2009


On Fri, Jan 23, 2009 at 08:07:37PM +0100, Vitor Sessak wrote:
> 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.

well, ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090124/293e9325/attachment.pgp>



More information about the ffmpeg-devel mailing list