Go to the documentation of this file.
41 #ifndef AVCODEC_BITSTREAM_H
42 #define AVCODEC_BITSTREAM_H
56 #ifndef UNCHECKED_BITSTREAM_READER
57 #define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER
61 #if defined(BITSTREAM_LE) && defined(BITSTREAM_BE)
63 # if defined(BITSTREAM_DEFAULT_BE) && defined(BITSTREAM_DEFAULT_LE)
64 # error "At most one of BITSTREAM_DEFAULT_BE/LE must be defined"
65 # elif defined(BITSTREAM_DEFAULT_BE)
66 # define BITS_DEFAULT_BE
67 # elif defined(BITSTREAM_DEFAULT_LE)
68 # define BITS_DEFAULT_LE
71 #elif defined(BITSTREAM_LE)
72 # define BITS_DEFAULT_LE
73 #else // select BE if nothing is requested explicitly
74 # define BITS_DEFAULT_BE
75 # define BITSTREAM_WANT_BE
78 #if defined(BITS_DEFAULT_LE)
80 # define BitstreamContext BitstreamContextLE
81 # define bits_init bits_init_le
82 # define bits_init8 bits_init8_le
83 # define bits_tell bits_tell_le
84 # define bits_size bits_size_le
85 # define bits_left bits_left_le
86 # define bits_read_bit bits_read_bit_le
87 # define bits_read_nz bits_read_nz_le
88 # define bits_read bits_read_le
89 # define bits_read_63 bits_read_63_le
90 # define bits_read_64 bits_read_64_le
91 # define bits_read_signed bits_read_signed_le
92 # define bits_read_signed_nz bits_read_signed_nz_le
93 # define bits_peek_nz bits_peek_nz_le
94 # define bits_peek bits_peek_le
95 # define bits_peek_signed bits_peek_signed_le
96 # define bits_peek_signed_nz bits_peek_signed_nz_le
97 # define bits_skip bits_skip_le
98 # define bits_seek bits_seek_le
99 # define bits_align bits_align_le
100 # define bits_read_xbits bits_read_xbits_le
101 # define bits_decode012 bits_decode012_le
102 # define bits_decode210 bits_decode210_le
103 # define bits_apply_sign bits_apply_sign_le
104 # define bits_read_vlc bits_read_vlc_le
106 #elif defined(BITS_DEFAULT_BE)
108 # define BitstreamContext BitstreamContextBE
109 # define bits_init bits_init_be
110 # define bits_init8 bits_init8_be
111 # define bits_tell bits_tell_be
112 # define bits_size bits_size_be
113 # define bits_left bits_left_be
114 # define bits_read_bit bits_read_bit_be
115 # define bits_read_nz bits_read_nz_be
116 # define bits_read bits_read_be
117 # define bits_read_63 bits_read_63_be
118 # define bits_read_64 bits_read_64_be
119 # define bits_read_signed bits_read_signed_be
120 # define bits_read_signed_nz bits_read_signed_nz_be
121 # define bits_peek_nz bits_peek_nz_be
122 # define bits_peek bits_peek_be
123 # define bits_peek_signed bits_peek_signed_be
124 # define bits_peek_signed_nz bits_peek_signed_nz_be
125 # define bits_skip bits_skip_be
126 # define bits_seek bits_seek_be
127 # define bits_align bits_align_be
128 # define bits_read_xbits bits_read_xbits_be
129 # define bits_decode012 bits_decode012_be
130 # define bits_decode210 bits_decode210_be
131 # define bits_apply_sign bits_apply_sign_be
132 # define bits_read_vlc bits_read_vlc_be
136 #undef BITS_DEFAULT_LE
137 #undef BITS_DEFAULT_BE
139 #define BITS_RL_VLC(level, run, bc, table, bits, max_depth) \
142 unsigned int index = bits_peek(bc, bits); \
143 level = table[index].level; \
144 n = table[index].len; \
146 if (max_depth > 1 && n < 0) { \
147 bits_skip(bc, bits); \
151 index = bits_peek(bc, nb_bits) + level; \
152 level = table[index].level; \
153 n = table[index].len; \
154 if (max_depth > 2 && n < 0) { \
155 bits_skip(bc, nb_bits); \
158 index = bits_peek(bc, nb_bits) + level; \
159 level = table[index].level; \
160 n = table[index].len; \
163 run = table[index].run; \
171 #if defined(BITSTREAM_LE) && !defined(BITSTREAM_WANT_LE)
172 # define BITSTREAM_WANT_LE
175 #if defined(BITSTREAM_BE) && !defined(BITSTREAM_WANT_BE)
176 # define BITSTREAM_WANT_BE
179 #if defined(BITSTREAM_WANT_LE) && !defined(AVCODEC_BITSTREAM_LE)
180 #define AVCODEC_BITSTREAM_LE
182 #define BITSTREAM_TEMPLATE_LE
184 #undef BITSTREAM_TEMPLATE_LE
188 #if defined(BITSTREAM_WANT_BE) && !defined(AVCODEC_BITSTREAM_BE)
189 #define AVCODEC_BITSTREAM_BE
195 #undef BITSTREAM_WANT_LE
196 #undef BITSTREAM_WANT_BE