aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/common.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-06-02 12:13:09 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-06-02 12:13:09 +0000
commitc9b5489c08792729fb5a8a589a5c04e5ca1e2dde (patch)
tree688b94542d69a663bed021681f5e2e424f445a01 /libavcodec/common.c
parent7fd08ac1d1043b2d6c39eac11d00703b8fd42e40 (diff)
downloadffmpeg-c9b5489c08792729fb5a8a589a5c04e5ca1e2dde.tar.gz
fixing get_bits_count at the end
Originally committed as revision 638 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.c')
-rw-r--r--libavcodec/common.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/common.c b/libavcodec/common.c
index dadaf5df42..97788ec9dc 100644
--- a/libavcodec/common.c
+++ b/libavcodec/common.c
@@ -174,6 +174,9 @@ unsigned int get_bits_long(GetBitContext *s, int n)
(buf_ptr[-2] << 8) |
(buf_ptr[-1]);
#endif
+ val |= bit_buf >> (32 + bit_cnt);
+ bit_buf <<= - bit_cnt;
+ bit_cnt += 32;
} else {
buf_ptr -= 4;
bit_buf = 0;
@@ -185,11 +188,13 @@ unsigned int get_bits_long(GetBitContext *s, int n)
bit_buf |= *buf_ptr++ << 8;
if (buf_ptr < s->buf_end)
bit_buf |= *buf_ptr++;
+
+ val |= bit_buf >> (32 + bit_cnt);
+ bit_buf <<= - bit_cnt;
+ bit_cnt += 8*(buf_ptr - s->buf_ptr);
+ if(bit_cnt<0) bit_cnt=0;
}
s->buf_ptr = buf_ptr;
- val |= bit_buf >> (32 + bit_cnt);
- bit_buf <<= - bit_cnt;
- bit_cnt += 32;
}
s->bit_buf = bit_buf;
s->bit_cnt = bit_cnt;