TUT HEVC Encoder
Loading...
Searching...
No Matches
context.c File Reference
#include "context.h"
#include "tables.h"
Include dependency graph for context.c:

Functions

void kvz_ctx_init (cabac_ctx_t *ctx, uint32_t qp, uint32_t init_value)
 Initialize struct cabac_ctx.
 
void kvz_init_contexts (encoder_state_t *state, int8_t QP, int8_t slice)
 Initialize cabac context to be used for coding.
 
void kvz_context_copy (encoder_state_t *const target_state, const encoder_state_t *const source_state)
 
uint32_t kvz_context_get_sig_coeff_group (uint32_t *sig_coeff_group_flag, uint32_t pos_x, uint32_t pos_y, int32_t width)
 
int32_t kvz_context_calc_pattern_sig_ctx (const uint32_t *sig_coeff_group_flag, uint32_t pos_x, uint32_t pos_y, int32_t width)
 Pattern decision for context derivation process of significant_coeff_flag.
 
int32_t kvz_context_get_sig_ctx_inc (int32_t pattern_sig_ctx, uint32_t scan_idx, int32_t pos_x, int32_t pos_y, int32_t block_type, int8_t texture_type)
 Context derivation process of coeff_abs_significant_flag.
 

Variables

static const uint8_t INIT_SAO_MERGE_FLAG [3] = { 153, 153, 153 }
 
static const uint8_t INIT_SAO_TYPE_IDX [3] = { 160, 185, 200 }
 
static const uint8_t INIT_QT_ROOT_CBF [3][1]
 
static const uint8_t INIT_MVP_IDX [3][2]
 
static const uint8_t INIT_REF_PIC [3][2]
 
static const uint8_t INIT_MVD [3][2]
 
static const uint8_t INIT_MERGE_FLAG_EXT [3][1]
 
static const uint8_t INIT_MERGE_IDX_EXT [3][1]
 
static const uint8_t INIT_CU_TRANSQUANT_BYPASS [3][1]
 
static const uint8_t INIT_SKIP_FLAG [3][3]
 
static const uint8_t INIT_PRED_MODE [3][1]
 
static const uint8_t INIT_PART_SIZE [3][4]
 
static const uint8_t INIT_SPLIT_FLAG [3][3]
 
static const uint8_t INIT_INTRA_PRED_MODE [3]
 
static const uint8_t INIT_CHROMA_PRED_MODE [3][2]
 
static const uint8_t INIT_INTER_DIR [3][5]
 
static const uint8_t INIT_TRANS_SUBDIV_FLAG [3][3]
 
static const uint8_t INIT_QT_CBF [3][8]
 
static const uint8_t INIT_CU_QP_DELTA_ABS [3][2]
 
static const uint8_t INIT_SIG_CG_FLAG [3][4]
 
static const uint8_t INIT_SIG_FLAG [3][42]
 
static const uint8_t INIT_LAST [3][30]
 
static const uint8_t INIT_ONE_FLAG [3][24]
 
static const uint8_t INIT_ABS_FLAG [3][6]
 
static const uint8_t INIT_TRANSFORMSKIP_FLAG [3][2]
 

Function Documentation

◆ kvz_context_calc_pattern_sig_ctx()

int32_t kvz_context_calc_pattern_sig_ctx ( const uint32_t * sig_coeff_group_flag,
uint32_t pos_x,
uint32_t pos_y,
int32_t width )
Parameters
sig_coeff_group_flagpointer to prior coded significant coeff group
pos_xcolumn of current coefficient group
pos_yrow of current coefficient group
widthwidth of the block
Returns
pattern for current coefficient group
Here is the caller graph for this function:

◆ kvz_context_copy()

void kvz_context_copy ( encoder_state_t *const target_state,
const encoder_state_t *const source_state )
Here is the caller graph for this function:

◆ kvz_context_get_sig_coeff_group()

