summaryrefslogtreecommitdiff
path: root/libavcodec/bitstream.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-08-26 11:50:23 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-08-26 11:50:23 +0000
commit6e4703cac7e3b9c0bca77d46bf1f4df60f2424ea (patch)
treebc32f4149f0946806ea79b58bb6b06ba90ce3022 /libavcodec/bitstream.h
parenta42ec9f48468d5b1aca7ff25fc1b90ef5deaccfe (diff)
2nd try of skip_bits_long() for the ALT reader
1st try for the LIBMPEG2 reader simplify init_get_bits() Originally committed as revision 6097 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/bitstream.h')
-rw-r--r--libavcodec/bitstream.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
index bb0eb0c490..7325449aa1 100644
--- a/libavcodec/bitstream.h
+++ b/libavcodec/bitstream.h
@@ -446,7 +446,7 @@ static inline int get_bits_count(GetBitContext *s){
}
static inline void skip_bits_long(GetBitContext *s, int n){
- s->index + n;
+ s->index += n;
}
#elif defined LIBMPEG2_BITSTREAM_READER
@@ -512,6 +512,16 @@ static inline int get_bits_count(GetBitContext *s){
return (s->buffer_ptr - s->buffer)*8 - 16 + s->bit_count;
}
+static inline void skip_bits_long(GetBitContext *s, int n){
+ OPEN_READER(re, s)
+ re_bit_count += n;
+ re_buffer_ptr += 2*(re_bit_count>>4);
+ re_bit_count &= 15;
+ re_cache = ((re_buffer_ptr[-2]<<8) + re_buffer_ptr[-1]) << (16+re_bit_count);
+ UPDATE_CACHE(re, s)
+ CLOSE_READER(re, s)
+}
+
#elif defined A32_BITSTREAM_READER
# define MIN_CACHE_BITS 32
@@ -706,25 +716,9 @@ static inline void init_get_bits(GetBitContext *s,
#ifdef ALT_BITSTREAM_READER
s->index=0;
#elif defined LIBMPEG2_BITSTREAM_READER
-#ifdef LIBMPEG2_BITSTREAM_READER_HACK
- if ((int)buffer&1) {
- /* word alignment */
- s->cache = (*buffer++)<<24;
- s->buffer_ptr = buffer;
- s->bit_count = 16-8;
- } else
-#endif
- {
- s->buffer_ptr = buffer;
- s->bit_count = 16;
- s->cache = 0;
- }
- {
- OPEN_READER(re, s)
- UPDATE_CACHE(re, s)
- UPDATE_CACHE(re, s)
- CLOSE_READER(re, s)
- }
+ s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
+ s->bit_count = 16 + 8*((intptr_t)buffer&1);
+ skip_bits_long(s, 0);
#elif defined A32_BITSTREAM_READER
s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));
s->bit_count = 32 + 8*((intptr_t)buffer&3);