[FFmpeg-devel] Stack variables alignment check in libavcodec/dsputil.c

Reimar Döffinger Reimar.Doeffinger
Thu Aug 2 01:29:10 CEST 2007

On Wed, Aug 01, 2007 at 04:02:29PM -0700, Roman Shaposhnick wrote:
> On Tue, 2007-07-31 at 08:53 +0200, Alex Beregszaszi wrote:
> > > > If this fails, some SSE optims will crash.
> > > 
> > >   Not neccesseraly. The variables on the stack could be properly aligned
> > > just by an accident.
> > 
> > I am facing such bugs on Windows.  Some of the SSE code (which does
> > unaligned access) crashes.  Like vorbis_inverse_coupling_sse.
>   Well, in my very humble opinion we have enough of an evidence to
> finally do something about it. The only problem is that this seems
> to be one of those areas where Michael has strong opinions about
> what constitutes the right solution. Meaning that I would be humble
> enough not to propose one ;-)

The problem is not in anyway new or unexpected, SSE is disabled since
ages in MPlayer under MinGW, but nobody could ever fully explain it,
there are loads of people who do not experience any problems.
I think the first condition would be to find the exact conditions where
this appears.
My impression so far is that it is one of
1) pre-4 gcc. Seems reasonable to ask for something newer then, for
AltiVec it is need too after all (IIRC).
2) The calling function (not gcc compiled or old gcc compiled) not
having the stack aligned sufficiently. Here the solution seems out of
our scope beyond adding it to the FAQ. We might in addition see if we
can provide a wrapper function to align the stack suitably.

Reimar D?ffinger

More information about the ffmpeg-devel mailing list