uint32_t kvz_context_get_sig_coeff_group ( uint32_t * sig_coeff_group_flag,
uint32_t pos_x,
uint32_t pos_y,
int32_t width )
Here is the caller graph for this function:

◆ kvz_context_get_sig_ctx_inc()

int32_t kvz_context_get_sig_ctx_inc ( int32_t pattern_sig_ctx,
uint32_t scan_idx,
int32_t pos_x,
int32_t pos_y,
int32_t block_type,
int8_t texture_type )
Parameters
pattern_sig_ctxpattern for current coefficient group
scan_idxpixel scan type in use
pos_xcolumn of current scan position
pos_yrow of current scan position
block_typelog2 value of block size if square block, or 4 otherwise
widthwidth of the block
texture_typetexture type (TEXT_LUMA...)
Returns
ctx_inc for current scan position
Here is the caller graph for this function:

◆ kvz_ctx_init()

void kvz_ctx_init ( cabac_ctx_t * ctx,
uint32_t qp,
uint32_t init_value )
Here is the caller graph for this function:

◆ kvz_init_contexts()

void kvz_init_contexts ( encoder_state_t * state,
int8_t QP,
int8_t slice )
Parameters
encoderencoder control struct
slicetype of slice we are coding (P/B/I)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ INIT_ABS_FLAG

const uint8_t INIT_ABS_FLAG[3][6]
static
Initial value:
=
{
{ 107,167, 91,107,107,167},
{ 107,167, 91,122,107,167},
{ 138,153,136,167,152,152},
}

◆ INIT_CHROMA_PRED_MODE

const uint8_t INIT_CHROMA_PRED_MODE[3][2]
static
Initial value:
= {
{ 152, 139 },
{ 152, 139 },
{ 63, 139 },
}

◆ INIT_CU_QP_DELTA_ABS

const uint8_t INIT_CU_QP_DELTA_ABS[3][2]
static
Initial value:
= {
{ 154, 154 },
{ 154, 154 },
{ 154, 154 },
}

◆ INIT_CU_TRANSQUANT_BYPASS

const uint8_t INIT_CU_TRANSQUANT_BYPASS[3][1]
static
Initial value:
= {
{ 154, },
{ 154, },
{ 154, },
}

◆ INIT_INTER_DIR

const uint8_t INIT_INTER_DIR[3][5]
static
Initial value:
= {
{ 95, 79, 63, 31, 31, },
{ 95, 79, 63, 31, 31, },
{ 154 , 154 , 154 , 154 , 154 , },
}

◆ INIT_INTRA_PRED_MODE

const uint8_t INIT_INTRA_PRED_MODE[3]
static
Initial value:
= {
183, 154, 184
}

◆ INIT_LAST

const uint8_t INIT_LAST[3][30]
static
Initial value:
= {
{ 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79,
108, 123, 93, 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 },
{ 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94,
108, 123, 108, 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 },
{ 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79,
108, 123, 63, 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 , 154 },
}

◆ INIT_MERGE_FLAG_EXT

const uint8_t INIT_MERGE_FLAG_EXT[3][1]
static
Initial value:
= {
{ 154, },
{ 110, },
{ 154 , },
}

◆ INIT_MERGE_IDX_EXT

const uint8_t INIT_MERGE_IDX_EXT[3][1]
static
Initial value:
= {
{ 137, },
{ 122, },
{ 154 , },
}

◆ INIT_MVD

const uint8_t INIT_MVD[3][2]
static
Initial value:
= {
{ 169, 198, },
{ 140, 198, },
{ 154 , 154 , },
}

◆ INIT_MVP_IDX

const uint8_t INIT_MVP_IDX[3][2]
static
Initial value:
= {
{ 168, 154 , },
{ 168, 154 , },
{ 154 , 154 , },
}

◆ INIT_ONE_FLAG

