summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-07-09 10:35:10 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-07-09 10:35:10 +0000
commit8db1a1dde0f61f98e9e69707eb10601e42ad3a34 (patch)
tree4ce7ff2694e026aebb4965d9fad403639e786282 /libavcodec/mpegaudiodec.c
parent436483c2ec856a7e63dd57ec5fe963831bc059cd (diff)
new bitstream reader API (old get_bits() based one is emulated and will still be supported in the future cuz its simpler)
minor optimizations to get_vlc Originally committed as revision 725 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c37
1 files changed, 8 insertions, 29 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 21ce1403dd..1dabdac255 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1457,11 +1457,8 @@ static void seek_to_maindata(MPADecodeContext *s, long backstep)
UINT8 *ptr;
/* compute current position in stream */
-#ifdef ALT_BITSTREAM_READER
- ptr = s->gb.buffer + (s->gb.index>>3);
-#else
- ptr = s->gb.buf_ptr - (s->gb.bit_cnt >> 3);
-#endif
+ ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
+
/* copy old data before current one */
ptr -= backstep;
memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] +
@@ -1547,9 +1544,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
{
int s_index;
int linbits, code, x, y, l, v, i, j, k, pos;
- UINT8 *last_buf_ptr;
- UINT32 last_bit_buf;
- int last_bit_cnt;
+ GetBitContext last_gb;
VLC *vlc;
UINT8 *code_table;
@@ -1608,36 +1603,20 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
/* high frequencies */
vlc = &huff_quad_vlc[g->count1table_select];
- last_buf_ptr = NULL;
- last_bit_buf = 0;
- last_bit_cnt = 0;
+ last_gb.buffer = NULL;
while (s_index <= 572) {
pos = get_bits_count(&s->gb);
if (pos >= end_pos) {
- if (pos > end_pos && last_buf_ptr != NULL) {
+ if (pos > end_pos && last_gb.buffer != NULL) {
/* some encoders generate an incorrect size for this
part. We must go back into the data */
s_index -= 4;
-#ifdef ALT_BITSTREAM_READER
- s->gb.buffer = last_buf_ptr;
- s->gb.index = last_bit_cnt;
-#else
- s->gb.buf_ptr = last_buf_ptr;
- s->gb.bit_buf = last_bit_buf;
- s->gb.bit_cnt = last_bit_cnt;
-#endif
+ s->gb = last_gb;
}
break;
}
-#ifdef ALT_BITSTREAM_READER
- last_buf_ptr = s->gb.buffer;
- last_bit_cnt = s->gb.index;
-#else
- last_buf_ptr = s->gb.buf_ptr;
- last_bit_buf = s->gb.bit_buf;
- last_bit_cnt = s->gb.bit_cnt;
-#endif
-
+ last_gb= s->gb;
+
code = get_vlc(&s->gb, vlc);
dprintf("t=%d code=%d\n", g->count1table_select, code);
if (code < 0)