mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Context changes for chroma pred modes. BT flag init and chroma pred mode init moved inside a loop.
This commit is contained in:
parent
54ebadfc43
commit
578122ed43
|
@ -56,7 +56,7 @@ typedef struct
|
|||
cabac_ctx_t split_flag_model[5]; //!< \brief split flag context models
|
||||
cabac_ctx_t bt_split_flag_model[12]; //!< \brief bt split flag context models
|
||||
cabac_ctx_t intra_mode_model; //!< \brief intra mode context models
|
||||
cabac_ctx_t chroma_pred_model[2];
|
||||
cabac_ctx_t chroma_pred_model[12];
|
||||
cabac_ctx_t inter_dir[5];
|
||||
cabac_ctx_t trans_subdiv_model[3]; //!< \brief intra mode context models
|
||||
cabac_ctx_t qt_cbf_model_luma[5];
|
||||
|
|
|
@ -104,10 +104,10 @@ static const uint8_t INIT_INTRA_PRED_MODE[3] = {
|
|||
183, 154, 184
|
||||
};
|
||||
|
||||
static const uint8_t INIT_CHROMA_PRED_MODE[3][2] = {
|
||||
{ 152, 139 },
|
||||
{ 152, 139 },
|
||||
{ 63, 139 },
|
||||
static const uint8_t INIT_CHROMA_PRED_MODE[3][12] = {
|
||||
{ 139, 152, 139, 154, 154, 154, 154, 154, 154, 154, 154, 154, },
|
||||
{ 139, 152, 139, 154, 154, 154, 154, 154, 154, 154, 154, 154, },
|
||||
{ 139, 63, 139, 154, 154, 154, 154, 154, 154, 154, 154, 154, },
|
||||
};
|
||||
|
||||
static const uint8_t INIT_INTER_DIR[3][5] = {
|
||||
|
@ -281,23 +281,15 @@ void kvz_init_contexts(encoder_state_t *state, int8_t QP, int8_t slice)
|
|||
kvz_ctx_init(&cabac->ctx.split_flag_model[4], QP, INIT_SPLIT_FLAG[slice][4]);
|
||||
|
||||
// BT split flag init
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[0], QP, INIT_BT_SPLIT_FLAG[slice][0]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[1], QP, INIT_BT_SPLIT_FLAG[slice][1]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[2], QP, INIT_BT_SPLIT_FLAG[slice][2]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[3], QP, INIT_BT_SPLIT_FLAG[slice][3]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[4], QP, INIT_BT_SPLIT_FLAG[slice][4]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[5], QP, INIT_BT_SPLIT_FLAG[slice][5]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[6], QP, INIT_BT_SPLIT_FLAG[slice][6]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[7], QP, INIT_BT_SPLIT_FLAG[slice][7]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[8], QP, INIT_BT_SPLIT_FLAG[slice][8]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[9], QP, INIT_BT_SPLIT_FLAG[slice][9]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[10], QP, INIT_BT_SPLIT_FLAG[slice][10]);
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[11], QP, INIT_BT_SPLIT_FLAG[slice][11]);
|
||||
for (i = 0; i < 12; i++) {
|
||||
kvz_ctx_init(&cabac->ctx.bt_split_flag_model[i], QP, INIT_BT_SPLIT_FLAG[slice][i]);
|
||||
}
|
||||
|
||||
kvz_ctx_init(&cabac->ctx.intra_mode_model, QP, INIT_INTRA_PRED_MODE[slice]);
|
||||
|
||||
kvz_ctx_init(&cabac->ctx.chroma_pred_model[0], QP, INIT_CHROMA_PRED_MODE[slice][0]);
|
||||
kvz_ctx_init(&cabac->ctx.chroma_pred_model[1], QP, INIT_CHROMA_PRED_MODE[slice][1]);
|
||||
for (i = 0; i < 12; i++) {
|
||||
kvz_ctx_init(&cabac->ctx.chroma_pred_model[i], QP, INIT_CHROMA_PRED_MODE[slice][i]);
|
||||
}
|
||||
|
||||
//TODO: ignore P/B contexts on intra frame
|
||||
kvz_ctx_init(&cabac->ctx.cu_qt_root_cbf_model, QP, INIT_QT_ROOT_CBF[slice][0]);
|
||||
|
|
|
@ -867,7 +867,7 @@ static void encode_intra_coding_unit(encoder_state_t * const state,
|
|||
* Table 9-37 - Assignment of ctxInc to syntax elements with context coded bins
|
||||
* intra_chroma_pred_mode[][] = 0, bypass, bypass
|
||||
*/
|
||||
cabac->cur_ctx = &(cabac->ctx.chroma_pred_model[0]);
|
||||
cabac->cur_ctx = &(cabac->ctx.chroma_pred_model[1]);
|
||||
if (pred_mode == 4) {
|
||||
CABAC_BIN(cabac, 0, "intra_chroma_pred_mode");
|
||||
} else {
|
||||
|
|
|
@ -677,7 +677,7 @@ double kvz_luma_mode_bits(const encoder_state_t *state, int8_t luma_mode, const
|
|||
|
||||
double kvz_chroma_mode_bits(const encoder_state_t *state, int8_t chroma_mode, int8_t luma_mode)
|
||||
{
|
||||
const cabac_ctx_t *ctx = &(state->cabac.ctx.chroma_pred_model[0]);
|
||||
const cabac_ctx_t *ctx = &(state->cabac.ctx.chroma_pred_model[1]);
|
||||
double mode_bits;
|
||||
if (chroma_mode == luma_mode) {
|
||||
mode_bits = CTX_ENTROPY_FBITS(ctx, 0);
|
||||
|
|
Loading…
Reference in a new issue