[FFmpeg-cvslog] r23921 - trunk/libavcodec/vp56.h

Jason Garrett-Glaser darkshikari
Thu Jul 1 02:00:04 CEST 2010


On Wed, Jun 30, 2010 at 4:41 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> On Thu, Jul 01, 2010 at 01:18:47AM +0200, darkshikari wrote:
>> Author: darkshikari
>> Date: Thu Jul ?1 01:18:47 2010
>> New Revision: 23921
>>
>> Log:
>> CMOV-ify vp56 arithcoder
>> This incantation causes gcc 4.3 to generate cmov on x86, a vastly better option
>> than a completely unpredictable branch.
>> Hopefully this carries over to newer versions and other CPUs with conditionals.
>> ~5 cycles saved per call on a Core i7.
>
> Nice, I actually tried to make a branchless variant using a mask etc, unfortunately
> it needs so many additional instructions that it ended up being the same speed.
>
>> + ? ?c->high = bit ? c->high - low : low;
>> + ? ?c->code_word = bit ? c->code_word - low_shift : c->code_word;
>
> Does the compiler "get" that
> bit == !((c->high - low) >> 31)
> not sure that actually is any faster to calculate, but what the
> compiler did looked rather bad to me...

Feel free to improve it.

Dark Shikari



More information about the ffmpeg-cvslog mailing list