Commit d3076955 authored by Mike Melanson's avatar Mike Melanson

replace unpack_token() with a series of lookup tables

Originally committed as revision 4277 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent def4272a
......@@ -1667,10 +1667,11 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
{
int i;
int token;
int zero_run;
DCTELEM coeff;
int zero_run = 0;
DCTELEM coeff = 0;
Vp3Fragment *fragment;
uint8_t *perm= s->scantable.permutated;
int bits_to_get;
if ((first_fragment >= s->fragment_count) ||
(last_fragment >= s->fragment_count)) {
......@@ -1691,7 +1692,26 @@ static int unpack_vlcs(Vp3DecodeContext *s, GetBitContext *gb,
token = get_vlc2(gb, table->table, 5, 3);
debug_vlc(" token = %2d, ", token);
/* use the token to get a zero run, a coefficient, and an eob run */
#if 1
if (token <= 6) {
eob_run = eob_run_base[token];
if (eob_run_get_bits[token])
eob_run += get_bits(gb, eob_run_get_bits[token]);
coeff = zero_run = 0;
} else {
bits_to_get = coeff_get_bits[token];
if (!bits_to_get)
coeff = coeff_tables[token][0];
else
coeff = coeff_tables[token][get_bits(gb, bits_to_get)];
zero_run = zero_run_base[token];
if (zero_run_get_bits[token])
zero_run += get_bits(gb, zero_run_get_bits[token]);
}
#else
unpack_token(gb, token, &zero_run, &coeff, &eob_run);
#endif
}
if (!eob_run) {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment