Grok 20.3.2
mqc_dec_inl.h File Reference

Go to the source code of this file.

Macros

#define DEC_PASS_LOCAL_VARIABLES(flagsStride)
#define DEC_PASS_LOCAL_VARIABLES_DIFF(flagsStride)
#define DEC_PASS_HAS_BACKUP_FOR_CURRENT_PASS(coder)
#define DEC_PASS_MQC_BACKUP_LOCAL(coder)
#define DEC_PASS_MQC_RESTORE_LOCAL(coder)
#define DEC_PASS_DO_BACKUP(coder, p)
#define DEC_PASS_BACKUP(coder, p)
#define DEC_PASS_CLN_BACKUP(p)
#define DEC_PASS_RESTORE(coder)
#define DEC_PASS_CLN_RESTORE(coder)
#define DEC_BYTEIN(mqc, c, ct)
 Returns next byte in code stream.
#define DEC_RENORM(mqc, a, c, ct)
#define DEC_SYMBOL(d, mqc, curctx, a, c, ct)
 Implements ISO 15444-1 C.3.2 Decompressing a decision (DECODE).
#define DEC_SYMBOL_RAW()
 Decodes a Raw-encoded pass.

Variables

const uint32_t A_MIN = 0x8000
const uint8_t B1_POS = 1
const uint8_t B2_POS = 2
const uint8_t B3_POS = 3
const uint8_t B4_POS = 4
const uint8_t B5_POS = 5
const uint8_t B6_POS = 6
const uint8_t B7_POS = 7
const uint8_t B8_POS = 8
const uint8_t B9_POS = 9
const uint8_t B10_POS = 10
const uint8_t B11_POS = 11
const uint8_t B12_POS = 12
const uint8_t red_zone = 6

Macro Definition Documentation

◆ DEC_BYTEIN

#define DEC_BYTEIN ( mqc,
c,
ct )

Returns next byte in code stream.

A list of encoded buffers is managed to act like a single contiguous encoded buffer

Parameters
mqcMQ coder
cMQ c variable
ctMQ ct variable

◆ DEC_PASS_BACKUP

#define DEC_PASS_BACKUP ( coder,
p )
Value:
if(approaching_red) \
{ \
DEC_PASS_DO_BACKUP(coder, p) \
}

◆ DEC_PASS_CLN_BACKUP

#define DEC_PASS_CLN_BACKUP ( p)
Value:
if(approaching_red) \
{ \
DEC_PASS_DO_BACKUP(coder, p); \
coder.backup_->runlen = runlen; \
coder.backup_->partial = partial; \
}

◆ DEC_PASS_CLN_RESTORE

#define DEC_PASS_CLN_RESTORE ( coder)

◆ DEC_PASS_DO_BACKUP

#define DEC_PASS_DO_BACKUP ( coder,
p )
Value:
decompressBackup(); \
DEC_PASS_MQC_BACKUP_LOCAL(coder); \
auto b = coder.backup_; \
b->position = p; \
b->i = i; \
b->j = j; \
b->k = k; \
b->flagsPtr_ = flagsPtr; \
b->_flags = _flags; \
b->dataPtr_ = dataPtr; \
b->passno_ = passno; \
b->passtype_ = passtype; \
b->numBpsToDecompress_ = (uint8_t)bpno; \
approaching_red = false; \
b->layer_ = (uint16_t)coder.cur_buffer_index;

◆ DEC_PASS_HAS_BACKUP_FOR_CURRENT_PASS

#define DEC_PASS_HAS_BACKUP_FOR_CURRENT_PASS ( coder)
Value:
(coder.backup_->i != BACKUP_DISABLED) && (passno == coder.backup_->passno_)

◆ DEC_PASS_LOCAL_VARIABLES

#define DEC_PASS_LOCAL_VARIABLES ( flagsStride)
Value:
const int32_t one = 1 << bpno; \
const auto mqc = &coder; \
auto dataPtr = uncompressedData_; \
auto flagsPtr = flags_ + flagsStride + 1; \
grk_flag _flags = 0; \
uint16_t i = 0, j = 0, k = 0; \
bool approaching_red; \
(void)approaching_red; \
PUSH_MQC();

◆ DEC_PASS_LOCAL_VARIABLES_DIFF

