]> git.videolan.org Git - x264.git/commitdiff
Shave one instruction off CABAC encode_decision
authorJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 30 Mar 2009 01:27:32 +0000 (18:27 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 30 Mar 2009 01:27:32 +0000 (18:27 -0700)
range_lps>>6 ranges from 4-7, so (range_lps>>6)-4 == (range_lps>>6) & 3

common/cabac.c
common/x86/cabac-a.asm

index 7a2e94ddbe54aa046ed50eff8acab5778d5ba26c..65d143f5b363e107815841bf9335eb12f95f8acb 100644 (file)
@@ -861,7 +861,7 @@ static inline void x264_cabac_encode_renorm( x264_cabac_t *cb )
 void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b )
 {
     int i_state = cb->state[i_ctx];
-    int i_range_lps = x264_cabac_range_lps[i_state][(cb->i_range>>6)&0x03];
+    int i_range_lps = x264_cabac_range_lps[i_state][(cb->i_range>>6)-4];
     cb->i_range -= i_range_lps;
     if( b != (i_state >> 6) )
     {
index dc03faabfd7a4186f0fe274aeddb7ff500589fca..29e05f1139d148a6d8b55b07afb1921ab97f7ffe 100644 (file)
@@ -76,8 +76,7 @@ cglobal x264_cabac_encode_decision_asm, 0,7
     movzx t3d, byte [t0+cb.state+t1]
     mov   t4d, t5d
     shr   t5d, 6
-    and   t5d, 3
-    LOAD_GLOBAL t5d, x264_cabac_range_lps, t5, t3*4
+    LOAD_GLOBAL t5d, x264_cabac_range_lps-4, t5, t3*4
     sub   t4d, t5d
     mov   t6d, t3d
     shr   t6d, 6