aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2012-03-24 07:29:51 +0100
committerKostya Shishkov <kostya.shishkov@gmail.com>2012-03-24 11:53:26 +0100
commit494bce6224c7da6a174fb16a49ed26e5aab32af1 (patch)
tree7e819bec254d031b85bd7348ad7c547a6d0c8ed3 /libavcodec
parentcb7190cd2c691fd93e4d3664f3fce6c19ee001dd (diff)
downloadffmpeg-494bce6224c7da6a174fb16a49ed26e5aab32af1.tar.gz
ralf: read Huffman code lengths without GetBitContext
Those descriptions are stored in nibbles, so they are easy to extract. And this way we don't need to pad tables for possible bit reader overreads.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ralf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 38e7e69cb7..0e5b04663f 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -80,17 +80,17 @@ static int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
int counts[17], prefixes[18];
int i, cur_len;
int max_bits = 0;
- GetBitContext gb;
-
- init_get_bits(&gb, data, elems * 4);
+ int nb = 0;
for (i = 0; i <= 16; i++)
counts[i] = 0;
for (i = 0; i < elems; i++) {
- cur_len = get_bits(&gb, 4) + 1;
+ cur_len = (nb ? *data & 0xF : *data >> 4) + 1;
counts[cur_len]++;
max_bits = FFMAX(max_bits, cur_len);
lens[i] = cur_len;
+ data += nb;
+ nb ^= 1;
}
prefixes[1] = 0;
for (i = 1; i <= 16; i++)