diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-08-25 13:36:27 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-08-25 13:36:27 +0000 |
commit | 9b49f89cdf1ad19b01b6e2e7c9c9fbf592e3264f (patch) | |
tree | d41565a7960bc815eba2a44b87693e23ef96ef93 /libavcodec/mpegaudiodec.c | |
parent | 1f1d675b68a15dd287a0c996d68a489a8e127e0d (diff) | |
download | ffmpeg-9b49f89cdf1ad19b01b6e2e7c9c9fbf592e3264f.tar.gz |
avoid reading exponent twice
Originally committed as revision 6085 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r-- | libavcodec/mpegaudiodec.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index d828cca14e..923850c115 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1703,6 +1703,8 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, /* read huffcode and compute each couple */ for(;j>0;j--) { + int exponent; + if (get_bits_count(&s->gb) >= end_pos) break; y = get_vlc2(&s->gb, vlc->table, 7, 3); @@ -1716,20 +1718,22 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, x = y >> 4; y = y & 0x0f; + exponent= exponents[s_index]; dprintf("region=%d n=%d x=%d y=%d exp=%d\n", - i, g->region_size[i] - j, x, y, exponents[s_index]); + i, g->region_size[i] - j, x, y, exponent); if (x) { #if 0 if (x == 15) x += get_bitsz(&s->gb, linbits); - v = l3_unscale(x, exponents[s_index]); + v = l3_unscale(x, exponent); #else if (x < 15){ - v = expval_table[ exponents[s_index] + 400 ][ x ]; + v = expval_table[ exponent + 400 ][ x ]; +// v = expval_table[ (exponent&3) + 400 ][ x ] >> FFMIN(0 - (exponent>>2), 31); }else{ x += get_bitsz(&s->gb, linbits); - v = l3_unscale(x, exponents[s_index]); + v = l3_unscale(x, exponent); } #endif if (get_bits1(&s->gb)) @@ -1742,13 +1746,13 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, #if 0 if (y == 15) y += get_bitsz(&s->gb, linbits); - v = l3_unscale(y, exponents[s_index]); + v = l3_unscale(y, exponent); #else if (y < 15){ - v = expval_table[ exponents[s_index] + 400 ][ y ]; + v = expval_table[ exponent + 400 ][ y ]; }else{ y += get_bitsz(&s->gb, linbits); - v = l3_unscale(y, exponents[s_index]); + v = l3_unscale(y, exponent); } #endif if (get_bits1(&s->gb)) |