get_bits: add HAVE_BITS_REMAINING macro.

pull/3/merge
Ronald S. Bultje 13 years ago
parent 5ff42e3138
commit b44b41633f
  1. 15
      libavcodec/get_bits.h

@ -120,10 +120,23 @@ for examples see get_bits, show_bits, skip_bits, get_vlc
# define MIN_CACHE_BITS 25 # define MIN_CACHE_BITS 25
#endif #endif
#if UNCHECKED_BITSTREAM_READER
#define OPEN_READER(name, gb) \ #define OPEN_READER(name, gb) \
unsigned int name##_index = (gb)->index; \ unsigned int name##_index = (gb)->index; \
unsigned int av_unused name##_cache = 0 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 #define CLOSE_READER(name, gb) (gb)->index = name##_index
#ifdef BITSTREAM_READER_LE #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) # define SKIP_COUNTER(name, gb, num) name##_index += (num)
#else #else
# define SKIP_COUNTER(name, gb, num) \ # 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 #endif
#define SKIP_BITS(name, gb, num) do { \ #define SKIP_BITS(name, gb, num) do { \

Loading…
Cancel
Save