3 * bitstream api header.
9 //#define ALT_BITSTREAM_WRITER
10 //#define ALIGNED_BITSTREAM_WRITER
12 #define ALT_BITSTREAM_READER
13 //#define LIBMPEG2_BITSTREAM_READER
14 //#define A32_BITSTREAM_READER
15 #define LIBMPEG2_BITSTREAM_READER_HACK //add BERO
17 extern const uint8_t ff_reverse
[256];
19 #if defined(ARCH_X86) || defined(ARCH_X86_64)
20 // avoid +32 for shift optimization (gcc should do that ...)
21 static inline int32_t NEG_SSR32( int32_t a
, int8_t s
){
22 asm ("sarl %1, %0\n\t"
24 : "ic" ((uint8_t)(-s
))
28 static inline uint32_t NEG_USR32(uint32_t a
, int8_t s
){
29 asm ("shrl %1, %0\n\t"
31 : "ic" ((uint8_t)(-s
))
36 # define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s)))
37 # define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
42 /* buf and buf_end must be present and used by every alternative writer. */
43 typedef struct PutBitContext
{
44 #ifdef ALT_BITSTREAM_WRITER
45 uint8_t *buf
, *buf_end
;
50 uint8_t *buf
, *buf_ptr
, *buf_end
;
54 static inline void init_put_bits(PutBitContext
*s
, uint8_t *buffer
, int buffer_size
)
62 s
->buf_end
= s
->buf
+ buffer_size
;
63 #ifdef ALT_BITSTREAM_WRITER
65 ((uint32_t*)(s
->buf
))[0]=0;
66 // memset(buffer, 0, buffer_size);
74 /* return the number of bits output */
75 static inline int put_bits_count(PutBitContext
*s
)
77 #ifdef ALT_BITSTREAM_WRITER
80 return (s
->buf_ptr
- s
->buf
) * 8 + 32 - s
->bit_left
;
84 /* pad the end of the output stream with zeros */
85 static inline void flush_put_bits(PutBitContext
*s
)
87 #ifdef ALT_BITSTREAM_WRITER
90 s
->bit_buf
<<= s
->bit_left
;
91 while (s
->bit_left
< 32) {
92 /* XXX: should test end of buffer */
93 *s
->buf_ptr
++=s
->bit_buf
>> 24;
102 void align_put_bits(PutBitContext
*s
);
103 void ff_put_string(PutBitContext
* pbc
, char *s
, int put_zero
);
106 /* buffer, buffer_end and size_in_bits must be present and used by every reader */
107 typedef struct GetBitContext
{
108 const uint8_t *buffer
, *buffer_end
;
109 #ifdef ALT_BITSTREAM_READER
111 #elif defined LIBMPEG2_BITSTREAM_READER
115 #elif defined A32_BITSTREAM_READER
116 uint32_t *buffer_ptr
;
124 #define VLC_TYPE int16_t
128 VLC_TYPE (*table
)[2]; ///< code, bits
129 int table_size
, table_allocated
;
132 typedef struct RL_VLC_ELEM
{
138 #if defined(ARCH_SPARC) || defined(ARCH_ARMV4L)
139 #define UNALIGNED_STORES_ARE_BAD
142 /* used to avoid missaligned exceptions on some archs (alpha, ...) */
143 #if defined(ARCH_X86) || defined(ARCH_X86_64)
144 # define unaligned16(a) (*(const uint16_t*)(a))
145 # define unaligned32(a) (*(const uint32_t*)(a))
146 # define unaligned64(a) (*(const uint64_t*)(a))
149 # define unaligned(x) \
150 static inline uint##x##_t unaligned##x(const void *v) { \
153 } __attribute__((packed)); \
155 return ((const struct Unaligned *) v)->i; \
157 # elif defined(__DECC)
158 # define unaligned(x) \
159 static inline uint##x##_t unaligned##x##(const void *v) { \
160 return *(const __unaligned uint##x##_t *) v; \
163 # define unaligned(x) \
164 static inline uint##x##_t unaligned##x##(const void *v) { \
165 return *(const uint##x##_t *) v; \
174 #ifndef ALT_BITSTREAM_WRITER
175 static inline void put_bits(PutBitContext
*s
, int n
, unsigned int value
)
177 unsigned int bit_buf
;
181 st_out_bit_counts
[st_current_index
] += n
;
183 // printf("put_bits=%d %x\n", n, value);
184 assert(n
== 32 || value
< (1U << n
));
186 bit_buf
= s
->bit_buf
;
187 bit_left
= s
->bit_left
;
189 // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
192 bit_buf
= (bit_buf
<<n
) | value
;
196 bit_buf
|= value
>> (n
- bit_left
);
197 #ifdef UNALIGNED_STORES_ARE_BAD
198 if (3 & (intptr_t) s
->buf_ptr
) {
199 s
->buf_ptr
[0] = bit_buf
>> 24;
200 s
->buf_ptr
[1] = bit_buf
>> 16;
201 s
->buf_ptr
[2] = bit_buf
>> 8;
202 s
->buf_ptr
[3] = bit_buf
;
205 *(uint32_t *)s
->buf_ptr
= be2me_32(bit_buf
);
206 //printf("bitbuf = %08x\n", bit_buf);
212 s
->bit_buf
= bit_buf
;
213 s
->bit_left
= bit_left
;
218 #ifdef ALT_BITSTREAM_WRITER
219 static inline void put_bits(PutBitContext
*s
, int n
, unsigned int value
)
221 # ifdef ALIGNED_BITSTREAM_WRITER
222 # if defined(ARCH_X86) || defined(ARCH_X86_64)
224 "movl %0, %%ecx \n\t"
225 "xorl %%eax, %%eax \n\t"
226 "shrdl %%cl, %1, %%eax \n\t"
228 "movl %0, %%ecx \n\t"
229 "shrl $3, %%ecx \n\t"
230 "andl $0xFFFFFFFC, %%ecx \n\t"
232 "orl %1, (%2, %%ecx) \n\t"
235 "movl %%eax, 4(%2, %%ecx) \n\t"
236 : "=&r" (s
->index
), "=&r" (value
)
237 : "r" (s
->buf
), "r" (n
), "0" (s
->index
), "1" (value
<<(-n
))
242 uint32_t *ptr
= ((uint32_t *)s
->buf
)+(index
>>5);
246 ptr
[0] |= be2me_32(value
>>(index
&31));
247 ptr
[1] = be2me_32(value
<<(32-(index
&31)));
248 //if(n>24) printf("%d %d\n", n, value);
252 # else //ALIGNED_BITSTREAM_WRITER
253 # if defined(ARCH_X86) || defined(ARCH_X86_64)
255 "movl $7, %%ecx \n\t"
256 "andl %0, %%ecx \n\t"
257 "addl %3, %%ecx \n\t"
261 "movl %0, %%ecx \n\t"
262 "shrl $3, %%ecx \n\t"
263 "orl %1, (%%ecx, %2) \n\t"
265 "movl $0, 4(%%ecx, %2) \n\t"
266 : "=&r" (s
->index
), "=&r" (value
)
267 : "r" (s
->buf
), "r" (n
), "0" (s
->index
), "1" (value
)
272 uint32_t *ptr
= (uint32_t*)(((uint8_t *)s
->buf
)+(index
>>3));
274 ptr
[0] |= be2me_32(value
<<(32-n
-(index
&7) ));
276 //if(n>24) printf("%d %d\n", n, value);
280 # endif //!ALIGNED_BITSTREAM_WRITER
285 static inline uint8_t* pbBufPtr(PutBitContext
*s
)
287 #ifdef ALT_BITSTREAM_WRITER
288 return s
->buf
+ (s
->index
>>3);
296 * PutBitContext must be flushed & aligned to a byte boundary before calling this.
298 static inline void skip_put_bytes(PutBitContext
*s
, int n
){
299 assert((put_bits_count(s
)&7)==0);
300 #ifdef ALT_BITSTREAM_WRITER
301 FIXME may need some cleaning of the buffer
304 assert(s
->bit_left
==32);
310 * skips the given number of bits.
311 * must only be used if the actual values in the bitstream dont matter
313 static inline void skip_put_bits(PutBitContext
*s
, int n
){
314 #ifdef ALT_BITSTREAM_WRITER
318 s
->buf_ptr
-= s
->bit_left
>>5;
324 * Changes the end of the buffer.
326 static inline void set_put_bits_buffer_size(PutBitContext
*s
, int size
){
327 s
->buf_end
= s
->buf
+ size
;
330 /* Bitstream reader API docs:
332 abritary name which is used as prefix for the internal variables
337 OPEN_READER(name, gb)
338 loads gb into local variables
340 CLOSE_READER(name, gb)
341 stores local vars in gb
343 UPDATE_CACHE(name, gb)
344 refills the internal cache from the bitstream
345 after this call at least MIN_CACHE_BITS will be available,
348 will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit)
350 SHOW_UBITS(name, gb, num)
351 will return the next num bits
353 SHOW_SBITS(name, gb, num)
354 will return the next num bits and do sign extension
356 SKIP_BITS(name, gb, num)
357 will skip over the next num bits
358 note, this is equivalent to SKIP_CACHE; SKIP_COUNTER
360 SKIP_CACHE(name, gb, num)
361 will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER)
363 SKIP_COUNTER(name, gb, num)
364 will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS)
366 LAST_SKIP_CACHE(name, gb, num)
367 will remove the next num bits from the cache if it is needed for UPDATE_CACHE otherwise it will do nothing
369 LAST_SKIP_BITS(name, gb, num)
370 is equivalent to SKIP_LAST_CACHE; SKIP_COUNTER
372 for examples see get_bits, show_bits, skip_bits, get_vlc
375 static inline int unaligned32_be(const void *v
)
379 return (((p
[0]<<8) | p
[1])<<16) | (p
[2]<<8) | (p
[3]);
381 return be2me_32( unaligned32(v
)); //original
385 static inline int unaligned32_le(const void *v
)
389 return (((p
[3]<<8) | p
[2])<<16) | (p
[1]<<8) | (p
[0]);
391 return le2me_32( unaligned32(v
)); //original
395 #ifdef ALT_BITSTREAM_READER
396 # define MIN_CACHE_BITS 25
398 # define OPEN_READER(name, gb)\
399 int name##_index= (gb)->index;\
400 int name##_cache= 0;\
402 # define CLOSE_READER(name, gb)\
403 (gb)->index= name##_index;\
405 # ifdef ALT_BITSTREAM_READER_LE
406 # define UPDATE_CACHE(name, gb)\
407 name##_cache= unaligned32_le( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) >> (name##_index&0x07);\
409 # define SKIP_CACHE(name, gb, num)\
410 name##_cache >>= (num);
412 # define UPDATE_CACHE(name, gb)\
413 name##_cache= unaligned32_be( ((const uint8_t *)(gb)->buffer)+(name##_index>>3) ) << (name##_index&0x07);\
415 # define SKIP_CACHE(name, gb, num)\
416 name##_cache <<= (num);
420 # define SKIP_COUNTER(name, gb, num)\
421 name##_index += (num);\
423 # define SKIP_BITS(name, gb, num)\
425 SKIP_CACHE(name, gb, num)\
426 SKIP_COUNTER(name, gb, num)\
429 # define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
430 # define LAST_SKIP_CACHE(name, gb, num) ;
432 # ifdef ALT_BITSTREAM_READER_LE
433 # define SHOW_UBITS(name, gb, num)\
434 ((name##_cache) & (NEG_USR32(0xffffffff,num)))
436 # define SHOW_UBITS(name, gb, num)\
437 NEG_USR32(name##_cache, num)
440 # define SHOW_SBITS(name, gb, num)\
441 NEG_SSR32(name##_cache, num)
443 # define GET_CACHE(name, gb)\
444 ((uint32_t)name##_cache)
446 static inline int get_bits_count(GetBitContext
*s
){
449 #elif defined LIBMPEG2_BITSTREAM_READER
450 //libmpeg2 like reader
452 # define MIN_CACHE_BITS 17
454 # define OPEN_READER(name, gb)\
455 int name##_bit_count=(gb)->bit_count;\
456 int name##_cache= (gb)->cache;\
457 uint8_t * name##_buffer_ptr=(gb)->buffer_ptr;\
459 # define CLOSE_READER(name, gb)\
460 (gb)->bit_count= name##_bit_count;\
461 (gb)->cache= name##_cache;\
462 (gb)->buffer_ptr= name##_buffer_ptr;\
464 #ifdef LIBMPEG2_BITSTREAM_READER_HACK
466 # define UPDATE_CACHE(name, gb)\
467 if(name##_bit_count >= 0){\
468 name##_cache+= (int)be2me_16(*(uint16_t*)name##_buffer_ptr) << name##_bit_count;\
469 name##_buffer_ptr += 2;\
470 name##_bit_count-= 16;\
475 # define UPDATE_CACHE(name, gb)\
476 if(name##_bit_count >= 0){\
477 name##_cache+= ((name##_buffer_ptr[0]<<8) + name##_buffer_ptr[1]) << name##_bit_count;\
478 name##_buffer_ptr+=2;\
479 name##_bit_count-= 16;\
484 # define SKIP_CACHE(name, gb, num)\
485 name##_cache <<= (num);\
487 # define SKIP_COUNTER(name, gb, num)\
488 name##_bit_count += (num);\
490 # define SKIP_BITS(name, gb, num)\
492 SKIP_CACHE(name, gb, num)\
493 SKIP_COUNTER(name, gb, num)\
496 # define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
497 # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
499 # define SHOW_UBITS(name, gb, num)\
500 NEG_USR32(name##_cache, num)
502 # define SHOW_SBITS(name, gb, num)\
503 NEG_SSR32(name##_cache, num)
505 # define GET_CACHE(name, gb)\
506 ((uint32_t)name##_cache)
508 static inline int get_bits_count(GetBitContext
*s
){
509 return (s
->buffer_ptr
- s
->buffer
)*8 - 16 + s
->bit_count
;
512 #elif defined A32_BITSTREAM_READER
514 # define MIN_CACHE_BITS 32
516 # define OPEN_READER(name, gb)\
517 int name##_bit_count=(gb)->bit_count;\
518 uint32_t name##_cache0= (gb)->cache0;\
519 uint32_t name##_cache1= (gb)->cache1;\
520 uint32_t * name##_buffer_ptr=(gb)->buffer_ptr;\
522 # define CLOSE_READER(name, gb)\
523 (gb)->bit_count= name##_bit_count;\
524 (gb)->cache0= name##_cache0;\
525 (gb)->cache1= name##_cache1;\
526 (gb)->buffer_ptr= name##_buffer_ptr;\
528 # define UPDATE_CACHE(name, gb)\
529 if(name##_bit_count > 0){\
530 const uint32_t next= be2me_32( *name##_buffer_ptr );\
531 name##_cache0 |= NEG_USR32(next,name##_bit_count);\
532 name##_cache1 |= next<<name##_bit_count;\
533 name##_buffer_ptr++;\
534 name##_bit_count-= 32;\
537 #if defined(ARCH_X86) || defined(ARCH_X86_64)
538 # define SKIP_CACHE(name, gb, num)\
540 "shldl %2, %1, %0 \n\t"\
542 : "+r" (name##_cache0), "+r" (name##_cache1)\
543 : "Ic" ((uint8_t)num)\
546 # define SKIP_CACHE(name, gb, num)\
547 name##_cache0 <<= (num);\
548 name##_cache0 |= NEG_USR32(name##_cache1,num);\
549 name##_cache1 <<= (num);
552 # define SKIP_COUNTER(name, gb, num)\
553 name##_bit_count += (num);\
555 # define SKIP_BITS(name, gb, num)\
557 SKIP_CACHE(name, gb, num)\
558 SKIP_COUNTER(name, gb, num)\
561 # define LAST_SKIP_BITS(name, gb, num) SKIP_BITS(name, gb, num)
562 # define LAST_SKIP_CACHE(name, gb, num) SKIP_CACHE(name, gb, num)
564 # define SHOW_UBITS(name, gb, num)\
565 NEG_USR32(name##_cache0, num)
567 # define SHOW_SBITS(name, gb, num)\
568 NEG_SSR32(name##_cache0, num)
570 # define GET_CACHE(name, gb)\
573 static inline int get_bits_count(GetBitContext
*s
){
574 return ((uint8_t*)s
->buffer_ptr
- s
->buffer
)*8 - 32 + s
->bit_count
;
580 * read mpeg1 dc style vlc (sign bit + mantisse with no MSB).
581 * if MSB not set it is negative
582 * @param n length in bits
585 static inline int get_xbits(GetBitContext
*s
, int n
){
587 register int32_t cache
;
590 cache
= GET_CACHE(re
,s
);
592 LAST_SKIP_BITS(re
, s
, n
)
594 return (NEG_USR32(sign
^ cache
, n
) ^ sign
) - sign
;
597 static inline int get_sbits(GetBitContext
*s
, int n
){
601 tmp
= SHOW_SBITS(re
, s
, n
);
602 LAST_SKIP_BITS(re
, s
, n
)
609 * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
611 static inline unsigned int get_bits(GetBitContext
*s
, int n
){
615 tmp
= SHOW_UBITS(re
, s
, n
);
616 LAST_SKIP_BITS(re
, s
, n
)
621 unsigned int get_bits_long(GetBitContext
*s
, int n
);
625 * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
627 static inline unsigned int show_bits(GetBitContext
*s
, int n
){
631 tmp
= SHOW_UBITS(re
, s
, n
);
632 // CLOSE_READER(re, s)
636 unsigned int show_bits_long(GetBitContext
*s
, int n
);
638 static inline void skip_bits(GetBitContext
*s
, int n
){
639 //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
642 LAST_SKIP_BITS(re
, s
, n
)
646 static inline unsigned int get_bits1(GetBitContext
*s
){
647 #ifdef ALT_BITSTREAM_READER
649 uint8_t result
= s
->buffer
[ index
>>3 ];
650 #ifdef ALT_BITSTREAM_READER_LE
651 result
>>= (index
&0x07);
654 result
<<= (index
&0x07);
662 return get_bits(s
, 1);
666 static inline unsigned int show_bits1(GetBitContext
*s
){
667 return show_bits(s
, 1);
670 static inline void skip_bits1(GetBitContext
*s
){
675 * init GetBitContext.
676 * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits
677 * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
678 * @param bit_size the size of the buffer in bits
680 static inline void init_get_bits(GetBitContext
*s
,
681 const uint8_t *buffer
, int bit_size
)
683 int buffer_size
= (bit_size
+7)>>3;
684 if(buffer_size
< 0 || bit_size
< 0) {
685 buffer_size
= bit_size
= 0;
690 s
->size_in_bits
= bit_size
;
691 s
->buffer_end
= buffer
+ buffer_size
;
692 #ifdef ALT_BITSTREAM_READER
694 #elif defined LIBMPEG2_BITSTREAM_READER
695 #ifdef LIBMPEG2_BITSTREAM_READER_HACK
698 s
->cache
= (*buffer
++)<<24;
699 s
->buffer_ptr
= buffer
;
704 s
->buffer_ptr
= buffer
;
708 #elif defined A32_BITSTREAM_READER
709 s
->buffer_ptr
= (uint32_t*)buffer
;
720 #ifdef A32_BITSTREAM_READER
725 int check_marker(GetBitContext
*s
, const char *msg
);
726 void align_get_bits(GetBitContext
*s
);
727 int init_vlc(VLC
*vlc
, int nb_bits
, int nb_codes
,
728 const void *bits
, int bits_wrap
, int bits_size
,
729 const void *codes
, int codes_wrap
, int codes_size
,
731 #define INIT_VLC_USE_STATIC 1
732 #define INIT_VLC_LE 2
733 void free_vlc(VLC
*vlc
);
737 * if the vlc code is invalid and max_depth=1 than no bits will be removed
738 * if the vlc code is invalid and max_depth>1 than the number of bits removed
741 #define GET_VLC(code, name, gb, table, bits, max_depth)\
743 int n, index, nb_bits;\
745 index= SHOW_UBITS(name, gb, bits);\
746 code = table[index][0];\
747 n = table[index][1];\
749 if(max_depth > 1 && n < 0){\
750 LAST_SKIP_BITS(name, gb, bits)\
751 UPDATE_CACHE(name, gb)\
755 index= SHOW_UBITS(name, gb, nb_bits) + code;\
756 code = table[index][0];\
757 n = table[index][1];\
758 if(max_depth > 2 && n < 0){\
759 LAST_SKIP_BITS(name, gb, nb_bits)\
760 UPDATE_CACHE(name, gb)\
764 index= SHOW_UBITS(name, gb, nb_bits) + code;\
765 code = table[index][0];\
766 n = table[index][1];\
769 SKIP_BITS(name, gb, n)\
772 #define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
774 int n, index, nb_bits;\
776 index= SHOW_UBITS(name, gb, bits);\
777 level = table[index].level;\
778 n = table[index].len;\
780 if(max_depth > 1 && n < 0){\
781 SKIP_BITS(name, gb, bits)\
783 UPDATE_CACHE(name, gb)\
788 index= SHOW_UBITS(name, gb, nb_bits) + level;\
789 level = table[index].level;\
790 n = table[index].len;\
792 run= table[index].run;\
793 SKIP_BITS(name, gb, n)\
798 * parses a vlc code, faster then get_vlc()
799 * @param bits is the number of bits which will be read at once, must be
800 * identical to nb_bits in init_vlc()
801 * @param max_depth is the number of times bits bits must be readed to completly
802 * read the longest vlc code
803 * = (max_vlc_length + bits - 1) / bits
805 static always_inline
int get_vlc2(GetBitContext
*s
, VLC_TYPE (*table
)[2],
806 int bits
, int max_depth
)
813 GET_VLC(code
, re
, s
, table
, bits
, max_depth
)
823 static inline void print_bin(int bits
, int n
){
826 for(i
=n
-1; i
>=0; i
--){
827 av_log(NULL
, AV_LOG_DEBUG
, "%d", (bits
>>i
)&1);
830 av_log(NULL
, AV_LOG_DEBUG
, " ");
833 static inline int get_bits_trace(GetBitContext
*s
, int n
, char *file
, const char *func
, int line
){
834 int r
= get_bits(s
, n
);
837 av_log(NULL
, AV_LOG_DEBUG
, "%5d %2d %3d bit @%5d in %s %s:%d\n", r
, n
, r
, get_bits_count(s
)-n
, file
, func
, line
);
840 static inline int get_vlc_trace(GetBitContext
*s
, VLC_TYPE (*table
)[2], int bits
, int max_depth
, char *file
, const char *func
, int line
){
841 int show
= show_bits(s
, 24);
842 int pos
= get_bits_count(s
);
843 int r
= get_vlc2(s
, table
, bits
, max_depth
);
844 int len
= get_bits_count(s
) - pos
;
845 int bits2
= show
>>(24-len
);
847 print_bin(bits2
, len
);
849 av_log(NULL
, AV_LOG_DEBUG
, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2
, len
, r
, pos
, file
, func
, line
);
852 static inline int get_xbits_trace(GetBitContext
*s
, int n
, char *file
, const char *func
, int line
){
853 int show
= show_bits(s
, n
);
854 int r
= get_xbits(s
, n
);
857 av_log(NULL
, AV_LOG_DEBUG
, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show
, n
, r
, get_bits_count(s
)-n
, file
, func
, line
);
861 #define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
862 #define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__)
863 #define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
864 #define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
865 #define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
867 #define tprintf(...) av_log(NULL, AV_LOG_DEBUG, __VA_ARGS__)
870 #define tprintf(...) {}
873 static inline int decode012(GetBitContext
*gb
){
879 return get_bits1(gb
) + 1;
882 #endif /* BITSTREAM_H */