const uint8_t INIT_ONE_FLAG[3][24]
static
Initial value:
=
{
{154,196,167,167,154,152,167,182,182,134,149,136,153,121,136,122,169,208,166,167,154,152,167,182},
{154,196,196,167,154,152,167,182,182,134,149,136,153,121,136,137,169,194,166,167,154,167,137,182},
{140, 92,137,138,140,152,138,139,153, 74,149, 92,139,107,122,152,140,179,166,182,140,227,122,197},
}

◆ INIT_PART_SIZE

const uint8_t INIT_PART_SIZE[3][4]
static
Initial value:
= {
{ 154, 139, 154 , 154 , },
{ 154, 139, 154 , 154 , },
{ 184, 154 , 154 , 154 , },
}

◆ INIT_PRED_MODE

const uint8_t INIT_PRED_MODE[3][1]
static
Initial value:
= {
{ 134, },
{ 149, },
{ 154 , },
}

◆ INIT_QT_CBF

const uint8_t INIT_QT_CBF[3][8]
static
Initial value:
= {
{ 153, 111, 154 , 154 , 149, 92, 167, 154 },
{ 153, 111, 154 , 154 , 149, 107, 167, 154 },
{ 111, 141, 154 , 154 , 94, 138, 182, 154 },
}

◆ INIT_QT_ROOT_CBF

const uint8_t INIT_QT_ROOT_CBF[3][1]
static
Initial value:
= {
{ 79, },
{ 79, },
{ 154 , },
}

◆ INIT_REF_PIC

const uint8_t INIT_REF_PIC[3][2]
static
Initial value:
= {
{ 153, 153 },
{ 153, 153 },
{ 154 , 154 },
}

◆ INIT_SAO_MERGE_FLAG

const uint8_t INIT_SAO_MERGE_FLAG[3] = { 153, 153, 153 }
static

◆ INIT_SAO_TYPE_IDX

const uint8_t INIT_SAO_TYPE_IDX[3] = { 160, 185, 200 }
static

◆ INIT_SIG_CG_FLAG

const uint8_t INIT_SIG_CG_FLAG[3][4]
static
Initial value:
= {
{ 121, 140, 61, 154 },
{ 121, 140, 61, 154 },
{ 91, 171, 134, 141 },
}

◆ INIT_SIG_FLAG

const uint8_t INIT_SIG_FLAG[3][42]
static
Initial value:
= {
{170,154,139,153,139,123,123, 63,124,166,
183,140,136,153,154,166,183,140,136,153,
154,166,183,140,136,153,154,170,153,138,
138,122,121,122,121,167,151,183,140,151,
183,140},
{155,154,139,153,139,123,123,63,153,166,
183,140,136,153,154,166,183,140,136,153,
154,166,183,140,136,153,154,170,153,123,
123,107,121,107,121,167,151,183,140,151,
183,140},
{111,111,125,110,110,94,124,108,124,107,
125,141,179,153,125,107,125,141,179,153,
125,107,125,141,179,153,125,140,139,182,
182,152,136,152,136,153,136,139,111,136,
139,111},
}

◆ INIT_SKIP_FLAG

const uint8_t INIT_SKIP_FLAG[3][3]
static
Initial value:
= {
{ 197, 185, 201, },
{ 197, 185, 201, },
{ 154 , 154 , 154 , },
}

◆ INIT_SPLIT_FLAG

const uint8_t INIT_SPLIT_FLAG[3][3]
static
Initial value:
= {
{ 107, 139, 126 },
{ 107, 139, 126 },
{ 139, 141, 157 },
}

◆ INIT_TRANS_SUBDIV_FLAG

const uint8_t INIT_TRANS_SUBDIV_FLAG[3][3]
static
Initial value:
= {
{ 224, 167, 122 },
{ 124, 138, 94 },
{ 153, 138, 138 },
}

◆ INIT_TRANSFORMSKIP_FLAG

const uint8_t INIT_TRANSFORMSKIP_FLAG[3][2]
static
Initial value:
=
{
{ 139, 139},
{ 139, 139},
{ 139, 139},
}