Go to the documentation of this file.
25 #define mpsexchange_dec_macro(d, curctx, a) \
27 if (a < (*curctx)->qeval) { \
28 d = (*curctx)->mps ^ 1; \
29 *curctx = (*curctx)->nlps; \
32 *curctx = (*curctx)->nmps; \
37 #define lpsexchange_dec_macro(d, curctx, a) \
39 if (a < (*curctx)->qeval) { \
40 a = (*curctx)->qeval; \
42 *curctx = (*curctx)->nmps; \
44 a = (*curctx)->qeval; \
45 d = (*curctx)->mps ^ 1; \
46 *curctx = (*curctx)->nlps; \
60 if (*mqc->bp > 0x8f) {
76 return ((uint32_t)mqc->c >> mqc->ct) & 0x01U;
79 #define bytein_dec_macro(mqc, c, ct) \
83 uint32_t l_c = *(mqc->bp + 1); \
84 if (*mqc->bp == 0xff) { \
88 mqc->end_of_byte_stream_counter ++; \
102 #define renorm_dec_macro(mqc, a, c, ct) \
106 bytein_dec_macro(mqc, c, ct); \
110 } while (a < A_MIN); \
113 #define decompress_macro(d, mqc, curctx, a, c, ct) \
116 a -= (*curctx)->qeval; \
117 uint32_t qeval_shift = (*curctx)->qeval << 16; \
118 if (c < qeval_shift) { \
119 lpsexchange_dec_macro(d, curctx, a); \
120 renorm_dec_macro(mqc, a, c, ct); \
124 mpsexchange_dec_macro(d, curctx, a); \
125 renorm_dec_macro(mqc, a, c, ct); \
127 d = (*curctx)->mps; \
144 #define mqc_renormd(mqc) \
145 renorm_dec_macro(mqc, mqc->a, mqc->c, mqc->ct)
153 #define mqc_decode(d, mqc) \
154 decompress_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
#define T1_CTXNO_ZC
Definition: t1_common.h:59
const mqc_state * ctxs[MQC_NUMCTXS]
Array of contexts.
Definition: mqc.h:58
void mqc_init_dec(mqcoder *mqc, uint8_t *bp, uint32_t len)
Initialize the decoder for MQ decoding.
Definition: mqc_dec.cpp:140
#define T1_CTXNO_UNI
Definition: t1_common.h:63
static INLINE void mqc_bytein(mqcoder *const mqc)
Input a byte.
Definition: mqc_dec_inl.h:136
uint8_t * end
pointer to the end of the buffer
Definition: mqc.h:56
#define T1_CTXNO_AGG
Definition: t1_common.h:62
void mqc_raw_init_dec(mqcoder *mqc, uint8_t *bp, uint32_t len)
Initialize the decoder for RAW decoding.
Definition: mqc_dec.cpp:156
uint8_t * start
pointer to the start of the buffer
Definition: mqc.h:54
void mqc_resetstates(mqcoder *mqc)
Definition: mqc_dec.cpp:167
const uint32_t A_MIN
Definition: mqc.h:67
#define bytein_dec_macro(mqc, c, ct)
Definition: mqc_dec_inl.h:79
uint8_t * bp
pointer to the current position in the buffer
Definition: mqc.h:52
#define mqc_setcurctx(mqc, ctxno)
Definition: mqc_inl.h:38
uint32_t ct
number of bits already read or free to write
Definition: mqc.h:48
const uint8_t grk_cblk_dec_compressed_data_pad_right
< Space for a fake FFFF marker
Definition: t1_common.h:37
Copyright (C) 2016-2020 Grok Image Compression Inc.
Definition: BitIO.cpp:23
uint32_t c
temporary buffer where bits are coded or decoded
Definition: mqc.h:44
static INLINE uint32_t mqc_raw_decode(mqcoder *mqc)
Decompress a symbol using raw-decoder.
Definition: mqc_dec_inl.h:55
#define INLINE
Definition: t1_common.h:28
void mqc_finish_dec(mqcoder *mqc)
Terminate RAW/MQC decoding.
Definition: mqc_dec.cpp:162
uint8_t backup[grk_cblk_dec_compressed_data_pad_right]
Original value of the 2 bytes at end[0] and end[1].
Definition: mqc.h:64
static void mqc_init_dec_common(mqcoder *mqc, uint8_t *bp, uint32_t len)
Definition: mqc_dec.cpp:126
uint32_t end_of_byte_stream_counter
Definition: mqc.h:50
static const mqc_state mqc_states[47 *2]
Definition: mqc_dec.cpp:29
uint32_t a
only used by MQ decoder
Definition: mqc.h:46
#define MQC_NUMCTXS
Definition: mqc.h:41