summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-04-27 09:03:45 -0700
committerCode Review <code-review@webmproject.org>2011-04-27 09:03:45 -0700
commit64355ecad3849c9f8659179bbcf968ec84502ee8 (patch)
tree92039e04c272cae03c4d396a9ac726f3fa5c71d6 /vp8
parentf8ffecb176d00066b83a0d69dc7fedf2eba0f453 (diff)
parent5e1fd4135744cc00e09825631e8f4c99bd4c5d27 (diff)
downloadlibvpx-64355ecad3849c9f8659179bbcf968ec84502ee8.tar
libvpx-64355ecad3849c9f8659179bbcf968ec84502ee8.tar.gz
libvpx-64355ecad3849c9f8659179bbcf968ec84502ee8.tar.bz2
libvpx-64355ecad3849c9f8659179bbcf968ec84502ee8.zip
Merge "Speed up VP8DX_BOOL_DECODER_FILL"
Diffstat (limited to 'vp8')
-rw-r--r--vp8/decoder/dboolhuff.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index b217b14b3..5f6b211ea 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -51,19 +51,26 @@ void vp8dx_bool_decoder_fill(BOOL_DECODER *br);
#define VP8DX_BOOL_DECODER_FILL(_count,_value,_bufptr,_bufend) \
do \
{ \
- int shift; \
- for(shift = VP8_BD_VALUE_SIZE - 8 - ((_count) + 8); shift >= 0; ) \
+ int shift = VP8_BD_VALUE_SIZE - 8 - ((_count) + 8); \
+ int loop_end, x; \
+ size_t bits_left = ((_bufend)-(_bufptr))*CHAR_BIT; \
+ \
+ x = shift + CHAR_BIT - bits_left; \
+ loop_end = 0; \
+ if(x >= 0) \
{ \
- if((_bufptr) >= (_bufend)) { \
- (_count) += VP8_LOTS_OF_BITS; \
- break; \
- } \
- (_count) += 8; \
+ (_count) += VP8_LOTS_OF_BITS; \
+ loop_end = x; \
+ if(!bits_left) break; \
+ } \
+ while(shift >= loop_end) \
+ { \
+ (_count) += CHAR_BIT; \
(_value) |= (VP8_BD_VALUE)*(_bufptr)++ << shift; \
- shift -= 8; \
+ shift -= CHAR_BIT; \
} \
} \
- while(0)
+ while(0) \
static int vp8dx_decode_bool(BOOL_DECODER *br, int probability) {