diff options
author | Jason Garrett-Glaser <darkshikari@gmail.com> | 2010-06-30 23:18:47 +0000 |
---|---|---|
committer | Jason Garrett-Glaser <darkshikari@gmail.com> | 2010-06-30 23:18:47 +0000 |
commit | 36d6b545a1a5309b3d9223b0db40ad2879817af5 (patch) | |
tree | 8ab9a00c790b8f413431e923be1a27beb4fa815c /libavcodec | |
parent | 2e6ed48d6e7525fceba5469e1512b20c7c5c3198 (diff) | |
download | ffmpeg-streaming-36d6b545a1a5309b3d9223b0db40ad2879817af5.zip ffmpeg-streaming-36d6b545a1a5309b3d9223b0db40ad2879817af5.tar.gz |
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.
Originally committed as revision 23921 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vp56.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h index af1a65d..6a2e29f 100644 --- a/libavcodec/vp56.h +++ b/libavcodec/vp56.h @@ -199,12 +199,8 @@ static inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) int bit = c->code_word >= low_shift; int shift; - if (bit) { - c->high -= low; - c->code_word -= low_shift; - } else { - c->high = low; - } + c->high = bit ? c->high - low : low; + c->code_word = bit ? c->code_word - low_shift : c->code_word; /* normalize */ shift = ff_h264_norm_shift[c->high] - 1; |