diff --git a/src/context.c b/src/context.c index 3892f1b3..630e61d7 100644 --- a/src/context.c +++ b/src/context.c @@ -211,13 +211,13 @@ static const uint8_t INIT_GTX_FLAG[4][3][21] = } }; -static const uint8_t INIT_LAST[3][30] = { - { 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79, - 108, 123, 93, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, - { 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94, - 108, 123, 108, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, - { 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79, - 108, 123, 63, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, +static const uint8_t INIT_LAST[3][38] = { + { 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111, 79, 126, 111, 111, 79, + 108, 123, 93, 154, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, + { 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95, 94, 111, 111, 95, 94, + 108, 123, 108, 154, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, + { 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111, 79, 143, 127, 111, 79, + 108, 123, 63, 154, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU, CNU }, }; static const uint8_t INIT_TRANSFORMSKIP_FLAG[3][2] = @@ -324,12 +324,12 @@ void kvz_init_contexts(encoder_state_t *state, int8_t QP, int8_t slice) kvz_ctx_init(&cabac->ctx.inter_dir[i], QP, INIT_INTER_DIR[slice][i]); } - for (i = 0; i < 15; i++) { + for (i = 0; i < 19; i++) { kvz_ctx_init(&cabac->ctx.cu_ctx_last_y_luma[i], QP, INIT_LAST[slice][i] ); kvz_ctx_init(&cabac->ctx.cu_ctx_last_x_luma[i], QP, INIT_LAST[slice][i] ); - kvz_ctx_init(&cabac->ctx.cu_ctx_last_y_chroma[i], QP, INIT_LAST[slice][i+15] ); - kvz_ctx_init(&cabac->ctx.cu_ctx_last_x_chroma[i], QP, INIT_LAST[slice][i+15] ); + kvz_ctx_init(&cabac->ctx.cu_ctx_last_y_chroma[i], QP, INIT_LAST[slice][i+19] ); + kvz_ctx_init(&cabac->ctx.cu_ctx_last_x_chroma[i], QP, INIT_LAST[slice][i+19] ); } diff --git a/src/encoderstate.h b/src/encoderstate.h index 6ea5e28e..38308f2e 100644 --- a/src/encoderstate.h +++ b/src/encoderstate.h @@ -342,11 +342,20 @@ static INLINE bool is_last_cu_in_qg(const encoder_state_t *state, int x, int y, } -static const uint8_t g_group_idx[32] = { +static const uint8_t g_group_idx[128] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, - 9, 9 }; + 9, 9,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,11,11, + 11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,12,12,12,12, + 12,12,12,12,12,12,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13 }; static const uint8_t g_min_in_group[10] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24 };