Grok 20.3.2
mqc_base.h File Reference
#include "mqc_state.h"
#include <string>
#include <cstddef>

Go to the source code of this file.

Classes

struct  grk::t1::mqcoder_base
 MQ coder base. More...

Namespaces

namespace  grk
 ResWindow.
namespace  grk::t1

Macros

#define MQC_NUMCTXS   19
#define PUSH_MQC()
#define POP_MQC()
#define T1_SIGMA_0   (1U << 0)
 We hold the state of individual data points for the BlockCoder compressor using a single 32-bit flags word to hold the state of 4 data points.
#define T1_SIGMA_1   (1U << 1)
#define T1_SIGMA_2   (1U << 2)
#define T1_SIGMA_3   (1U << 3)
#define T1_SIGMA_4   (1U << 4)
#define T1_SIGMA_5   (1U << 5)
#define T1_SIGMA_6   (1U << 6)
#define T1_SIGMA_7   (1U << 7)
#define T1_SIGMA_8   (1U << 8)
#define T1_SIGMA_9   (1U << 9)
#define T1_SIGMA_10   (1U << 10)
#define T1_SIGMA_11   (1U << 11)
#define T1_SIGMA_12   (1U << 12)
#define T1_SIGMA_13   (1U << 13)
#define T1_SIGMA_14   (1U << 14)
#define T1_SIGMA_15   (1U << 15)
#define T1_SIGMA_16   (1U << 16)
#define T1_SIGMA_17   (1U << 17)
#define T1_CHI_0   (1U << 18)
#define T1_CHI_0_I   18
#define T1_CHI_1   (1U << 19)
#define T1_CHI_1_I   19
#define T1_MU_0   (1U << 20)
#define T1_PI_0   (1U << 21)
#define T1_CHI_2   (1U << 22)
#define T1_CHI_2_I   22
#define T1_MU_1   (1U << 23)
#define T1_PI_1_I   24
#define T1_PI_1   (1U << T1_PI_1_I)
#define T1_CHI_3   (1U << 25)
#define T1_MU_2   (1U << 26)
#define T1_PI_2_I   27
#define T1_PI_2   (1U << T1_PI_2_I)
#define T1_CHI_4   (1U << 28)
#define T1_MU_3   (1U << 29)
#define T1_PI_3   (1U << 30)
#define T1_CHI_5   (1U << 31)
#define T1_CHI_5_I   31
#define T1_SIGMA_NW   T1_SIGMA_0
 As an example, the bits T1_SIGMA_3, T1_SIGMA_4 and T1_SIGMA_5 indicate the significance state of the west neighbour of data point zero of our four, the point itself, and its east neighbour respectively.
#define T1_SIGMA_N   T1_SIGMA_1
#define T1_SIGMA_NE   T1_SIGMA_2
#define T1_SIGMA_W   T1_SIGMA_3
#define T1_SIGMA_THIS   T1_SIGMA_4
#define T1_SIGMA_E   T1_SIGMA_5
#define T1_SIGMA_SW   T1_SIGMA_6
#define T1_SIGMA_S   T1_SIGMA_7
#define T1_SIGMA_SE   T1_SIGMA_8
#define T1_SIGMA_NEIGHBOURS
#define T1_CHI_THIS   T1_CHI_1
#define T1_CHI_THIS_I   T1_CHI_1_I
#define T1_MU_THIS   T1_MU_0
#define T1_PI_THIS   T1_PI_0
#define T1_CHI_S   T1_CHI_2
#define T1_LUT_SGN_W   (1U << 0)
#define T1_LUT_SIG_N   (1U << 1)
#define T1_LUT_SGN_E   (1U << 2)
#define T1_LUT_SIG_W   (1U << 3)
#define T1_LUT_SGN_N   (1U << 4)
#define T1_LUT_SIG_E   (1U << 5)
#define T1_LUT_SGN_S   (1U << 6)
#define T1_LUT_SIG_S   (1U << 7)
#define T1_TYPE_MQ   0 /** Normal coding using entropy coder */
#define T1_TYPE_RAW   1 /** Raw compressing*/
#define SETCURCTX(curctx, ctxno)
#define GETCTXNO_MAG(f)
#define UPDATE_FLAGS(flags, flagsPtr, ci, s, stride, vsc)
#define GETCTXNO_ZC(mqc, f)

Typedefs

typedef uint32_t grk::t1::grk_flag

Functions

uint8_t grk::t1::getctxtno_sc_or_spb_index (uint32_t fX, uint32_t pfX, uint32_t nfX, uint32_t ci)

Macro Definition Documentation

◆ GETCTXNO_MAG

#define GETCTXNO_MAG ( f)
Value:
(uint8_t)(T1_CTXNO_MAG + (((f) & T1_MU_0) ? 2 : !!((f) & T1_SIGMA_NEIGHBOURS)))
#define T1_MU_0
Definition mqc_base.h:77
#define T1_SIGMA_NEIGHBOURS
Definition mqc_base.h:123

◆ GETCTXNO_ZC

