Grok  7.6.2
Macros | Functions
mqc_enc_inl.h File Reference

Go to the source code of this file.

Macros

#define mqc_renorme_macro(mqc, a_, c_, ct_)
 Renormalize mqc->a and mqc->c while compressing, so that mqc->a stays between 0x8000 and 0x10000. More...
 
#define mqc_codemps_macro(mqc, curctx, a, c, ct)
 
#define mqc_codelps_macro(mqc, curctx, a, c, ct)
 
#define mqc_encode_macro(mqc, curctx, a, c, ct, d)
 
#define mqc_bypass_enc_macro(mqc, c, ct, d)
 

Functions

void mqc_byteout (mqcoder *mqc)
 Output a byte, doing bit-stuffing if necessary. More...
 

Macro Definition Documentation

◆ mqc_bypass_enc_macro

#define mqc_bypass_enc_macro (   mqc,
  c,
  ct,
 
)
Value:
{\
if (ct == BYPASS_CT_INIT) {\
ct = 8;\
}\
ct--;\
c = c + ((d) << ct);\
if (ct == 0) {\
*mqc->bp = (uint8_t)c;\
ct = 8;\
/* If the previous byte was 0xff, make sure that the next msb is 0 */ \
if (*mqc->bp == 0xff) {\
ct = 7;\
}\
mqc->bp++;\
c = 0;\
}\
}

◆ mqc_codelps_macro

#define mqc_codelps_macro (   mqc,
  curctx,
  a,
  c,
  ct 
)
Value:
{ \
a -= (*curctx)->qeval; \
if (a < (*curctx)->qeval) { \
c += (*curctx)->qeval; \
} else { \
a = (*curctx)->qeval; \
} \
*curctx = (*curctx)->nlps; \
mqc_renorme_macro(mqc, a, c, ct); \
}

◆ mqc_codemps_macro

#define mqc_codemps_macro (   mqc,
  curctx,
  a,
  c,
  ct 
)
Value:
{ \
a -= (*curctx)->qeval; \
if ((a & 0x8000) == 0) { \
if (a < (*curctx)->qeval) { \
a = (*curctx)->qeval; \
} else { \
c += (*curctx)->qeval; \
} \
*curctx = (*curctx)->nmps; \
mqc_renorme_macro(mqc, a, c, ct); \
} else { \
c += (*curctx)->qeval; \
} \
}

◆ mqc_encode_macro

#define mqc_encode_macro (   mqc,
  curctx,
  a,
  c,
  ct,
 
)
Value:
{ \
if ((*curctx)->mps == (d)) { \
mqc_codemps_macro(mqc, curctx, a, c, ct); \
} else { \
mqc_codelps_macro(mqc, curctx, a, c, ct); \
} \
}

◆ mqc_renorme_macro

#define mqc_renorme_macro (   mqc,
  a_,
  c_,
  ct_ 
)
Value:
{ \
do { \
a_ <<= 1; \
c_ <<= 1; \
ct_--; \
if (ct_ == 0) { \
mqc->c = c_; \
mqc_byteout(mqc); \
c_ = mqc->c; \
ct_ = mqc->ct; \
} \
} while( (a_ & 0x8000) == 0); \
}

Renormalize mqc->a and mqc->c while compressing, so that mqc->a stays between 0x8000 and 0x10000.

Parameters
mqcMQC handle
a_value of mqc->a
c_value of mqc->c_
ct_value of mqc->ct_

Function Documentation

◆ mqc_byteout()

void mqc_byteout ( mqcoder *  mqc)

Output a byte, doing bit-stuffing if necessary.

After a 0xff byte, the next byte must be smaller than 0x90.

Parameters
mqcMQC handle
BYPASS_CT_INIT
#define BYPASS_CT_INIT
Definition: mqc_inl.h:24