[FFmpeg-devel] MMX function crash with icc -fp-stack-check

ivanohe at abacom.com ivanohe
Fri Mar 27 18:01:36 CET 2009

Guillaume POIRIER wrote:
> This is the intendend behaviour (so to speak). -fp-stack-check will
> rightfully crash if an MMX code has been called without clearing the
> FPU state afterwards.
> However, if you read the code of libavcodec/imgconvert.c::int
> avpicture_deinterlace
> you'll see that emms_c() is called after deinterlace_bottom_field() or
> deinterlace_bottom_field_inplace() is called on all planes.

Since my original problem was caused by the mmx deinterlace code (from
ffdeinterlace gstreamer filter), I finally found the cause :

The emms_c() macro never call the emms() function since the
dsputil_init()/dsputil_init_mmx() function is never called in a raw to raw
conversion like this :

./ffmpeg_g -i test.avi -vcodec rawvideo -an -deinterlace out2.avi

The mm_flags are set in dsputil_init_mmx(). I confirm I can prevent the crash by
changing the emms_c macro from this :

#define emms_c() \
    if (mm_flags & MM_MMX)\
to this
#define  emms_c() \
{ emms();}

I look a bit but I am not familar enough with ffmpeg to know where the
dsputil_init() function should be called for imgconvert... Or maybe just calling
mm_flags=mm_support() at the right place...

Anyway, I was able to fix it in gst-ffmpeg deinterlace filter. will post my
patch to gstreamer.

If I use a compressed input, or a vcodec is choosen (mpeg4, h263), the
dsputil_init()/ dsputil_init_mmx() is called. In that case emms_c() does it job
correctly and the other crash I see from icc -fp-stack-check are probably false
positive like you said.


Envoy? via / Sent via
Les Services Internet ABACOM inc.

Exp?diteur / Sender:

More information about the ffmpeg-devel mailing list