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

Vitor Sessak vitor1001
Thu Nov 11 21:31:51 CET 2010


On 11/11/2010 07:45 PM, Michael Niedermayer wrote:
> On Thu, Nov 11, 2010 at 05:00:36PM +0100, Vitor Sessak wrote:
>> 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.
>
> i suspect that a simple 32bit read as done in svn is faster but i dont know
> if you want to split it in 2 on x86 then this should be benchmarked

I trust your suspicion better than my wild guess, so patch attached with 
AV_RL32.

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



More information about the ffmpeg-devel mailing list