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

Måns Rullgård mans
Thu Jul 1 02:06:21 CEST 2010


Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> 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...

((c->high - low) >> 31) + 1 might be friendlier to the compiler than
the ! operator.

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



More information about the ffmpeg-cvslog mailing list