[Ffmpeg-devel] Re: [Ffmpeg-cvslog] r8420 - trunk/libavcodec/dv.c

Guillaume POIRIER poirierg
Sun Mar 25 13:06:45 CEST 2007


Hi,

On 3/25/07, Roman Shaposhnik <rvs at sun.com> wrote:
> On Fri, 2007-03-16 at 00:45 +0100, gpoirier 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]);
> >      EncBlockInfo  enc_blks[5*6];
> >      PutBitContext pbs[5*6];
> >      PutBitContext* pb;
> > @@ -846,7 +846,7 @@ static inline void dv_encode_video_segme
> >      int       vs_bit_size = 0;
> >      int       qnos[5];
> >
> > -    assert((((int)block) & 7) == 0);
> > +    assert((((int)block) & 15) == 0);
>
>   Are you sure this works? I see no way of aligning anything on the
> x86 stack for more than 8. And even that is kind of iffy, given
> that the x86 ABI mandates an alignment of 4.

Yes, it works(tm) on the platform where I tested the patch before
committing (intel/OSX 10.4.8)

The thing is that, unless my memory is too fuzzy, on Linux, there
weren't problems at all, only on OSX.

So either on Linux it happens to work magically, and forcing alignment
can't be proved to be working (other than by disasm the code), and/or
OSX allows to show that the alignment assumption was wrong, and that,
at least Apple's GCC honors (re)alignment directives.

Guillaume




More information about the ffmpeg-devel mailing list