[Ffmpeg-cvslog] r8420 - trunk/libavcodec/dv.c
Rich Felker
dalias
Sun Mar 25 06:21:11 CEST 2007
On Sat, Mar 24, 2007 at 08:13:31PM -0700, Roman Shaposhnik wrote:
> On Sat, 2007-03-24 at 21:47 -0500, Rich Felker wrote:
> > > Modified: trunk/libavcodec/dv.c
> > > ==============================================================================
> > > --- trunk/libavcodec/dv.c (original)
> > > +++ trunk/libavcodec/dv.c Fri Mar 16 00:45:20 2007
> > > @@ -838,7 +838,7 @@ static inline void dv_encode_video_segme
> > > uint8_t* data;
> > > uint8_t* ptr;
> > > int do_edge_wrap;
> > > - DECLARE_ALIGNED_8(DCTELEM, block[64]);
> > > + DECLARE_ALIGNED_16(DCTELEM, block[64]);
> >
> > Aligned data on the stack does not work anyway.
>
> Well it does (we've just implemented it in Sun Studio ;-)). The only
> problem is -- you can't align to a stricter boundary than what
> ABI mandates without generating extra code for function prologues.
> Strictly speaking on x86 the largest alignment you can do is 4 and
> on x64 that would be 16. Now, given that every sensible x86 compiler
> in the world tends to aligns on 8 anyway -- 8 is a pretty safe bet,
> whereas 16 is NOT.
The compiler does not align at all; it's a matter of what the calling
code does. Thus all you can ever assume on x86 is 4. In order to be
correct, the compiler must generate code to fully align the stack in
any function that depends on the stack being aligned. gcc does not do
this, so it's broken. Either they should fix this or document the fact
that alignment attributes do not work on automatic variables.
> > If you want to use it,
> > you need to just declare an extra-large array and then align it
> > yourself in code.. Blame the gcc developers.
>
> Well, gcc developers should be blamed for right reasons ;-)
Indeed. Hopefully I made it clear now.
Rich
More information about the ffmpeg-cvslog
mailing list