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

darkshikari subversion
Thu Jul 1 01:18:47 CEST 2010


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.

Modified:
   trunk/libavcodec/vp56.h

Modified: trunk/libavcodec/vp56.h
==============================================================================
--- trunk/libavcodec/vp56.h	Thu Jul  1 01:15:25 2010	(r23920)
+++ trunk/libavcodec/vp56.h	Thu Jul  1 01:18:47 2010	(r23921)
@@ -199,12 +199,8 @@ static inline int vp56_rac_get_prob(VP56
     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;



More information about the ffmpeg-cvslog mailing list