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

Michael Niedermayer michaelni
Thu Nov 11 16:53:26 CET 2010


On Thu, Nov 11, 2010 at 04:49:22PM +0100, Vitor Sessak wrote:
> 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.

AV_RL32()


> OTOH, one can use a 32-bit write, as
> attached.

[...]

--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101111/5729058b/attachment.pgp>



More information about the ffmpeg-devel mailing list