[ogg-dev] data alignment issue on ARM

Erik de Castro Lopo mle+la at mega-nerd.com
Mon May 4 00:38:59 PDT 2009


Conrad Parker wrote:

> The relevant code is in liboggz HEAD at:
> 
> http://git.xiph.org/?p=liboggz.git;a=blob;f=src/liboggz/oggz_auto.c;h=ebb825c348298dc352a54d6925ce74ed707bbc3a;hb=HEAD#l138

My suspicion is this:

    fps_numerator = INT32_BE_AT(&header[22]);

Sure enough, INT32_BE_AT is defined as:

    #define INT32_BE_AT(x) _be_32((*(ogg_int32_t *)(x)))

which will work fine as long as x in 4 byte aligned.

I suspect that if INT32_BE_AT is defined as follows:

   static int32_t
   INT32_BE_AT (unsigned char *c)
   {   return (c [0] <<  24) + (c [1] <<  16) + (c [2] <<  8) + c [0] ;
   }

then you won't see the problem.

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the ogg-dev mailing list