92#define JPC_BITSTREAM_READ 0x01
94#define JPC_BITSTREAM_WRITE 0x02
101#define JPC_BITSTREAM_NOCLOSE 0x01
103#define JPC_BITSTREAM_EOF 0x02
105#define JPC_BITSTREAM_ERR 0x04
137jpc_bitstream_t *jpc_bitstream_sopen(
jas_stream_t *stream,
const char *mode);
140int jpc_bitstream_close(jpc_bitstream_t *bitstream);
148#define jpc_bitstream_getbit(bitstream) \
149 jpc_bitstream_getbit_func(bitstream)
151#define jpc_bitstream_getbit(bitstream) \
152 jpc_bitstream_getbit_macro(bitstream)
157#define jpc_bitstream_putbit(bitstream, v) \
158 jpc_bitstream_putbit_func(bitstream, v)
160#define jpc_bitstream_putbit(bitstream, v) \
161 jpc_bitstream_putbit_macro(bitstream, v)
165long jpc_bitstream_getbits(jpc_bitstream_t *bitstream,
int n);
168int jpc_bitstream_putbits(jpc_bitstream_t *bitstream,
int n,
long v);
176int jpc_bitstream_align(jpc_bitstream_t *bitstream);
181int jpc_bitstream_inalign(jpc_bitstream_t *bitstream,
int fillmask,
186int jpc_bitstream_outalign(jpc_bitstream_t *bitstream,
int filldata);
190int jpc_bitstream_needalign(
const jpc_bitstream_t *bitstream);
194int jpc_bitstream_pending(
const jpc_bitstream_t *bitstream);
201#define jpc_bitstream_eof(bitstream) \
202 ((bitstream)->flags_ & JPC_BITSTREAM_EOF)
211int jpc_bitstream_getbit_func(jpc_bitstream_t *bitstream);
213int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream,
int v);
215int jpc_bitstream_fillbuf(jpc_bitstream_t *bitstream);
217#define jpc_bitstream_getbit_macro(bitstream) \
218 (assert((bitstream)->openmode_ & JPC_BITSTREAM_READ), \
219 (--(bitstream)->cnt_ >= 0) ? \
220 ((int)(((bitstream)->buf_ >> (bitstream)->cnt_) & 1)) : \
221 jpc_bitstream_fillbuf(bitstream))
223#define jpc_bitstream_putbit_macro(bitstream, bit) \
224 (assert((bitstream)->openmode_ & JPC_BITSTREAM_WRITE), \
225 (--(bitstream)->cnt_ < 0) ? \
226 ((bitstream)->buf_ = ((bitstream)->buf_ << 8) & 0xffff, \
227 (bitstream)->cnt_ = ((bitstream)->buf_ == 0xff00) ? 6 : 7, \
228 (bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
229 (jas_stream_putc((bitstream)->stream_, (bitstream)->buf_ >> 8) == EOF) \
230 ? (EOF) : ((bit) & 1)) : \
231 ((bitstream)->buf_ |= ((bit) & 1) << (bitstream)->cnt_, \
I/O stream object.
Definition jas_stream.h:206