summaryrefslogtreecommitdiff
path: root/libavcodec/cabac.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-10-09 20:44:11 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-10-09 20:44:11 +0000
commit2e1aee80f4e7bd17bfcc5a386f5b879f9e2437bc (patch)
tree882628e12ecee641c065bfb0e76806c36d0d0e20 /libavcodec/cabac.h
parentb420448e38ae27110953e857f5d65b58ccc8e688 (diff)
optimize branchless C CABAC decoder
Originally committed as revision 6607 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/cabac.h')
-rw-r--r--libavcodec/cabac.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index 2f8a8d9fe7..58698b73d1 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -452,7 +452,7 @@ static int get_cabac(CABACContext *c, uint8_t * const state){
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 @@ static int get_cabac(CABACContext *c, uint8_t * const state){
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;