[FFmpeg-devel] [PATCH] Fix 4XM decoding on big-endian and unaligned reads

Vitor Sessak vitor1001
Thu Nov 11 16:49:22 CET 2010


On 11/11/2010 02:03 PM, Michael Niedermayer wrote:
> On Thu, Nov 11, 2010 at 11:11:26AM +0100, Vitor Sessak wrote:
>> $subj, see issue2195.
>>
>> -Vitor
>
>>   4xm.c |   22 +++++++++++++++-------
>>   1 file changed, 15 insertions(+), 7 deletions(-)
>> 54479967536ec20908d3caa7d62b4e28fb8c2c3e  4xm.diff
>> Index: libavcodec/4xm.c
>> ===================================================================
>> --- libavcodec/4xm.c	(revision 25108)
>> +++ libavcodec/4xm.c	(working copy)
>> @@ -260,6 +260,14 @@
>>       }
>>   }
>>
>> +#define LE_CENTRIC_MUL(dst, src, scale, dc) \
>> +    { \
>> +        unsigned tmpval = ((src)[1]<<  16) + (src)[0];  \
>> +        tmpval = tmpval * (scale) + (dc);               \
>> +        (dst)[0] = tmpval&  0xFFFF;                     \
>> +        (dst)[1] = tmpval>>  16;                        \
>> +    }
>
> some ifdef so this doesnt slow down LE should be added

The "(src[1] << 16) + src[0]" stuff is also needed on LE since we only 
have 16-bit alignment for src. OTOH, one can use a 32-bit write, as 
attached.

-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 4xm2.diff
Type: text/x-patch
Size: 2203 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101111/f08c3616/attachment.bin>



More information about the ffmpeg-devel mailing list