[Ffmpeg-devel] [PATCH] MXF demuxer improvements

Rich Felker dalias
Sat Jul 29 19:37:31 CEST 2006


On Sat, Jul 29, 2006 at 09:46:21AM +0200, Michael Niedermayer wrote:
> > > the thing which is being aligned is an array of bytes and under some
> > > circumstances 4 of these bytes have to be read as an 32bit int and
> > > that requires alignment on some architectures, surely these could
> > > be read in a way which doesn need any alignment but the original code
> > > needed it ...
> > 
> > Yes, but what I said was: if it needs to be read as 32bit int, then
> > declare it as an array of 32bit ints or as a union type with both byte
> > array and 32bit int array...
> 
> yes, i agree a union is the best choice if we directly read a 32bit int
> from the array, alternatively we could read it bytewise ...

glad we agree. :)

to elaborate, imo DECLARE_ALIGNED should only be used where the
additional alignment is required for special asm. if even "portable" c
code requires DECLARE_ALIGNED in order for data to be properly
aligned, then the c code is not portable except to compilers with this
extension. and since c provides a perfectly portable way to get
alignment up to the required alignment of any type (unions), it should
be used.

rich





More information about the ffmpeg-devel mailing list