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

Michael Niedermayer michaelni
Thu Nov 11 19:45:15 CET 2010


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

    [...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- 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/33cd1603/attachment.pgp>



More information about the ffmpeg-devel mailing list