aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/common.c
diff options
context:
space:
mode:
authorJuanjo <pulento@users.sourceforge.net>2001-11-03 00:49:53 +0000
committerJuanjo <pulento@users.sourceforge.net>2001-11-03 00:49:53 +0000
commit4949028f85dec72a5caf322757a6e6fd6ef711d3 (patch)
treeeb19917fca268793ef4f2e829619f78a3ec5b20c /libavcodec/common.c
parent162caf680fce1005d26dd563901f9c878c0326a3 (diff)
downloadffmpeg-4949028f85dec72a5caf322757a6e6fd6ef711d3.tar.gz
- Bug fix on inter MCBPC table for inter+q.
- H.263/H.263+ decoder now knows GOB start codes. - H.263/H.263+ decoder now returns the size of the stream on the first call. - Added show_bits() functions to see the buffer without loosing the bits. - TODO: H.263v1 UMV parsing is buggy. Originally committed as revision 204 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/common.c')
-rw-r--r--libavcodec/common.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/libavcodec/common.c b/libavcodec/common.c
index 2f7cafc6eb..aa45c35339 100644
--- a/libavcodec/common.c
+++ b/libavcodec/common.c
@@ -250,6 +250,52 @@ void align_get_bits(GetBitContext *s)
get_bits(s, n);
}
}
+/* This function is identical to get_bits_long(), the */
+/* only diference is that it doesn't touch the buffer */
+/* it is usefull to see the buffer. */
+
+unsigned int show_bits_long(GetBitContext *s, int n)
+{
+ unsigned int val;
+ int bit_cnt;
+ unsigned int bit_buf;
+ UINT8 *buf_ptr;
+
+ bit_buf = s->bit_buf;
+ bit_cnt = s->bit_cnt - n;
+
+ val = bit_buf >> (32 - n);
+ buf_ptr = s->buf_ptr;
+ buf_ptr += 4;
+
+ /* handle common case: we can read everything */
+ if (buf_ptr <= s->buf_end) {
+#ifdef ARCH_X86
+ bit_buf = bswap_32(*((unsigned long*)(&buf_ptr[-4])));
+#else
+ bit_buf = (buf_ptr[-4] << 24) |
+ (buf_ptr[-3] << 16) |
+ (buf_ptr[-2] << 8) |
+ (buf_ptr[-1]);
+#endif
+ } else {
+ buf_ptr -= 4;
+ bit_buf = 0;
+ if (buf_ptr < s->buf_end)
+ bit_buf |= *buf_ptr++ << 24;
+ if (buf_ptr < s->buf_end)
+ bit_buf |= *buf_ptr++ << 16;
+ if (buf_ptr < s->buf_end)
+ 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 += 32;
+
+ return val;
+}
/* VLC decoding */