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, a, c, 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, a, c, 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) 210 #define opj_mqc_renorme_macro(mqc, a_, c_, ct_) \ 218 opj_mqc_byteout(mqc); \ 222 } while( (a_ & 0x8000) == 0); \ 225 #define opj_mqc_codemps_macro(mqc, curctx, a, c, ct) \ 227 a -= (*curctx)->qeval; \ 228 if ((a & 0x8000) == 0) { \ 229 if (a < (*curctx)->qeval) { \ 230 a = (*curctx)->qeval; \ 232 c += (*curctx)->qeval; \ 234 *curctx = (*curctx)->nmps; \ 235 opj_mqc_renorme_macro(mqc, a, c, ct); \ 237 c += (*curctx)->qeval; \ 241 #define opj_mqc_codelps_macro(mqc, curctx, a, c, ct) \ 243 a -= (*curctx)->qeval; \ 244 if (a < (*curctx)->qeval) { \ 245 c += (*curctx)->qeval; \ 247 a = (*curctx)->qeval; \ 249 *curctx = (*curctx)->nlps; \ 250 opj_mqc_renorme_macro(mqc, a, c, ct); \ 253 #define opj_mqc_encode_macro(mqc, curctx, a, c, ct, d) \ 255 if ((*curctx)->mps == (d)) { \ 256 opj_mqc_codemps_macro(mqc, curctx, a, c, ct); \ 258 opj_mqc_codelps_macro(mqc, curctx, a, c, ct); \ 263 #define opj_mqc_bypass_enc_macro(mqc, c, ct, d) \ 265 if (ct == BYPASS_CT_INIT) {\ 269 c = c + ((d) << ct);\ 271 *mqc->bp = (OPJ_BYTE)c;\ 274 if (*mqc->bp == 0xff) {\ 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
void opj_mqc_byteout(opj_mqc_t *mqc)
Output a byte, doing bit-stuffing if necessary.
Definition: mqc.c:492
MQ coder.
Definition: mqc.h:74