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

michael subversion
Tue Dec 23 20:10:46 CET 2008


Author: michael
Date: Tue Dec 23 20:10:46 2008
New Revision: 16295

Log:
Use the new VLC table for the first non trailing coeff too.
Sadly only 5 cycles faster here on pentium dual. So maybe the
complexity isnt worth it and this should be reverted ...

Modified:
   trunk/libavcodec/h264.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Tue Dec 23 19:31:44 2008	(r16294)
+++ trunk/libavcodec/h264.c	Tue Dec 23 20:10:46 2008	(r16295)
@@ -4142,9 +4142,16 @@ static int decode_residual(H264Context *
     level[2] = 1-((i&1)<<1);
 
     if(trailing_ones<total_coeff) {
-        int level_code, mask;
+        int mask, prefix;
         int suffix_length = total_coeff > 10 && trailing_ones < 3;
-        int prefix= get_level_prefix(gb);
+        int bitsi= show_bits(gb, LEVEL_TAB_BITS);
+        int level_code= cavlc_level_tab[suffix_length][bitsi][0];
+
+        skip_bits(gb, cavlc_level_tab[suffix_length][bitsi][1]);
+        if(level_code >= 100){
+            prefix= level_code - 100;
+            if(prefix == LEVEL_TAB_BITS)
+                prefix += get_level_prefix(gb);
 
         //first coefficient has suffix_length equal to 0 or 1
         if(prefix<14){ //FIXME try to build a large unified VLC table for all this
@@ -4166,11 +4173,17 @@ static int decode_residual(H264Context *
 
         if(trailing_ones < 3) level_code += 2;
 
-        suffix_length = 1;
-        if(level_code > 5)
-            suffix_length++;
+        suffix_length = 2;
         mask= -(level_code&1);
         level[trailing_ones]= (((2+level_code)>>1) ^ mask) - mask;
+        }else{
+            if(trailing_ones < 3) level_code += (level_code>>31)|1;
+
+            suffix_length = 1;
+            if(level_code + 3U > 6U)
+                suffix_length++;
+            level[trailing_ones]= level_code;
+        }
 
         //remaining coefficients have suffix_length > 0
         for(i=trailing_ones+1;i<total_coeff;i++) {




More information about the ffmpeg-cvslog mailing list