#define DEC_PASS_LOCAL_VARIABLES_DIFF ( flagsStride)
Value:
const int32_t one = 1 << bpno; \
const auto mqc = &coder; \
auto dataPtr = uncompressedData_; \
auto flagsPtr = flags_ + flagsStride + 1; \
grk_flag _flags = 0; \
uint16_t i = 0, j = 0, k = 0; \
const mqc_state** curctx; \
uint32_t c, a; \
uint8_t ct; \
bool approaching_red = (coder.backup_->i == BACKUP_DISABLED) && \
mqc->bp + red_zone >= mqc->end && \
((coder.cur_buffer_index + 1 >= coder.num_buffers) || \
coder.buffer_lengths[coder.cur_buffer_index + 1] <= red_zone); \
(void)approaching_red;
const uint8_t red_zone
Definition mqc_dec_inl.h:64

◆ DEC_PASS_MQC_BACKUP_LOCAL

#define DEC_PASS_MQC_BACKUP_LOCAL ( coder)
Value:
coder.backup_->a = a; \
coder.backup_->c = c; \
coder.backup_->ct = ct; \
coder.backup_->curctx_index_ = curctx - &coder.ctxs[0]; \
coder.backup_->curctx = &coder.backup_->ctxs[coder.backup_->curctx_index_];

◆ DEC_PASS_MQC_RESTORE_LOCAL

#define DEC_PASS_MQC_RESTORE_LOCAL ( coder)
Value:
a = coder.backup_->a; \
c = coder.backup_->c; \
ct = coder.backup_->ct; \
coder.curctx_index_ = coder.backup_->curctx_index_; \
curctx = &coder.ctxs[coder.curctx_index_]; \
coder.curctx = curctx; \
coder.a = a; \
coder.c = c; \
coder.ct = ct;

◆ DEC_PASS_RESTORE

#define DEC_PASS_RESTORE ( coder)

◆ DEC_RENORM

#define DEC_RENORM ( mqc,
a,
c,
ct )
Value:
{ \
do \
{ \
if(ct == 0) \
{ \
if(mqc->start == mqc->end) \
{ \
c += 0xff00; \
ct = 8; \
mqc->end_of_byte_stream_counter++; \
} \
else \
DEC_BYTEIN(mqc, c, ct); \
} \
a <<= 1; \
c <<= 1; \
ct--; \
} while(a < A_MIN); \
}
const uint32_t A_MIN
Definition mqc_dec_inl.h:20

◆ DEC_SYMBOL

#define DEC_SYMBOL ( d,
mqc,
curctx,
a,
c,
ct )
Value:
do \
{ \
auto ctx = *(curctx); \
a -= ctx->qeval; \
uint32_t qeval_shift = ctx->qeval << 16; \
if(c < qeval_shift) \
{ \
uint32_t mask = (uint32_t)-(a < ctx->qeval); \
a = ctx->qeval; \
d = ctx->mps ^ (~mask & 1); \
*curctx = mask ? ctx->nmps : ctx->nlps; \
DEC_RENORM(mqc, a, c, ct); \
} \
else \
{ \
c -= qeval_shift; \
if(a < A_MIN) \
{ \
uint32_t mask = (uint32_t)-(a < ctx->qeval); \
d = ctx->mps ^ (mask & 1); \
*curctx = mask ? ctx->nlps : ctx->nmps; \
DEC_RENORM(mqc, a, c, ct); \
} \
else \
{ \
d = ctx->mps; \
} \
} \
} while(0)

Implements ISO 15444-1 C.3.2 Decompressing a decision (DECODE).

Parameters
dvariable to hold decoded symbol
mqcMQ coder
curctxcurrent context
aMQ variable a
cMQ variable c
ctMQ variable ct

◆ DEC_SYMBOL_RAW

#define DEC_SYMBOL_RAW ( )

Decodes a Raw-encoded pass.

Variable Documentation

◆ A_MIN

const uint32_t A_MIN = 0x8000

◆ B10_POS

const uint8_t B10_POS = 10

◆ B11_POS

const uint8_t B11_POS = 11

◆ B12_POS

const uint8_t B12_POS = 12

◆ B1_POS

const uint8_t B1_POS = 1

◆ B2_POS

const uint8_t B2_POS = 2

◆ B3_POS

const uint8_t B3_POS = 3

◆ B4_POS

const uint8_t B4_POS = 4

◆ B5_POS

const uint8_t B5_POS = 5

◆ B6_POS

const uint8_t B6_POS = 6

◆ B7_POS

const uint8_t B7_POS = 7

◆ B8_POS

const uint8_t B8_POS = 8

◆ B9_POS

const uint8_t B9_POS = 9

◆ red_zone

const uint8_t red_zone = 6