summaryrefslogtreecommitdiff
path: root/libavcodec/get_bits.h
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-02-22 12:09:33 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-24 07:28:14 -0800
commitb44b41633f110e9d938165e0f79c9d32191fc135 (patch)
treef961d1a5f5fcfcb65bad2bf003ab92028c2d8772 /libavcodec/get_bits.h
parent5ff42e3138998ef5207ca793735409105897c6f2 (diff)
downloadffmpeg-b44b41633f110e9d938165e0f79c9d32191fc135.tar.gz
get_bits: add HAVE_BITS_REMAINING macro.
Diffstat (limited to 'libavcodec/get_bits.h')
-rw-r--r--libavcodec/get_bits.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 158e6d2e69..64393bc9d9 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -120,10 +120,23 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define MIN_CACHE_BITS 25
#endif
+#if UNCHECKED_BITSTREAM_READER
#define OPEN_READER(name, gb) \
unsigned int name##_index = (gb)->index; \
unsigned int av_unused name##_cache = 0
+#define HAVE_BITS_REMAINING(name, gb) 1
+#else
+#define OPEN_READER(name, gb) \
+ unsigned int name##_index = (gb)->index; \
+ unsigned int av_unused name##_cache = 0; \
+ unsigned int av_unused name##_size_plus8 = \
+ (gb)->size_in_bits_plus8
+
+#define HAVE_BITS_REMAINING(name, gb) \
+ name##_index < name##_size_plus8
+#endif
+
#define CLOSE_READER(name, gb) (gb)->index = name##_index
#ifdef BITSTREAM_READER_LE
@@ -156,7 +169,7 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define SKIP_COUNTER(name, gb, num) name##_index += (num)
#else
# define SKIP_COUNTER(name, gb, num) \
- name##_index = FFMIN((gb)->size_in_bits_plus8, name##_index + (num))
+ name##_index = FFMIN(name##_size_plus8, name##_index + (num))
#endif
#define SKIP_BITS(name, gb, num) do { \