OpenJPEG  2.2.0
Macros | Functions
mqc_inl.h File Reference

Go to the source code of this file.

Macros

#define opj_mqc_mpsexchange_macro(d, curctx, a)
 
#define opj_mqc_lpsexchange_macro(d, curctx, a)
 
#define opj_mqc_bytein_macro(mqc, c, ct)
 
#define opj_mqc_renormd_macro(mqc, a, c, ct)
 
#define opj_mqc_decode_macro(d, mqc, curctx, a, c, ct)
 
#define DOWNLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct)
 
#define UPLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct)
 
#define opj_mqc_renormd(mqc)   opj_mqc_renormd_macro(mqc, mqc->a, mqc->c, mqc->ct)
 Renormalize mqc->a and mqc->c while decoding. More...
 
#define opj_mqc_decode(d, mqc)   opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
 Decode a symbol. More...
 

Functions

static INLINE OPJ_UINT32 opj_mqc_raw_decode (opj_mqc_t *mqc)
 Decode a symbol using raw-decoder. More...
 
static INLINE void opj_mqc_bytein (opj_mqc_t *const mqc)
 Input a byte. More...
 

Macro Definition Documentation

#define DOWNLOAD_MQC_VARIABLES (   mqc,
  curctx,
  c,
  a,
  ct 
)
Value:
register opj_mqc_state_t **curctx = mqc->curctx; \
register OPJ_UINT32 c = mqc->c; \
register OPJ_UINT32 a = mqc->a; \
register OPJ_UINT32 ct = mqc->ct
This struct defines the state of a context.
Definition: mqc.h:58
uint32_t OPJ_UINT32
Definition: openjpeg.h:126
#define opj_mqc_bytein_macro (   mqc,
  c,
  ct 
)
Value:
{ \
OPJ_UINT32 l_c; \
/* Given opj_mqc_init_dec() we know that at some point we will */ \
/* have a 0xFF 0xFF artificial marker */ \
l_c = *(mqc->bp + 1); \
if (*mqc->bp == 0xff) { \
if (l_c > 0x8f) { \
c += 0xff00; \
ct = 8; \
mqc->end_of_byte_stream_counter ++; \
} else { \
mqc->bp++; \
c += l_c << 9; \
ct = 7; \
} \
} else { \
mqc->bp++; \
c += l_c << 8; \
ct = 8; \
} \
}

Referenced by opj_mqc_bytein().

#define opj_mqc_decode (   d,
  mqc 
)    opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)

Decode a symbol.

Parameters
dOPJ_UINT32 value where to store the decoded symbol
mqcMQC handle
Returns
Returns the decoded symbol (0 or 1) in d

Referenced by opj_t1_dec_clnpass_check_segsym().

#define opj_mqc_decode_macro (   d,
  mqc,
  curctx,
  a,
  c,
  ct 
)
Value:
{ \
/* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */ \
/* Note: alternate "J.2 - Decoding an MPS or an LPS in the */ \
/* software-conventions decoder" has been tried, but does not bring any */ \
/* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */ \
a -= (*curctx)->qeval; \
if ((c >> 16) < (*curctx)->qeval) { \
opj_mqc_lpsexchange_macro(d, curctx, a); \
opj_mqc_renormd_macro(mqc, a, c, ct); \
} else { \
c -= (*curctx)->qeval << 16; \
if ((a & 0x8000) == 0) { \
opj_mqc_mpsexchange_macro(d, curctx, a); \
opj_mqc_renormd_macro(mqc, a, c, ct); \
} else { \
d = (*curctx)->mps; \
} \
} \
}
#define opj_mqc_lpsexchange_macro (   d,
  curctx,
 
)
Value:
{ \
if (a < (*curctx)->qeval) { \
a = (*curctx)->qeval; \
d = (*curctx)->mps; \
*curctx = (*curctx)->nmps; \
} else { \
a = (*curctx)->qeval; \
d = !((*curctx)->mps); \
*curctx = (*curctx)->nlps; \
} \
}
#define opj_mqc_mpsexchange_macro (   d,
  curctx,
 
)
Value:
{ \
if (a < (*curctx)->qeval) { \
d = !((*curctx)->mps); \
*curctx = (*curctx)->nlps; \
} else { \
d = (*curctx)->mps; \
*curctx = (*curctx)->nmps; \
} \
}
#define opj_mqc_renormd (   mqc)    opj_mqc_renormd_macro(mqc, mqc->a, mqc->c, mqc->ct)

Renormalize mqc->a and mqc->c while decoding.

Parameters
mqcMQC handle
#define opj_mqc_renormd_macro (   mqc,
  a,
  c,
  ct 
)
Value:
{ \
do { \
if (ct == 0) { \
opj_mqc_bytein_macro(mqc, c, ct); \
} \
a <<= 1; \
c <<= 1; \
ct--; \
} while (a < 0x8000); \
}
#define UPLOAD_MQC_VARIABLES (   mqc,
  curctx,
  c,
  a,
  ct 
)
Value:
mqc->curctx = curctx; \
mqc->c = c; \
mqc->a = a; \
mqc->ct = ct;

Function Documentation

static INLINE void opj_mqc_bytein ( opj_mqc_t *const  mqc)
static

Input a byte.

Parameters
mqcMQC handle

References opj_mqc::c, opj_mqc::ct, and opj_mqc_bytein_macro.

Referenced by opj_mqc_init_dec().

static INLINE OPJ_UINT32 opj_mqc_raw_decode ( opj_mqc_t mqc)
static

Decode a symbol using raw-decoder.

Cfr p.506 TAUBMAN

Parameters
mqcMQC handle
Returns
Returns the decoded symbol (0 or 1)

References opj_mqc::bp, opj_mqc::c, and opj_mqc::ct.

Referenced by opj_t1_dec_refpass_step_raw(), and opj_t1_dec_sigpass_step_raw().