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

Vitor Sessak vitor1001
Thu Nov 11 17:00:36 CET 2010


On 11/11/2010 04:53 PM, Michael Niedermayer wrote:
> 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()

Is it faster? AV_RL32() do not know that src is 16-bit aligned.

-Vitor



More information about the ffmpeg-devel mailing list