43 #define opj_mqc_mpsexchange_macro(d, curctx, a) \
45 if (a < (*curctx)->qeval) { \
46 d = !((*curctx)->mps); \
47 *curctx = (*curctx)->nlps; \
50 *curctx = (*curctx)->nmps; \
55 #define opj_mqc_lpsexchange_macro(d, curctx, a) \
57 if (a < (*curctx)->qeval) { \
58 a = (*curctx)->qeval; \
60 *curctx = (*curctx)->nmps; \
62 a = (*curctx)->qeval; \
63 d = !((*curctx)->mps); \
64 *curctx = (*curctx)->nlps; \
81 if (*mqc->
bp > 0x8f) {
102 #define opj_mqc_bytein_macro(mqc, c, ct) \
107 l_c = *(mqc->bp + 1); \
108 if (*mqc->bp == 0xff) { \
112 mqc->end_of_byte_stream_counter ++; \
126 #define opj_mqc_renormd_macro(mqc, a, c, ct) \
130 opj_mqc_bytein_macro(mqc, c, ct); \
135 } while (a < 0x8000); \
138 #define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct) \
144 a -= (*curctx)->qeval; \
145 if ((c >> 16) < (*curctx)->qeval) { \
146 opj_mqc_lpsexchange_macro(d, curctx, a); \
147 opj_mqc_renormd_macro(mqc, a, c, ct); \
149 c -= (*curctx)->qeval << 16; \
150 if ((a & 0x8000) == 0) { \
151 opj_mqc_mpsexchange_macro(d, curctx, a); \
152 opj_mqc_renormd_macro(mqc, a, c, ct); \
154 d = (*curctx)->mps; \
159 #define DOWNLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \
160 register const opj_mqc_state_t **curctx = mqc->curctx; \
161 register OPJ_UINT32 c = mqc->c; \
162 register OPJ_UINT32 a = mqc->a; \
163 register OPJ_UINT32 ct = mqc->ct
165 #define UPLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \
166 mqc->curctx = curctx; \
184 #define opj_mqc_renormd(mqc) \
185 opj_mqc_renormd_macro(mqc, mqc->a, mqc->c, mqc->ct)
193 #define opj_mqc_decode(d, mqc) \
194 opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
OPJ_UINT32 ct
number of bits already read or free to write
Definition: mqc.h:80
static INLINE OPJ_UINT32 opj_mqc_raw_decode(opj_mqc_t *mqc)
Decode a symbol using raw-decoder.
Definition: mqc_inl.h:74
OPJ_UINT32 c
temporary buffer where bits are coded or decoded
Definition: mqc.h:76
static INLINE void opj_mqc_bytein(opj_mqc_t *const mqc)
Input a byte.
Definition: mqc_inl.h:175
OPJ_BYTE * bp
pointer to the current position in the buffer
Definition: mqc.h:84
#define INLINE
Definition: openjpeg.h:65
uint32_t OPJ_UINT32
Definition: openjpeg.h:126
#define opj_mqc_bytein_macro(mqc, c, ct)
Definition: mqc_inl.h:102
MQ coder.
Definition: mqc.h:74