summaryrefslogtreecommitdiff
path: root/libavcodec/vble.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-12 01:40:37 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-12 03:02:49 +0100
commit35fd7b2968834c5994bfd2a93edfbf0dea5e667e (patch)
tree01755b951e3793e494c06ab8c3ac8729de47d9e5 /libavcodec/vble.c
parentc5e55e214cffc68641ec05fdf5a853df230ccfeb (diff)
downloadffmpeg-35fd7b2968834c5994bfd2a93edfbf0dea5e667e.tar.gz
vble: use LUT for vble_read_reverse_unary()
slightly faster Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/vble.c')
-rw-r--r--libavcodec/vble.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index b758e23d61..5f78e6a198 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -40,11 +40,21 @@ typedef struct {
static uint8_t vble_read_reverse_unary(GetBitContext *gb)
{
+ static const uint8_t LUT[256] = {
+ 8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ 5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
+ };
/* At most we need to read 9 bits total to get indices up to 8 */
int val = show_bits(gb, 8);
if (val) {
- val = 7 - av_log2_16bit(av_reverse[val]);
+ val = LUT[val];
skip_bits(gb, val + 1);
return val;
} else {