[Ffmpeg-devel] [PATCH] Chinese AVS video decoder

Måns Rullgård mru
Mon Jul 3 23:57:22 CEST 2006


"Stefan Gehrer" <stefan.gehrer at gmx.de> writes:

> Von: "M?ns Rullg?rd"
>
>> "Stefan Gehrer" <stefan.gehrer at gmx.de> writes:
>> 
>> > Von: "M?ns Rullg?rd"
>> >
>> >> These will cause alignment problems on non-x86 machines.
>> >> 
>> >> > +static void intra_pred_vert(uint8_t *d,uint8_t *top,uint8_t
>> *left,int
>> >> stride) {
>> >> > +    int y;
>> >> > +    uint64_t a = *((uint64_t *)(&top[1]));
>> >> > +    for(y=0;y<8;y++) {
>> >> > +        *((uint64_t *)(d+y*stride)) = a;
>> >> > +    }
>> >> > +}
>> >
>> > Just realised that this thing is still in the code and top[1] is very
>> > likely not on a word boundary, but I do not know how to fix this nicely.
>> > Suggestions?
>> 
>> Big endian:
>> uint64_t a = ((*(uint64_t*)top) << 8) | top[7];
>> 
>> Little endian:
>> uint64_t a = ((*(uint64_t*)top) >> 8) | ((uint64_t)top[7] << 56);
>
> Unfortunately, top[0] is also not aligned. It could be on a multiple of
> 10 bytes within h->top_border_u/v.

Darn... didn't notice that.  You'll have to use unaligned64(top) then.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list