#define GETCTXNO_ZC ( mqc,
f )
Value:
(mqc)->lut_ctxno_zc_orient[((f) & T1_SIGMA_NEIGHBOURS)]

Referenced by grk::t1::BlockCoder::enc_clnpass().

◆ MQC_NUMCTXS

◆ POP_MQC

#define POP_MQC ( )
Value:
coder.curctx = curctx; \
coder.c = c; \
coder.a = a; \
coder.ct = ct;

Referenced by grk::t1::BlockCoder::enc_clnpass(), grk::t1::BlockCoder::enc_refpass(), and grk::t1::BlockCoder::enc_sigpass().

◆ PUSH_MQC

#define PUSH_MQC ( )
Value:
auto curctx = coder.curctx; \
uint32_t c = coder.c; \
uint32_t a = coder.a; \
uint8_t ct = coder.ct

Referenced by grk::t1::BlockCoder::enc_clnpass(), grk::t1::BlockCoder::enc_refpass(), and grk::t1::BlockCoder::enc_sigpass().

◆ SETCURCTX

#define SETCURCTX ( curctx,
ctxno )
Value:
curctx = &(mqc)->ctxs[(uint32_t)(ctxno)]

◆ T1_CHI_0

#define T1_CHI_0   (1U << 18)

◆ T1_CHI_0_I

#define T1_CHI_0_I   18

◆ T1_CHI_1

#define T1_CHI_1   (1U << 19)

◆ T1_CHI_1_I

#define T1_CHI_1_I   19

◆ T1_CHI_2

#define T1_CHI_2   (1U << 22)

◆ T1_CHI_2_I

#define T1_CHI_2_I   22

◆ T1_CHI_3

#define T1_CHI_3   (1U << 25)

◆ T1_CHI_4

#define T1_CHI_4   (1U << 28)

◆ T1_CHI_5

#define T1_CHI_5   (1U << 31)

◆ T1_CHI_5_I

#define T1_CHI_5_I   31

◆ T1_CHI_S

#define T1_CHI_S   T1_CHI_2

◆ T1_CHI_THIS

#define T1_CHI_THIS   T1_CHI_1

◆ T1_CHI_THIS_I

#define T1_CHI_THIS_I   T1_CHI_1_I

◆ T1_LUT_SGN_E

#define T1_LUT_SGN_E   (1U << 2)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SGN_N

#define T1_LUT_SGN_N   (1U << 4)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SGN_S

#define T1_LUT_SGN_S   (1U << 6)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SGN_W

#define T1_LUT_SGN_W   (1U << 0)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SIG_E

#define T1_LUT_SIG_E   (1U << 5)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SIG_N

#define T1_LUT_SIG_N   (1U << 1)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SIG_S

#define T1_LUT_SIG_S   (1U << 7)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_LUT_SIG_W

#define T1_LUT_SIG_W   (1U << 3)

Referenced by t1_init_ctxno_sc(), and t1_init_spb().

◆ T1_MU_0

#define T1_MU_0   (1U << 20)

◆ T1_MU_1

#define T1_MU_1   (1U << 23)

◆ T1_MU_2

#define T1_MU_2   (1U << 26)

◆ T1_MU_3

#define T1_MU_3   (1U << 29)

◆ T1_MU_THIS

#define T1_MU_THIS   T1_MU_0

◆ T1_PI_0

◆ T1_PI_1

◆ T1_PI_1_I

#define T1_PI_1_I   24

◆ T1_PI_2

◆ T1_PI_2_I

#define T1_PI_2_I   27

◆ T1_PI_3

◆ T1_PI_THIS

◆ T1_SIGMA_0

#define T1_SIGMA_0   (1U << 0)

We hold the state of individual data points for the BlockCoder compressor using a single 32-bit flags word to hold the state of 4 data points.

This corresponds to the 4-point-high columns that the data is processed in. These #defines declare the layout of a 32-bit flags word.

Referenced by t1_init_ctxno_zc().

◆ T1_SIGMA_1

#define T1_SIGMA_1   (1U << 1)

◆ T1_SIGMA_10

#define T1_SIGMA_10   (1U << 10)

◆ T1_SIGMA_11

#define T1_SIGMA_11   (1U << 11)

◆ T1_SIGMA_12

#define T1_SIGMA_12   (1U << 12)

◆ T1_SIGMA_13

#define T1_SIGMA_13   (1U << 13)

◆ T1_SIGMA_14

#define T1_SIGMA_14   (1U << 14)

◆ T1_SIGMA_15

#define T1_SIGMA_15   (1U << 15)

◆ T1_SIGMA_16

#define T1_SIGMA_16   (1U << 16)

◆ T1_SIGMA_17

#define T1_SIGMA_17   (1U << 17)

◆ T1_SIGMA_2

#define T1_SIGMA_2   (1U << 2)

Referenced by t1_init_ctxno_zc().

◆ T1_SIGMA_3

#define T1_SIGMA_3   (1U << 3)

◆ T1_SIGMA_4

#define T1_SIGMA_4   (1U << 4)

