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

Måns Rullgård mru
Mon Jul 3 21:11:14 CEST 2006


"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);

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




More information about the ffmpeg-devel mailing list