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

michael subversion
Fri Dec 19 01:05:39 CET 2008


Author: michael
Date: Fri Dec 19 01:05:39 2008
New Revision: 16226

Log:
Optimize ctx calculation in decode_cabac_mb_mvd(), code by dark shikari.
The case for 16x16 blocks becomes 10 cpu cycles faster on pentium dual,
i could not find a speed difference in the case of subblocks though.


Modified:
   trunk/libavcodec/h264.c

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	(original)
+++ trunk/libavcodec/h264.c	Fri Dec 19 01:05:39 2008
@@ -5039,14 +5039,8 @@ static int decode_cabac_mb_mvd( H264Cont
     int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) +
                abs( h->mvd_cache[list][scan8[n] - 8][l] );
     int ctxbase = (l == 0) ? 40 : 47;
-    int ctx, mvd;
-
-    if( amvd < 3 )
-        ctx = 0;
-    else if( amvd > 32 )
-        ctx = 2;
-    else
-        ctx = 1;
+    int mvd;
+    int ctx = (amvd>2) + (amvd>32);
 
     if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx]))
         return 0;




More information about the ffmpeg-cvslog mailing list