diff --git a/av1/encoder/context_tree.c b/av1/encoder/context_tree.c index 5a26d9bc42de858d34d3440bcfdd876797cf8339..e1db4bebe2712048980f73f6a72492e395fc6afd 100644 --- a/av1/encoder/context_tree.c +++ b/av1/encoder/context_tree.c @@ -26,7 +26,7 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, PICK_MODE_CONTEXT *ctx) { const int num_blk = (num_4x4_blk < 4 ? 4 : num_4x4_blk); const int num_pix = num_blk << 4; - int i, k; + int i; ctx->num_4x4_blk = num_blk; #if CONFIG_EXT_PARTITION_TYPES ctx->partition = partition; @@ -36,16 +36,14 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, #if CONFIG_VAR_TX CHECK_MEM_ERROR(cm, ctx->blk_skip[i], aom_calloc(num_blk, sizeof(uint8_t))); #endif - for (k = 0; k < 3; ++k) { - CHECK_MEM_ERROR(cm, ctx->coeff[i][k], - aom_memalign(32, num_pix * sizeof(*ctx->coeff[i][k]))); - CHECK_MEM_ERROR(cm, ctx->qcoeff[i][k], - aom_memalign(32, num_pix * sizeof(*ctx->qcoeff[i][k]))); - CHECK_MEM_ERROR(cm, ctx->dqcoeff[i][k], - aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i][k]))); - CHECK_MEM_ERROR(cm, ctx->eobs[i][k], - aom_memalign(32, num_blk * sizeof(*ctx->eobs[i][k]))); - } + CHECK_MEM_ERROR(cm, ctx->coeff[i], + aom_memalign(32, num_pix * sizeof(*ctx->coeff[i]))); + CHECK_MEM_ERROR(cm, ctx->qcoeff[i], + aom_memalign(32, num_pix * sizeof(*ctx->qcoeff[i]))); + CHECK_MEM_ERROR(cm, ctx->dqcoeff[i], + aom_memalign(32, num_pix * sizeof(*ctx->dqcoeff[i]))); + CHECK_MEM_ERROR(cm, ctx->eobs[i], + aom_memalign(32, num_blk * sizeof(*ctx->eobs[i]))); #if CONFIG_PVQ CHECK_MEM_ERROR(cm, ctx->pvq_ref_coeff[i], aom_memalign(32, num_pix * sizeof(*ctx->pvq_ref_coeff[i]))); @@ -64,26 +62,24 @@ static void alloc_mode_context(AV1_COMMON *cm, int num_4x4_blk, } static void free_mode_context(PICK_MODE_CONTEXT *ctx) { - int i, k; + int i; for (i = 0; i < MAX_MB_PLANE; ++i) { #if CONFIG_VAR_TX aom_free(ctx->blk_skip[i]); ctx->blk_skip[i] = 0; #endif - for (k = 0; k < 3; ++k) { - aom_free(ctx->coeff[i][k]); - ctx->coeff[i][k] = 0; - aom_free(ctx->qcoeff[i][k]); - ctx->qcoeff[i][k] = 0; - aom_free(ctx->dqcoeff[i][k]); - ctx->dqcoeff[i][k] = 0; + aom_free(ctx->coeff[i]); + ctx->coeff[i] = 0; + aom_free(ctx->qcoeff[i]); + ctx->qcoeff[i] = 0; + aom_free(ctx->dqcoeff[i]); + ctx->dqcoeff[i] = 0; #if CONFIG_PVQ - aom_free(ctx->pvq_ref_coeff[i]); - ctx->pvq_ref_coeff[i] = 0; + aom_free(ctx->pvq_ref_coeff[i]); + ctx->pvq_ref_coeff[i] = 0; #endif - aom_free(ctx->eobs[i][k]); - ctx->eobs[i][k] = 0; - } + aom_free(ctx->eobs[i]); + ctx->eobs[i] = 0; } #if CONFIG_PALETTE diff --git a/av1/encoder/context_tree.h b/av1/encoder/context_tree.h index 7453a666936fcaf451cfad5b072339578a3ae0a7..7496d119387077152c7e95b2ef5102fc14b57aa8 100644 --- a/av1/encoder/context_tree.h +++ b/av1/encoder/context_tree.h @@ -35,13 +35,13 @@ typedef struct { #endif // dual buffer pointers, 0: in use, 1: best in store - tran_low_t *coeff[MAX_MB_PLANE][3]; - tran_low_t *qcoeff[MAX_MB_PLANE][3]; - tran_low_t *dqcoeff[MAX_MB_PLANE][3]; + tran_low_t *coeff[MAX_MB_PLANE]; + tran_low_t *qcoeff[MAX_MB_PLANE]; + tran_low_t *dqcoeff[MAX_MB_PLANE]; #if CONFIG_PVQ tran_low_t *pvq_ref_coeff[MAX_MB_PLANE]; #endif - uint16_t *eobs[MAX_MB_PLANE][3]; + uint16_t *eobs[MAX_MB_PLANE]; int num_4x4_blk; int skip; diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 0a301861960fe2971eea375c4857a6b563b89437..f4ca1363e1462a5304f9fb7a0f1bde822761db5a 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c @@ -1036,7 +1036,6 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td, const int mis = cm->mi_stride; const int mi_width = num_8x8_blocks_wide_lookup[bsize]; const int mi_height = num_8x8_blocks_high_lookup[bsize]; - int max_plane; #if CONFIG_REF_MV int8_t rf_type; @@ -1086,24 +1085,15 @@ static void update_state(const AV1_COMP *const cpi, ThreadData *td, } } - max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; - for (i = 0; i < max_plane; ++i) { - p[i].coeff = ctx->coeff[i][1]; - p[i].qcoeff = ctx->qcoeff[i][1]; - pd[i].dqcoeff = ctx->dqcoeff[i][1]; - p[i].eobs = ctx->eobs[i][1]; - } - - for (i = max_plane; i < MAX_MB_PLANE; ++i) { - p[i].coeff = ctx->coeff[i][2]; - p[i].qcoeff = ctx->qcoeff[i][2]; - pd[i].dqcoeff = ctx->dqcoeff[i][2]; + for (i = 0; i < MAX_MB_PLANE; ++i) { + p[i].coeff = ctx->coeff[i]; + p[i].qcoeff = ctx->qcoeff[i]; + pd[i].dqcoeff = ctx->dqcoeff[i]; #if CONFIG_PVQ pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; #endif - p[i].eobs = ctx->eobs[i][2]; + p[i].eobs = ctx->eobs[i]; } - #if CONFIG_PALETTE for (i = 0; i < 2; ++i) pd[i].color_index_map = ctx->color_index_map[i]; #endif // CONFIG_PALETTE @@ -1484,10 +1474,10 @@ static void update_state_sb_supertx(const AV1_COMP *const cpi, ThreadData *td, for (i = 0; i < MAX_MB_PLANE; ++i) { if (pmc != NULL) { - p[i].coeff = pmc->coeff[i][1]; - p[i].qcoeff = pmc->qcoeff[i][1]; - pd[i].dqcoeff = pmc->dqcoeff[i][1]; - p[i].eobs = pmc->eobs[i][1]; + p[i].coeff = pmc->coeff[i]; + p[i].qcoeff = pmc->qcoeff[i]; + pd[i].dqcoeff = pmc->dqcoeff[i]; + p[i].eobs = pmc->eobs[i]; } else { // These should never be used p[i].coeff = NULL; @@ -1661,13 +1651,13 @@ static void rd_pick_sb_modes(const AV1_COMP *const cpi, TileDataEnc *tile_data, #endif for (i = 0; i < MAX_MB_PLANE; ++i) { - p[i].coeff = ctx->coeff[i][0]; - p[i].qcoeff = ctx->qcoeff[i][0]; - pd[i].dqcoeff = ctx->dqcoeff[i][0]; + p[i].coeff = ctx->coeff[i]; + p[i].qcoeff = ctx->qcoeff[i]; + pd[i].dqcoeff = ctx->dqcoeff[i]; #if CONFIG_PVQ pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; #endif - p[i].eobs = ctx->eobs[i][0]; + p[i].eobs = ctx->eobs[i]; } #if CONFIG_PALETTE diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index 52a1cce8e0a82261b50a071f7ebe265904a778cc..1ea28f21928a98fb9c9a08e7645db60f746f40c3 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c @@ -562,13 +562,13 @@ void av1_first_pass(AV1_COMP *cpi, const struct lookahead_entry *source) { #endif for (i = 0; i < MAX_MB_PLANE; ++i) { - p[i].coeff = ctx->coeff[i][1]; - p[i].qcoeff = ctx->qcoeff[i][1]; - pd[i].dqcoeff = ctx->dqcoeff[i][1]; + p[i].coeff = ctx->coeff[i]; + p[i].qcoeff = ctx->qcoeff[i]; + pd[i].dqcoeff = ctx->dqcoeff[i]; #if CONFIG_PVQ pd[i].pvq_ref_coeff = ctx->pvq_ref_coeff[i]; #endif - p[i].eobs = ctx->eobs[i][1]; + p[i].eobs = ctx->eobs[i]; } av1_init_mv_probs(cm);