aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vp3.c
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2005-05-19 02:43:21 +0000
committerMike Melanson <mike@multimedia.cx>2005-05-19 02:43:21 +0000
commitd30769555feb0e739c4f6de75a9a938ec07b1ea1 (patch)
tree2e89f37446e0a98cda592dc3c46a5ecd2c2e9526 /libavcodec/vp3.c
parentdef4272a03456d043486fcefac883044e0312d7a (diff)
downloadffmpeg-d30769555feb0e739c4f6de75a9a938ec07b1ea1.tar.gz
replace unpack_token() with a series of lookup tables
Originally committed as revision 4277 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vp3.c')
-rw-r--r--libavcodec/vp3.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 0e5d50ac08..b964b7da30 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -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) {