◆ T1_SIGMA_5

#define T1_SIGMA_5   (1U << 5)

◆ T1_SIGMA_6

#define T1_SIGMA_6   (1U << 6)

Referenced by t1_init_ctxno_zc().

◆ T1_SIGMA_7

◆ T1_SIGMA_8

#define T1_SIGMA_8   (1U << 8)

Referenced by t1_init_ctxno_zc().

◆ T1_SIGMA_9

#define T1_SIGMA_9   (1U << 9)

◆ T1_SIGMA_E

#define T1_SIGMA_E   T1_SIGMA_5

◆ T1_SIGMA_N

#define T1_SIGMA_N   T1_SIGMA_1

◆ T1_SIGMA_NE

#define T1_SIGMA_NE   T1_SIGMA_2

◆ T1_SIGMA_NEIGHBOURS

#define T1_SIGMA_NEIGHBOURS
Value:
#define T1_SIGMA_W
Definition mqc_base.h:117
#define T1_SIGMA_NE
Definition mqc_base.h:116
#define T1_SIGMA_SW
Definition mqc_base.h:120
#define T1_SIGMA_NW
As an example, the bits T1_SIGMA_3, T1_SIGMA_4 and T1_SIGMA_5 indicate the significance state of the ...
Definition mqc_base.h:114
#define T1_SIGMA_N
Definition mqc_base.h:115
#define T1_SIGMA_S
Definition mqc_base.h:121
#define T1_SIGMA_SE
Definition mqc_base.h:122
#define T1_SIGMA_E
Definition mqc_base.h:119

Referenced by grk::t1::BlockCoder::dec_sigpass_step_raw().

◆ T1_SIGMA_NW

#define T1_SIGMA_NW   T1_SIGMA_0

As an example, the bits T1_SIGMA_3, T1_SIGMA_4 and T1_SIGMA_5 indicate the significance state of the west neighbour of data point zero of our four, the point itself, and its east neighbour respectively.

Many of the bits are arranged so that given a flags word, you can look at the values for the data point 0, then shift the flags word right by 3 bits and look at the same bit positions to see the values for data point 1.

The #defines below help a bit with this; say you have a flags word f, you can do things like

(f & T1_SIGMA_THIS)

to see the significance bit of data point 0, then do

((f >> 3) & T1_SIGMA_THIS)

to see the significance bit of data point 1.

◆ T1_SIGMA_S

#define T1_SIGMA_S   T1_SIGMA_7

◆ T1_SIGMA_SE

#define T1_SIGMA_SE   T1_SIGMA_8

◆ T1_SIGMA_SW

#define T1_SIGMA_SW   T1_SIGMA_6

◆ T1_SIGMA_THIS

◆ T1_SIGMA_W

#define T1_SIGMA_W   T1_SIGMA_3

◆ T1_TYPE_MQ

#define T1_TYPE_MQ   0 /** Normal coding using entropy coder */

◆ T1_TYPE_RAW

#define T1_TYPE_RAW   1 /** Raw compressing*/

◆ UPDATE_FLAGS

#define UPDATE_FLAGS ( flags,
flagsPtr,
ci,
s,
stride,
vsc )
Value:
{ \
/* east */ \
flagsPtr[-1] |= T1_SIGMA_5 << (ci); \
/* mark target as significant */ \
flags |= ((s << T1_CHI_1_I) | T1_SIGMA_4) << (ci); \
/* west */ \
flagsPtr[1] |= T1_SIGMA_3 << (ci); \
/* north-west, north, north-east */ \
if(ci == 0U && !(vsc)) \
{ \
auto north = flagsPtr - (stride); \
*north |= (s << T1_CHI_5_I) | T1_SIGMA_16; \
north[-1] |= T1_SIGMA_17; \
north[1] |= T1_SIGMA_15; \
} \
/* south-west, south, south-east */ \
if(ci == 9U) \
{ \
auto south = flagsPtr + (stride); \
*south |= (s << T1_CHI_0_I) | T1_SIGMA_1; \
south[-1] |= T1_SIGMA_2; \
south[1] |= T1_SIGMA_0; \
} \
}
#define T1_SIGMA_15
Definition mqc_base.h:70
#define T1_SIGMA_16
Definition mqc_base.h:71
#define T1_CHI_0_I
Definition mqc_base.h:74
#define T1_SIGMA_17
Definition mqc_base.h:72
#define T1_CHI_1_I
Definition mqc_base.h:76
#define T1_SIGMA_3
Definition mqc_base.h:58
#define T1_SIGMA_5
Definition mqc_base.h:60
#define T1_SIGMA_4
Definition mqc_base.h:59
#define T1_SIGMA_0
We hold the state of individual data points for the BlockCoder compressor using a single 32-bit flags...
Definition mqc_base.h:55
#define T1_SIGMA_1
Definition mqc_base.h:56
#define T1_SIGMA_2
Definition mqc_base.h:57
#define T1_CHI_5_I
Definition mqc_base.h:92

Referenced by grk::t1::update_flags().