[FFmpeg-cvslog] cabac_functions: Count zeros with ctz if it is fast

John Cox git at videolan.org
Fri Jan 22 04:38:54 CET 2016


ffmpeg | branch: master | John Cox <jc at kynesim.co.uk> | Wed Jan 20 17:56:30 2016 +0000| [5115d8326e8eba707ee3048930674e2f9058d913] | committer: Michael Niedermayer

cabac_functions: Count zeros with ctz if it is fast

When refilling the low bit buffer after get_cabac count the bits with ctz
if the processor has a fast version.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5115d8326e8eba707ee3048930674e2f9058d913
---

 libavcodec/cabac_functions.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cabac_functions.h b/libavcodec/cabac_functions.h
index 31c919b..42841c7 100644
--- a/libavcodec/cabac_functions.h
+++ b/libavcodec/cabac_functions.h
@@ -76,9 +76,12 @@ static inline void renorm_cabac_decoder_once(CABACContext *c){
 static void refill2(CABACContext *c){
     int i;
     unsigned x;
-
+#if !HAVE_FAST_CLZ
     x= c->low ^ (c->low-1);
     i= 7 - ff_h264_norm_shift[x>>(CABAC_BITS-1)];
+#else
+    i = ff_ctz(c->low) - CABAC_BITS;
+#endif
 
     x= -CABAC_MASK;
 



More information about the ffmpeg-cvslog mailing list