[FFmpeg-devel] MPADecodeContext on stack

Måns Rullgård mans
Thu Jan 22 02:17:39 CET 2009


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
  61440 mxf_read_packet                mxfdec.c:301
  49920 put_main_header                vorbis_enc.c:498
  43264 ff_lpc_calc_coefs              lpc.c:103
  41472 encode_thread                  mpegvideo_enc.c:1985
  28928 encode_frame                   nellymoserenc.c:339
  23296 mp3_read_header                mp3.c:443
  23040 mpegaudio_parse                mpegaudio_parser.c:96
  23040 ff_mpa_decode_header           mpegaudio_parser.c:48
  13568 mp_decode_layer3               mpegaudiodec.c:1945
  11968 encode_q_branch                snow.c:1735
  11008 dv_encode_video_segment        dv.c:975
  10560 ff_update_duplicate_context    mpegvideo.c:354
  10304 calc_rice_params               flacenc.c:519
  10304 generate_joint_tables          huffyuv.c:322
   9280 dvvideo_init                   dv.c:268
   6784 dv_decode_video_segment        dv.c:511
   6272 decode_frame                   4xm.c:681
   6016 encode_picture_ls              jpeglsenc.c:229
   5632 dca_decode_frame               dca.c:1213
   5312 mc_block                       snow.c:2104
   5248 iterative_me                   snow.c:3027
   4864 encode_frame                   snow.c:4153
   4736 qdm2_decode_frame              qdm2.c:2009
   4672 ff_mpc_dequantize_and_synth    mpc.c:68
   4608 decode_frame_mp3on4            mpegaudiodec.c:2463
   4544 alac_encode_frame              alacenc.c:450
   4480 encode_residual                flacenc.c:808
   4480 MPV_encode_picture             mpegvideo_enc.c:1185
   4416 bidir_refine                   motion_est.c:1394
   4352 vmdvideo_decode_frame          vmdav.c:370
   4288 svq1_encode_plane              svq1enc.c:272

Some of these include stack space used by inlined functions called
from those named.

These are all the functions using more than 4k of stack space.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list