changeset 8393:64a0415da32f libavcodec

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.
author michael
date Fri, 19 Dec 2008 00:05:39 +0000
parents ee23da1a0c74
children a9132c1bd56a
files h264.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Thu Dec 18 23:52:32 2008 +0000
+++ b/h264.c	Fri Dec 19 00:05:39 2008 +0000
@@ -5039,14 +5039,8 @@
     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;