diff cabac.h @ 3974:93746612bc78 libavcodec

optimize branchless C CABAC decoder
author michael
date Mon, 09 Oct 2006 20:44:11 +0000
parents f5f1c9af095d
children 6cc9eb5ee5e3
line wrap: on
line diff
--- a/cabac.h	Mon Oct 09 18:29:46 2006 +0000
+++ b/cabac.h	Mon Oct 09 20:44:11 2006 +0000
@@ -452,7 +452,7 @@
     int bit, lps_mask attribute_unused;
 
     c->range -= RangeLPS;
-#if 1
+#ifndef BRANCHLESS_CABAD
     if(c->low < c->range){
         bit= s&1;
         *state= c->mps_state[s];
@@ -475,8 +475,9 @@
     c->low -= c->range & lps_mask;
     c->range += (RangeLPS - c->range) & lps_mask;
 
-    bit= (s^lps_mask)&1;
-    *state= c->mps_state[s - (130&lps_mask)];
+    s^=lps_mask;
+    *state= c->mps_state[s];
+    bit= s&1;
 
     lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+3)];
     c->range<<= lps_mask;