Grok  7.6.0
Data Structures | Namespaces | Macros | Typedefs | Functions
t1.h File Reference
#include "t1_flags.h"

Go to the source code of this file.

Data Structures

struct  grk::t1_info
 

Namespaces

 grk
 Copyright (C) 2016-2020 Grok Image Compression Inc.
 

Macros

#define T1_NUMCTXS_ZC   9
 
#define T1_NUMCTXS_SC   5
 
#define T1_NUMCTXS_MAG   3
 
#define T1_NUMCTXS_AGG   1
 
#define T1_NUMCTXS_UNI   1
 
#define T1_CTXNO_ZC   0
 
#define T1_CTXNO_SC   (T1_CTXNO_ZC+T1_NUMCTXS_ZC)
 
#define T1_CTXNO_MAG   (T1_CTXNO_SC+T1_NUMCTXS_SC)
 
#define T1_CTXNO_AGG   (T1_CTXNO_MAG+T1_NUMCTXS_MAG)
 
#define T1_CTXNO_UNI   (T1_CTXNO_AGG+T1_NUMCTXS_AGG)
 
#define T1_NUMCTXS   (T1_CTXNO_UNI+T1_NUMCTXS_UNI)
 
#define T1_SIGMA_0   (1U << 0)
 We hold the state of individual data points for the T1 encoder using a single 32-bit flags word to hold the state of 4 data points. More...
 
#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_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. More...
 
#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   (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)
 
#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)
 

Typedefs

typedef uint32_t grk::grk_flag
 Flags for 4 consecutive rows of a column. More...
 

Functions

bool grk::t1_decode_cblk (t1_info *t1, cblk_dec *cblk, uint32_t orient, uint32_t roishift, uint32_t cblksty)
 
void grk::t1_code_block_enc_deallocate (cblk_enc *p_code_block)
 
bool grk::t1_allocate_buffers (t1_info *t1, uint32_t w, uint32_t h)
 
double grk::t1_encode_cblk (t1_info *t1, cblk_enc *cblk, uint32_t max, uint8_t orient, uint32_t compno, uint32_t level, uint32_t qmfbid, double stepsize, uint32_t cblksty, const double *mct_norms, uint32_t mct_numcomps, bool doRateControl)
 
t1_info * grk::t1_create (bool isEncoder)
 
void grk::t1_destroy (t1_info *p_t1)
 

Macro Definition Documentation

◆ 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_CTXNO_AGG

#define T1_CTXNO_AGG   (T1_CTXNO_MAG+T1_NUMCTXS_MAG)

◆ T1_CTXNO_MAG

#define T1_CTXNO_MAG   (T1_CTXNO_SC+T1_NUMCTXS_SC)

◆ T1_CTXNO_SC

#define T1_CTXNO_SC   (T1_CTXNO_ZC+T1_NUMCTXS_ZC)

◆ T1_CTXNO_UNI

#define T1_CTXNO_UNI   (T1_CTXNO_AGG+T1_NUMCTXS_AGG)

◆ T1_CTXNO_ZC

#define T1_CTXNO_ZC   0

◆ T1_LUT_SGN_E

#define T1_LUT_SGN_E   (1U << 2)

◆ T1_LUT_SGN_N

#define T1_LUT_SGN_N   (1U << 4)

◆ T1_LUT_SGN_S

#define T1_LUT_SGN_S   (1U << 6)

◆ T1_LUT_SGN_W

#define T1_LUT_SGN_W   (1U << 0)

◆ T1_LUT_SIG_E

#define T1_LUT_SIG_E   (1U << 5)

◆ T1_LUT_SIG_N

#define T1_LUT_SIG_N   (1U << 1)

◆ T1_LUT_SIG_S

#define T1_LUT_SIG_S   (1U << 7)

◆ T1_LUT_SIG_W

#define T1_LUT_SIG_W   (1U << 3)

◆ T1_MU_THIS

#define T1_MU_THIS   T1_MU_0

◆ T1_NUMCTXS

#define T1_NUMCTXS   (T1_CTXNO_UNI+T1_NUMCTXS_UNI)

◆ T1_NUMCTXS_AGG

#define T1_NUMCTXS_AGG   1

◆ T1_NUMCTXS_MAG

#define T1_NUMCTXS_MAG   3

◆ T1_NUMCTXS_SC

#define T1_NUMCTXS_SC   5

◆ T1_NUMCTXS_UNI

#define T1_NUMCTXS_UNI   1

◆ T1_NUMCTXS_ZC

#define T1_NUMCTXS_ZC   9

◆ T1_PI_THIS

#define T1_PI_THIS   T1_PI_0

◆ T1_SIGMA_0

#define T1_SIGMA_0   (1U << 0)

We hold the state of individual data points for the T1 encoder 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.

This is currently done for encoding only. The values must NOT be changed, otherwise this is going to break a lot of assumptions.

◆ 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)

◆ 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)

◆ T1_SIGMA_7

#define T1_SIGMA_7   (1U << 7)

◆ T1_SIGMA_8

#define T1_SIGMA_8   (1U << 8)

◆ 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   (T1_SIGMA_NW | T1_SIGMA_N | T1_SIGMA_NE | T1_SIGMA_W | T1_SIGMA_E | T1_SIGMA_SW | T1_SIGMA_S | T1_SIGMA_SE)

◆ 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

#define T1_SIGMA_THIS   T1_SIGMA_4

◆ T1_SIGMA_W

#define T1_SIGMA_W   T1_SIGMA_3