[x264-devel] commit: Shave one instruction off CABAC encode_decision ( Jason Garrett-Glaser )

git version control git at videolan.org
Tue Mar 31 05:04:45 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Sun Mar 29 18:27:32 2009 -0700| [d3ca4647a247186c2df7760be2a9c649efe34815] | committer: Jason Garrett-Glaser 

Shave one instruction off CABAC encode_decision
range_lps>>6 ranges from 4-7, so (range_lps>>6)-4 == (range_lps>>6) & 3

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d3ca4647a247186c2df7760be2a9c649efe34815
---

 common/cabac.c         |    2 +-
 common/x86/cabac-a.asm |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/cabac.c b/common/cabac.c
index 7a2e94d..65d143f 100644
--- a/common/cabac.c
+++ b/common/cabac.c
@@ -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) )
     {
diff --git a/common/x86/cabac-a.asm b/common/x86/cabac-a.asm
index dc03faa..29e05f1 100644
--- a/common/x86/cabac-a.asm
+++ b/common/x86/cabac-a.asm
@@ -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



More information about the x264-devel mailing list