[ogg-dev] data alignment issue on ARM

Conrad Parker conrad at metadecks.org
Mon May 4 01:13:26 PDT 2009


2009/5/4 Erik de Castro Lopo <mle+la at mega-nerd.com>:
> 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.

great, thanks Erik: applied (351a85) with a function of that name in lowercase.

Thanks also to Chris Pearce for the explanation over in the bug report :-)

cheers,

Conrad.


More information about the ogg-dev mailing list