[FFmpeg-devel] MPADecodeContext on stack

Michael Niedermayer michaelni
Fri Jan 23 13:33:09 CET 2009


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?

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/20090123/e6a21671/attachment.pgp>



More information about the ffmpeg-devel mailing list