changeset 8386:102b197185d1 libavcodec

Faster CAVLC decoding of trailing_ones. Based on a patch by dark shikari. decode_residual is about 3.3% faster.
author michael
date Thu, 18 Dec 2008 16:11:19 +0000
parents af35581ac2ca
children 3e6e09814d0c
files h264.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Thu Dec 18 15:51:32 2008 +0000
+++ b/h264.c	Thu Dec 18 16:11:19 2008 +0000
@@ -4087,9 +4087,11 @@
     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;