summaryrefslogtreecommitdiff
path: root/libavcodec/common.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-05-14 10:55:59 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-05-14 10:55:59 +0000
commit17fb5fd34e96ce472019d4f2b8d798bbd885a24b (patch)
tree2ff6cb1985d58cbd551d79c5b9347b29f3788bdf /libavcodec/common.h
parent924311cd9828695b42cf639c4ea5f258c1a04efd (diff)
libmpeg2 style bitstream reader fixes
Originally committed as revision 1875 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.h')
-rw-r--r--libavcodec/common.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/libavcodec/common.h b/libavcodec/common.h
index 494db42e2e..1a8202d709 100644
--- a/libavcodec/common.h
+++ b/libavcodec/common.h
@@ -543,8 +543,8 @@ static inline int get_bits_count(GetBitContext *s){
# define UPDATE_CACHE(name, gb)\
if(name##_bit_count >= 0){\
- name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr++) << name##_bit_count;\
- name##_buffer_ptr+=2;\
+ name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr) << name##_bit_count;\
+ ((uint16_t*)name##_buffer_ptr)++;\
name##_bit_count-= 16;\
}\
@@ -654,9 +654,12 @@ static inline int get_bits_count(GetBitContext *s){
#endif
-/* add BERO
- if MSB not set it is negative
-*/
+/**
+ * read mpeg1 dc style vlc (sign bit + mantisse with no MSB).
+ * if MSB not set it is negative
+ * @param n length in bits
+ * @author BERO
+ */
static inline int get_xbits(GetBitContext *s, int n){
register int tmp;
register int32_t cache;
@@ -685,6 +688,10 @@ static inline int get_sbits(GetBitContext *s, int n){
return tmp;
}
+/**
+ * reads 0-17 bits.
+ * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant
+ */
static inline unsigned int get_bits(GetBitContext *s, int n){
register int tmp;
OPEN_READER(re, s)
@@ -695,6 +702,12 @@ static inline unsigned int get_bits(GetBitContext *s, int n){
return tmp;
}
+unsigned int get_bits_long(GetBitContext *s, int n);
+
+/**
+ * shows 0-17 bits.
+ * Note, the alt bitstream reader can read upto 25 bits, but the libmpeg2 reader cant
+ */
static inline unsigned int show_bits(GetBitContext *s, int n){
register int tmp;
OPEN_READER(re, s)
@@ -704,6 +717,8 @@ static inline unsigned int show_bits(GetBitContext *s, int n){
return tmp;
}
+unsigned int show_bits_long(GetBitContext *s, int n);
+
static inline void skip_bits(GetBitContext *s, int n){
//Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
OPEN_READER(re, s)