[FFmpeg-devel] [PATCH] A rather simple H.264 speed optimization

Jason Garrett-Glaser darkshikari
Mon Jul 28 06:50:29 CEST 2008


$subject, gains 6 clock cycles or so per decode_cabac_residual call on
an ordinary source.

Dark Shikari

Index: libavcodec/h264.c
===================================================================
--- libavcodec/h264.c	(revision 14445)
+++ libavcodec/h264.c	(working copy)
@@ -5356,10 +5356,10 @@
         }
     }

-    while( coeff_count-- ) {
+    do {
         uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base;

-        int j= scantable[index[coeff_count]];
+        int j= scantable[index[--coeff_count]];

         if( get_cabac( CC, ctx ) == 0 ) {
             node_ctx = coeff_abs_level_transition[0][node_ctx];
@@ -5396,7 +5396,7 @@
                 block[j] = (get_cabac_bypass_sign( CC, -coeff_abs ) *
qmul[j] + 32) >> 6;
             }
         }
-    }
+    } while( coeff_count );
 #ifdef CABAC_ON_STACK
             h->cabac.range     = cc.range     ;
             h->cabac.low       = cc.low       ;




More information about the ffmpeg-devel mailing list