summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-01-10 00:56:05 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-01-10 00:56:05 +0000
commit27a3e2c5e036b3199416b5c055a7db775e8f0620 (patch)
treed8f82222487d0eb3cfb29308773d69302c11ec85 /libavcodec/mpegaudiodec.c
parentbff6ecaa9c707f31be6143946df3a7ac88ee6c9e (diff)
another bitstream reader code (faster on intel cpus) - patch by Michael Niedermayer <michaelni@gmx.at>
Originally committed as revision 252 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index bbb3ff1c11..bb86bd0ca4 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1371,7 +1371,11 @@ 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
/* copy old data before current one */
ptr -= backstep;
memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] +
@@ -1528,15 +1532,25 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
/* 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
}
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
code = get_vlc(&s->gb, vlc);
dprintf("t=%d code=%d\n", g->count1table_select, code);