get_bits: whitespace (mostly) cosmetics
[libav.git] / libavcodec / get_bits.h
CommitLineData
04d7f601
DB
1/*
2 * copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
3 *
2912e87a 4 * This file is part of Libav.
b78e7197 5 *
2912e87a 6 * Libav is free software; you can redistribute it and/or
04d7f601
DB
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
b78e7197 9 * version 2.1 of the License, or (at your option) any later version.
04d7f601 10 *
2912e87a 11 * Libav is distributed in the hope that it will be useful,
04d7f601
DB
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
2912e87a 17 * License along with Libav; if not, write to the Free Software
04d7f601
DB
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
caa336b4 21/**
ba87f080 22 * @file
9106a698 23 * bitstream reader API header.
caa336b4
MN
24 */
25
9106a698
SS
26#ifndef AVCODEC_GET_BITS_H
27#define AVCODEC_GET_BITS_H
caa336b4 28
99545457 29#include <stdint.h>
245976da
DB
30#include "libavutil/common.h"
31#include "libavutil/intreadwrite.h"
32#include "libavutil/log.h"
017c0811 33#include "mathops.h"
8fbc6aae 34
8cfbbd92
RB
35/*
36 * Safe bitstream reading:
37 * optionally, the get_bits API can check to ensure that we
38 * don't read past input buffer boundaries. This is protected
39 * with CONFIG_SAFE_BITSTREAM_READER at the global level, and
40 * then below that with UNCHECKED_BITSTREAM_READER at the per-
41 * decoder level. This means that decoders that check internally
42 * can "#define UNCHECKED_BITSTREAM_READER 1" to disable
43 * overread checks.
44 * Boundary checking causes a minor performance penalty so for
45 * applications that won't want/need this, it can be disabled
46 * globally using "#define CONFIG_SAFE_BITSTREAM_READER 0".
47 */
48#ifndef UNCHECKED_BITSTREAM_READER
49#define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
50#endif
51
caa336b4
MN
52/* bit input */
53/* buffer, buffer_end and size_in_bits must be present and used by every reader */
54typedef struct GetBitContext {
55 const uint8_t *buffer, *buffer_end;
caa336b4 56 int index;
caa336b4 57 int size_in_bits;
8cfbbd92
RB
58#if !UNCHECKED_BITSTREAM_READER
59 int size_in_bits_plus8;
60#endif
caa336b4
MN
61} GetBitContext;
62
63#define VLC_TYPE int16_t
64
65typedef struct VLC {
66 int bits;
67 VLC_TYPE (*table)[2]; ///< code, bits
68 int table_size, table_allocated;
69} VLC;
70
71typedef struct RL_VLC_ELEM {
72 int16_t level;
73 int8_t len;
74 uint8_t run;
75} RL_VLC_ELEM;
76
caa336b4
MN
77/* Bitstream reader API docs:
78name
7a7c4a7b 79 arbitrary name which is used as prefix for the internal variables
caa336b4
MN
80
81gb
82 getbitcontext
83
84OPEN_READER(name, gb)
58c42af7 85 load gb into local variables
caa336b4
MN
86
87CLOSE_READER(name, gb)
58c42af7 88 store local vars in gb
caa336b4
MN
89
90UPDATE_CACHE(name, gb)
58c42af7 91 refill the internal cache from the bitstream
caa336b4
MN
92 after this call at least MIN_CACHE_BITS will be available,
93
94GET_CACHE(name, gb)
95 will output the contents of the internal cache, next bit is MSB of 32 or 64 bit (FIXME 64bit)
96
97SHOW_UBITS(name, gb, num)
bb628dae 98 will return the next num bits
caa336b4
MN
99
100SHOW_SBITS(name, gb, num)
bb628dae 101 will return the next num bits and do sign extension
caa336b4
MN
102
103SKIP_BITS(name, gb, num)
104 will skip over the next num bits
bb628dae 105 note, this is equivalent to SKIP_CACHE; SKIP_COUNTER
caa336b4
MN
106
107SKIP_CACHE(name, gb, num)
108 will remove the next num bits from the cache (note SKIP_COUNTER MUST be called before UPDATE_CACHE / CLOSE_READER)
109
110SKIP_COUNTER(name, gb, num)
111 will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS)
112
113LAST_SKIP_CACHE(name, gb, num)
114 will remove the next num bits from the cache if it is needed for UPDATE_CACHE otherwise it will do nothing
115
116LAST_SKIP_BITS(name, gb, num)
6249c33e 117 is equivalent to LAST_SKIP_CACHE; SKIP_COUNTER
caa336b4
MN
118
119for examples see get_bits, show_bits, skip_bits, get_vlc
120*/
121
a1e98f19
MR
122#ifdef LONG_BITSTREAM_READER
123# define MIN_CACHE_BITS 32
124#else
caa336b4 125# define MIN_CACHE_BITS 25
a1e98f19 126#endif
caa336b4 127
e42bb0ee 128#define OPEN_READER(name, gb) \
fb5c841d 129 unsigned int name##_index = (gb)->index; \
e01e05ee 130 unsigned int av_unused name##_cache = 0
caa336b4 131
e42bb0ee
MR
132#define CLOSE_READER(name, gb) (gb)->index = name##_index
133
134#ifdef ALT_BITSTREAM_READER_LE
caa336b4 135
a1e98f19 136# ifdef LONG_BITSTREAM_READER
e42bb0ee
MR
137# define UPDATE_CACHE(name, gb) name##_cache = \
138 AV_RL64((gb)->buffer + (name##_index >> 3)) >> (name##_index & 7)
a1e98f19 139# else
e42bb0ee
MR
140# define UPDATE_CACHE(name, gb) name##_cache = \
141 AV_RL32((gb)->buffer + (name##_index >> 3)) >> (name##_index & 7)
a1e98f19 142# endif
cea27ac7 143
e42bb0ee
MR
144# define SKIP_CACHE(name, gb, num) name##_cache >>= (num)
145
146#else
147
a1e98f19 148# ifdef LONG_BITSTREAM_READER
e42bb0ee
MR
149# define UPDATE_CACHE(name, gb) name##_cache = \
150 AV_RB64((gb)->buffer + (name##_index >> 3)) >> (32 - (name##_index & 7))
a1e98f19 151# else
e42bb0ee
MR
152# define UPDATE_CACHE(name, gb) name##_cache = \
153 AV_RB32((gb)->buffer + (name##_index >> 3)) << (name##_index & 7)
a1e98f19 154# endif
caa336b4 155
e42bb0ee
MR
156# define SKIP_CACHE(name, gb, num) name##_cache <<= (num)
157
158#endif
caa336b4
MN
159
160// FIXME name?
8cfbbd92 161#if UNCHECKED_BITSTREAM_READER
fb5c841d 162# define SKIP_COUNTER(name, gb, num) name##_index += (num)
8cfbbd92
RB
163#else
164# define SKIP_COUNTER(name, gb, num) \
165 name##_index = FFMIN((gb)->size_in_bits_plus8, name##_index + (num))
166#endif
caa336b4 167
e42bb0ee 168#define SKIP_BITS(name, gb, num) do { \
fb5c841d
MR
169 SKIP_CACHE(name, gb, num); \
170 SKIP_COUNTER(name, gb, num); \
171 } while (0)
caa336b4 172
e42bb0ee
MR
173#define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num)
174#define LAST_SKIP_CACHE(name, gb, num)
caa336b4 175
e42bb0ee 176#ifdef ALT_BITSTREAM_READER_LE
fb5c841d 177# define SHOW_UBITS(name, gb, num) zero_extend(name##_cache, num)
fb5c841d 178# define SHOW_SBITS(name, gb, num) sign_extend(name##_cache, num)
e42bb0ee 179#else
fb5c841d 180# define SHOW_UBITS(name, gb, num) NEG_USR32(name##_cache, num)
fb5c841d 181# define SHOW_SBITS(name, gb, num) NEG_SSR32(name##_cache, num)
e42bb0ee 182#endif
caa336b4 183
e42bb0ee 184#define GET_CACHE(name, gb) ((uint32_t)name##_cache)
caa336b4 185
e42bb0ee
MR
186static inline int get_bits_count(const GetBitContext *s)
187{
caa336b4
MN
188 return s->index;
189}
5a7bd283
MN
190
191static inline void skip_bits_long(GetBitContext *s, int n){
8cfbbd92 192#if UNCHECKED_BITSTREAM_READER
6e4703ca 193 s->index += n;
8cfbbd92
RB
194#else
195 s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);
196#endif
5a7bd283
MN
197}
198
caa336b4
MN
199/**
200 * read mpeg1 dc style vlc (sign bit + mantisse with no MSB).
115329f1 201 * if MSB not set it is negative
caa336b4 202 * @param n length in bits
115329f1 203 * @author BERO
caa336b4 204 */
e42bb0ee
MR
205static inline int get_xbits(GetBitContext *s, int n)
206{
6b250e47 207 register int sign;
caa336b4 208 register int32_t cache;
bf5f9b52
MR
209 OPEN_READER(re, s);
210 UPDATE_CACHE(re, s);
fb5c841d
MR
211 cache = GET_CACHE(re, s);
212 sign = ~cache >> 31;
bf5f9b52
MR
213 LAST_SKIP_BITS(re, s, n);
214 CLOSE_READER(re, s);
6b250e47 215 return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
caa336b4
MN
216}
217
e42bb0ee
MR
218static inline int get_sbits(GetBitContext *s, int n)
219{
caa336b4 220 register int tmp;
bf5f9b52
MR
221 OPEN_READER(re, s);
222 UPDATE_CACHE(re, s);
fb5c841d 223 tmp = SHOW_SBITS(re, s, n);
bf5f9b52
MR
224 LAST_SKIP_BITS(re, s, n);
225 CLOSE_READER(re, s);
caa336b4
MN
226 return tmp;
227}
228
229/**
938f72e1 230 * Read 1-25 bits.
caa336b4 231 */
e42bb0ee
MR
232static inline unsigned int get_bits(GetBitContext *s, int n)
233{
caa336b4 234 register int tmp;
bf5f9b52
MR
235 OPEN_READER(re, s);
236 UPDATE_CACHE(re, s);
fb5c841d 237 tmp = SHOW_UBITS(re, s, n);
bf5f9b52
MR
238 LAST_SKIP_BITS(re, s, n);
239 CLOSE_READER(re, s);
caa336b4
MN
240 return tmp;
241}
242
caa336b4 243/**
58c42af7 244 * Show 1-25 bits.
caa336b4 245 */
e42bb0ee
MR
246static inline unsigned int show_bits(GetBitContext *s, int n)
247{
caa336b4 248 register int tmp;
bf5f9b52
MR
249 OPEN_READER(re, s);
250 UPDATE_CACHE(re, s);
fb5c841d 251 tmp = SHOW_UBITS(re, s, n);
caa336b4
MN
252 return tmp;
253}
254
e42bb0ee
MR
255static inline void skip_bits(GetBitContext *s, int n)
256{
caa336b4 257 //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
bf5f9b52
MR
258 OPEN_READER(re, s);
259 UPDATE_CACHE(re, s);
260 LAST_SKIP_BITS(re, s, n);
261 CLOSE_READER(re, s);
caa336b4
MN
262}
263
e42bb0ee
MR
264static inline unsigned int get_bits1(GetBitContext *s)
265{
fb5c841d
MR
266 unsigned int index = s->index;
267 uint8_t result = s->buffer[index>>3];
cea27ac7 268#ifdef ALT_BITSTREAM_READER_LE
fb5c841d
MR
269 result >>= index & 7;
270 result &= 1;
cea27ac7 271#else
fb5c841d
MR
272 result <<= index & 7;
273 result >>= 8 - 1;
cea27ac7 274#endif
8cfbbd92
RB
275#if !UNCHECKED_BITSTREAM_READER
276 if (s->index < s->size_in_bits_plus8)
277#endif
278 index++;
fb5c841d 279 s->index = index;
caa336b4
MN
280
281 return result;
caa336b4
MN
282}
283
e42bb0ee
MR
284static inline unsigned int show_bits1(GetBitContext *s)
285{
caa336b4
MN
286 return show_bits(s, 1);
287}
288
e42bb0ee
MR
289static inline void skip_bits1(GetBitContext *s)
290{
caa336b4
MN
291 skip_bits(s, 1);
292}
293
294/**
58c42af7 295 * Read 0-32 bits.
8fbc6aae 296 */
e42bb0ee
MR
297static inline unsigned int get_bits_long(GetBitContext *s, int n)
298{
299 if (n <= MIN_CACHE_BITS)
300 return get_bits(s, n);
fb5c841d 301 else {
d1121caa 302#ifdef ALT_BITSTREAM_READER_LE
fb5c841d 303 int ret = get_bits(s, 16);
d1121caa
RD
304 return ret | (get_bits(s, n-16) << 16);
305#else
fb5c841d 306 int ret = get_bits(s, 16) << (n-16);
8fbc6aae 307 return ret | get_bits(s, n-16);
d1121caa 308#endif
8fbc6aae
AJ
309 }
310}
311
312/**
58c42af7 313 * Read 0-32 bits as a signed integer.
017c0811 314 */
e42bb0ee
MR
315static inline int get_sbits_long(GetBitContext *s, int n)
316{
017c0811
JR
317 return sign_extend(get_bits_long(s, n), n);
318}
319
320/**
58c42af7 321 * Show 0-32 bits.
8fbc6aae 322 */
e42bb0ee
MR
323static inline unsigned int show_bits_long(GetBitContext *s, int n)
324{
325 if (n <= MIN_CACHE_BITS)
326 return show_bits(s, n);
fb5c841d
MR
327 else {
328 GetBitContext gb = *s;
edd532db 329 return get_bits_long(&gb, n);
8fbc6aae
AJ
330 }
331}
332
333static inline int check_marker(GetBitContext *s, const char *msg)
334{
fb5c841d
MR
335 int bit = get_bits1(s);
336 if (!bit)
8fbc6aae
AJ
337 av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
338
339 return bit;
340}
341
342/**
58c42af7 343 * Inititalize GetBitContext.
be73d76b 344 * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger than the actual read bits
caa336b4
MN
345 * because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
346 * @param bit_size the size of the buffer in bits
17f0c3be
RD
347 *
348 * While GetBitContext stores the buffer size, for performance reasons you are
349 * responsible for checking for the buffer end yourself (take advantage of the padding)!
caa336b4 350 */
e42bb0ee
MR
351static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
352 int bit_size)
caa336b4 353{
fb5c841d
MR
354 int buffer_size = (bit_size+7)>>3;
355 if (buffer_size < 0 || bit_size < 0) {
288f1e68
MB
356 buffer_size = bit_size = 0;
357 buffer = NULL;
358 }
caa336b4 359
fb5c841d
MR
360 s->buffer = buffer;
361 s->size_in_bits = bit_size;
8cfbbd92
RB
362#if !UNCHECKED_BITSTREAM_READER
363 s->size_in_bits_plus8 = bit_size + 8;
364#endif
fb5c841d 365 s->buffer_end = buffer + buffer_size;
fb5c841d 366 s->index = 0;
caa336b4
MN
367}
368
ae5e7e7f 369static inline void align_get_bits(GetBitContext *s)
5a7bd283 370{
fb5c841d
MR
371 int n = -get_bits_count(s) & 7;
372 if (n) skip_bits(s, n);
5a7bd283
MN
373}
374
fb5c841d
MR
375#define init_vlc(vlc, nb_bits, nb_codes, \
376 bits, bits_wrap, bits_size, \
377 codes, codes_wrap, codes_size, \
378 flags) \
379 init_vlc_sparse(vlc, nb_bits, nb_codes, \
380 bits, bits_wrap, bits_size, \
381 codes, codes_wrap, codes_size, \
382 NULL, 0, 0, flags)
b613bacc
LM
383
384int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
caa336b4
MN
385 const void *bits, int bits_wrap, int bits_size,
386 const void *codes, int codes_wrap, int codes_size,
b613bacc 387 const void *symbols, int symbols_wrap, int symbols_size,
cea27ac7 388 int flags);
cea27ac7 389#define INIT_VLC_LE 2
ccc54864 390#define INIT_VLC_USE_NEW_STATIC 4
caa336b4
MN
391void free_vlc(VLC *vlc);
392
fb5c841d
MR
393#define INIT_VLC_STATIC(vlc, bits, a,b,c,d,e,f,g, static_size) do { \
394 static VLC_TYPE table[static_size][2]; \
395 (vlc)->table = table; \
396 (vlc)->table_allocated = static_size; \
397 init_vlc(vlc, bits, a,b,c,d,e,f,g, INIT_VLC_USE_NEW_STATIC); \
398 } while (0)
d05b24ff
MN
399
400
caa336b4 401/**
fd10543e
AC
402 * If the vlc code is invalid and max_depth=1, then no bits will be removed.
403 * If the vlc code is invalid and max_depth>1, then the number of bits removed
404 * is undefined.
caa336b4 405 */
e42bb0ee
MR
406#define GET_VLC(code, name, gb, table, bits, max_depth) \
407 do { \
fb5c841d
MR
408 int n, nb_bits; \
409 unsigned int index; \
410 \
411 index = SHOW_UBITS(name, gb, bits); \
412 code = table[index][0]; \
413 n = table[index][1]; \
414 \
415 if (max_depth > 1 && n < 0) { \
416 LAST_SKIP_BITS(name, gb, bits); \
417 UPDATE_CACHE(name, gb); \
418 \
419 nb_bits = -n; \
420 \
421 index = SHOW_UBITS(name, gb, nb_bits) + code; \
422 code = table[index][0]; \
423 n = table[index][1]; \
424 if (max_depth > 2 && n < 0) { \
425 LAST_SKIP_BITS(name, gb, nb_bits); \
426 UPDATE_CACHE(name, gb); \
427 \
428 nb_bits = -n; \
429 \
430 index = SHOW_UBITS(name, gb, nb_bits) + code; \
431 code = table[index][0]; \
432 n = table[index][1]; \
433 } \
434 } \
435 SKIP_BITS(name, gb, n); \
436 } while (0)
437
e42bb0ee
MR
438#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update) \
439 do { \
fb5c841d
MR
440 int n, nb_bits; \
441 unsigned int index; \
442 \
443 index = SHOW_UBITS(name, gb, bits); \
444 level = table[index].level; \
445 n = table[index].len; \
446 \
447 if (max_depth > 1 && n < 0) { \
448 SKIP_BITS(name, gb, bits); \
449 if (need_update) { \
450 UPDATE_CACHE(name, gb); \
451 } \
452 \
453 nb_bits = -n; \
454 \
455 index = SHOW_UBITS(name, gb, nb_bits) + level; \
456 level = table[index].level; \
457 n = table[index].len; \
458 } \
459 run = table[index].run; \
460 SKIP_BITS(name, gb, n); \
461 } while (0)
caa336b4 462
caa336b4
MN
463
464/**
58c42af7 465 * Parse a vlc code, faster than get_vlc().
115329f1 466 * @param bits is the number of bits which will be read at once, must be
caa336b4 467 * identical to nb_bits in init_vlc()
e42dba48 468 * @param max_depth is the number of times bits bits must be read to completely
115329f1 469 * read the longest vlc code
caa336b4
MN
470 * = (max_vlc_length + bits - 1) / bits
471 */
849f1035 472static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
e42bb0ee 473 int bits, int max_depth)
caa336b4
MN
474{
475 int code;
115329f1 476
bf5f9b52
MR
477 OPEN_READER(re, s);
478 UPDATE_CACHE(re, s);
caa336b4 479
bf5f9b52 480 GET_VLC(code, re, s, table, bits, max_depth);
caa336b4 481
bf5f9b52 482 CLOSE_READER(re, s);
caa336b4
MN
483 return code;
484}
485
e42bb0ee
MR
486static inline int decode012(GetBitContext *gb)
487{
611a6f59
MR
488 int n;
489 n = get_bits1(gb);
490 if (n == 0)
491 return 0;
492 else
493 return get_bits1(gb) + 1;
494}
495
e42bb0ee
MR
496static inline int decode210(GetBitContext *gb)
497{
611a6f59
MR
498 if (get_bits1(gb))
499 return 0;
500 else
501 return 2 - get_bits1(gb);
502}
503
504static inline int get_bits_left(GetBitContext *gb)
505{
506 return gb->size_in_bits - get_bits_count(gb);
507}
508
caa336b4
MN
509//#define TRACE
510
511#ifdef TRACE
e42bb0ee
MR
512static inline void print_bin(int bits, int n)
513{
caa336b4 514 int i;
115329f1 515
fb5c841d 516 for (i = n-1; i >= 0; i--) {
61f040dd 517 av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
caa336b4 518 }
fb5c841d 519 for (i = n; i < 24; i++)
61f040dd 520 av_log(NULL, AV_LOG_DEBUG, " ");
caa336b4
MN
521}
522
fb5c841d 523static inline int get_bits_trace(GetBitContext *s, int n, char *file,
e42bb0ee
MR
524 const char *func, int line)
525{
fb5c841d 526 int r = get_bits(s, n);
115329f1 527
caa336b4 528 print_bin(r, n);
fb5c841d
MR
529 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n",
530 r, n, r, get_bits_count(s)-n, file, func, line);
caa336b4
MN
531 return r;
532}
fb5c841d
MR
533static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2],
534 int bits, int max_depth, char *file,
e42bb0ee
MR
535 const char *func, int line)
536{
fb5c841d
MR
537 int show = show_bits(s, 24);
538 int pos = get_bits_count(s);
539 int r = get_vlc2(s, table, bits, max_depth);
540 int len = get_bits_count(s) - pos;
541 int bits2 = show >> (24-len);
115329f1 542
caa336b4 543 print_bin(bits2, len);
115329f1 544
fb5c841d
MR
545 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n",
546 bits2, len, r, pos, file, func, line);
caa336b4
MN
547 return r;
548}
fb5c841d 549static inline int get_xbits_trace(GetBitContext *s, int n, char *file,
e42bb0ee
MR
550 const char *func, int line)
551{
fb5c841d
MR
552 int show = show_bits(s, n);
553 int r = get_xbits(s, n);
115329f1 554
caa336b4 555 print_bin(show, n);
fb5c841d
MR
556 av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n",
557 show, n, r, get_bits_count(s)-n, file, func, line);
caa336b4
MN
558 return r;
559}
560
561#define get_bits(s, n) get_bits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
562#define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__)
563#define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__)
564#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
565#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
566
a9c9a240 567#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
caa336b4
MN
568
569#else //TRACE
a9c9a240 570#define tprintf(p, ...) {}
caa336b4
MN
571#endif
572
9106a698 573#endif /* AVCODEC_GET_BITS_H */