[FFmpeg-cvslog] r16219 - trunk/libavcodec/h264.c

michael subversion
Thu Dec 18 17:11:19 CET 2008


Author: michael
Date: Thu Dec 18 17:11:19 2008
New Revision: 16219

Log:
Faster CAVLC decoding of trailing_ones. Based on a patch by dark shikari.
decode_residual is about 3.3% faster.


Modified:
   trunk/libavcodec/h264.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Thu Dec 18 17:11:19 2008
@@ -4087,9 +4087,11 @@ static int decode_residual(H264Context *
     tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff);
     assert(total_coeff<=16);
 
-    for(i=0; i<trailing_ones; i++){
-        level[i]= 1 - 2*get_bits1(gb);
-    }
+    i = show_bits(gb, 3);
+    skip_bits(gb, trailing_ones);
+    level[0] = 1-((i&4)>>1);
+    level[1] = 1-((i&2)   );
+    level[2] = 1-((i&1)<<1);
 
     if(trailing_ones<total_coeff) {
         int level_code, mask;




More information about the ffmpeg-cvslog mailing list