-#define MIN_CACHE_BITS 25
-
-/** Load \a gb into local variables. */
-#define OPEN_READER(name, gb)\
- int name##_index= (gb)->index;\
- int name##_cache= 0;\
-
-/** Store local vars in gb. */
-#define CLOSE_READER(name, gb)\
- (gb)->index= name##_index;\
-
-/**
- * Refill the internal cache from the bitstream.
- *
- * After this call at least MIN_CACHE_BITS will be available.
- */
-#define UPDATE_CACHE(name, gb)\
- name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer) \
- + (name##_index >> 3) ) << (name##_index & 0x07);\
-
-/**
- * Remove the next num bits from the cache.
- *
- * SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER).
- */
-#define SKIP_CACHE(name, gb, num)\
- name##_cache <<= (num);
-
-/**
- * Increment the internal bit counter.
- *
- * \sa SKIP_CACHE, SKIP_BITS.
- */
-#define SKIP_COUNTER(name, gb, num)\
- name##_index += (num);\
-
-/**
- * Skip over the next num bits.
- *
- * This is equivalent to SKIP_CACHE; SKIP_COUNTER.
- */
-#define SKIP_BITS(name, gb, num)\
- {\
- SKIP_CACHE(name, gb, num)\
- SKIP_COUNTER(name, gb, num)\
- }\
-
-/** This is equivalent to SKIP_LAST_CACHE; SKIP_COUNTER. */
-#define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
-
-/** Return the next num bits. */
-#define SHOW_UBITS(name, gb, num)\
- NEG_USR32(name##_cache, num)
-
-static inline int get_bits_count(struct getbit_context *s)
-{
- return s->index;
-}
-
-static inline void skip_bits_long(struct getbit_context *s, int n)