[FFmpeg-devel] [PATCH] Optimization of original IFF codec

Måns Rullgård mans
Mon Apr 26 20:19:45 CEST 2010


Sebastian Vater <cdgs.basty at googlemail.com> writes:

> Sebastian Vater a ?crit :
>> Hi Mans!
>>
>> M?ns Rullg?rd a ?crit :
>>   
>>> Sebastian Vater <cdgs.basty at googlemail.com> writes:
>>>
>>>   
>>>     
>>>> Hi Mans!
>>>>
>>>> M?ns Rullg?rd a ?crit :
>>>>     
>>>>       
>>>>> This is inefficient.  You are building the table afresh on each call
>>>>> to the function.  Make the table static const, dropping the shift, and
>>>>> instead shift the table value inside the loop.
>>>>>   
>>>>>       
>>>>>         
>>>> I just benchmarked both, my solution is way faster:
>>>>     
>>>>       
>>> I don't believe that, simply because it has more work to do.  How did
>>> you benchmark it?
>>>   
>>>     
>> Why? The init is done only once per call, but moving the bit-shift in
>> the inner-loop will shift every inner-loop iteration.
>>
>>   
> I also took a look on disassembly output...the shift out-side the loop
> for lut init is only done once, gcc optimizes that and just puts the
> precalculated shift-result into the correct positions.

How many different shift positions are there?  What hardware are you
benchmarking this on?

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list