summaryrefslogtreecommitdiff
path: root/libavcodec/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/common.c')
-rw-r--r--libavcodec/common.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/libavcodec/common.c b/libavcodec/common.c
index 4f70e6f924..26165b9018 100644
--- a/libavcodec/common.c
+++ b/libavcodec/common.c
@@ -140,7 +140,7 @@ void init_get_bits(GetBitContext *s,
#ifdef ALT_BITSTREAM_READER
s->index=0;
#elif defined LIBMPEG2_BITSTREAM_READER
-#ifdef LIBMPEG2_BITSTREAM_HACK
+#ifdef LIBMPEG2_BITSTREAM_READER_HACK
if ((int)buffer&1) {
/* word alignment */
s->cache = (*buffer++)<<24;
@@ -170,6 +170,30 @@ void init_get_bits(GetBitContext *s,
#endif
}
+/**
+ * reads 0-32 bits.
+ */
+unsigned int get_bits_long(GetBitContext *s, int n){
+ if(n<=17) return get_bits(s, n);
+ else{
+ int ret= get_bits(s, 16) << (n-16);
+ return ret | get_bits(s, n-16);
+ }
+}
+
+/**
+ * shows 0-32 bits.
+ */
+unsigned int show_bits_long(GetBitContext *s, int n){
+ if(n<=17) return show_bits(s, n);
+ else{
+ GetBitContext gb= *s;
+ int ret= get_bits_long(s, n);
+ *s= gb;
+ return ret;
+ }
+}
+
void align_get_bits(GetBitContext *s)
{
int n= (-get_bits_count(s)) & 7;