From 5f8ea94c1fbde1c2f9a79c7cabc8c3b4af05e424 Mon Sep 17 00:00:00 2001 From: Debargha Mukherjee Date: Thu, 14 Jul 2016 12:28:21 -0700 Subject: [PATCH] Remove unused zcoeff_blk from PICK_MODE_CONTEXT and MACROBLOCK Change-Id: I42f98ce51871948244bdcaaaeb3d0191622116ae --- vp10/encoder/block.h | 3 --- vp10/encoder/context_tree.c | 4 --- vp10/encoder/context_tree.h | 1 - vp10/encoder/encodeframe.c | 9 ------- vp10/encoder/encodemb.c | 10 ------- vp10/encoder/rdopt.c | 54 +++---------------------------------- 6 files changed, 4 insertions(+), 77 deletions(-) diff --git a/vp10/encoder/block.h b/vp10/encoder/block.h index 4c9f8a5d4..c39aa21c4 100644 --- a/vp10/encoder/block.h +++ b/vp10/encoder/block.h @@ -140,9 +140,6 @@ struct macroblock { int mv_row_min; int mv_row_max; - // Notes transform blocks where no coefficents are coded. - // Set during mode selection. Read during block encoding. - uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #if CONFIG_VAR_TX uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #if CONFIG_REF_MV diff --git a/vp10/encoder/context_tree.c b/vp10/encoder/context_tree.c index 41155c99a..8555cdb19 100644 --- a/vp10/encoder/context_tree.c +++ b/vp10/encoder/context_tree.c @@ -34,8 +34,6 @@ static void alloc_mode_context(VP10_COMMON *cm, int num_4x4_blk, ctx->partition = partition; #endif - CHECK_MEM_ERROR(cm, ctx->zcoeff_blk, - vpx_calloc(num_blk, sizeof(uint8_t))); for (i = 0; i < MAX_MB_PLANE; ++i) { #if CONFIG_VAR_TX CHECK_MEM_ERROR(cm, ctx->blk_skip[i], @@ -68,8 +66,6 @@ static void alloc_mode_context(VP10_COMMON *cm, int num_4x4_blk, static void free_mode_context(PICK_MODE_CONTEXT *ctx) { int i, k; - vpx_free(ctx->zcoeff_blk); - ctx->zcoeff_blk = 0; for (i = 0; i < MAX_MB_PLANE; ++i) { #if CONFIG_VAR_TX vpx_free(ctx->blk_skip[i]); diff --git a/vp10/encoder/context_tree.h b/vp10/encoder/context_tree.h index 7b49354d6..a788788f9 100644 --- a/vp10/encoder/context_tree.h +++ b/vp10/encoder/context_tree.h @@ -26,7 +26,6 @@ struct ThreadData; typedef struct { MODE_INFO mic; MB_MODE_INFO_EXT mbmi_ext; - uint8_t *zcoeff_blk; uint8_t *color_index_map[2]; #if CONFIG_VAR_TX uint8_t *blk_skip[MAX_MB_PLANE]; diff --git a/vp10/encoder/encodeframe.c b/vp10/encoder/encodeframe.c index ff1ee6bbc..287fb1704 100644 --- a/vp10/encoder/encodeframe.c +++ b/vp10/encoder/encodeframe.c @@ -1204,8 +1204,6 @@ static void update_state(VP10_COMP *cpi, ThreadData *td, memcpy(x->blk_skip[i], ctx->blk_skip[i], sizeof(uint8_t) * ctx->num_4x4_blk); #endif - memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk, - sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); if (!output_enabled) return; @@ -1362,8 +1360,6 @@ static void update_state_supertx(VP10_COMP *cpi, ThreadData *td, memcpy(x->blk_skip[i], ctx->blk_skip[i], sizeof(uint8_t) * ctx->num_4x4_blk); #endif // CONFIG_VAR_TX - memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk, - sizeof(uint8_t) * ctx->num_4x4_blk); #if CONFIG_VAR_TX { @@ -1569,8 +1565,6 @@ static void update_supertx_param(ThreadData *td, memcpy(ctx->blk_skip[i], x->blk_skip[i], sizeof(uint8_t) * ctx->num_4x4_blk); #endif // CONFIG_VAR_TX - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[supertx_size], - sizeof(uint8_t) * ctx->num_4x4_blk); ctx->mic.mbmi.tx_size = supertx_size; ctx->skip = x->skip; ctx->mic.mbmi.tx_type = best_tx; @@ -6083,7 +6077,6 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td, #endif // CONFIG_EXT_TX int tmp_rate_tx = 0, skip_tx = 0; int64_t tmp_dist_tx = 0, rd_tx, bestrd_tx = INT64_MAX; - uint8_t tmp_zcoeff_blk = 0; set_skip_context(xd, mi_row, mi_col); set_mode_info_offsets(cpi, x, xd, mi_row, mi_col); @@ -6230,10 +6223,8 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td, tmp_rate_tx = *tmp_rate; tmp_dist_tx = *tmp_dist; skip_tx = x->skip; - tmp_zcoeff_blk = x->zcoeff_blk[tx_size][0]; } } - x->zcoeff_blk[tx_size][0] = tmp_zcoeff_blk; *tmp_rate = tmp_rate_tx; *tmp_dist = tmp_dist_tx; x->skip = skip_tx; diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index 3810be5d6..34428a7ef 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -982,16 +982,6 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, ctx = combine_entropy_contexts(*a, *l); #endif - // TODO(jingning): per transformed block zero forcing only enabled for - // luma component. will integrate chroma components as well. - // Turn this back on when the rate-distortion loop is synchronized with - // the recursive transform block coding. -// if (x->zcoeff_blk[tx_size][block] && plane == 0) { -// p->eobs[block] = 0; -// *a = *l = 0; -// return; -// } - #if CONFIG_VAR_TX // Assert not magic number (uninitialised). assert(x->blk_skip[plane][(blk_row << bwl) + blk_col] != 234); diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 45c10cd47..7560a35cc 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -1251,9 +1251,6 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, // TODO(jingning): temporarily enabled only for luma component rd = VPXMIN(rd1, rd2); - if (plane == 0) - x->zcoeff_blk[tx_size][block] = !x->plane[plane].eobs[block] || - (rd1 > rd2 && !xd->lossless[mbmi->segment_id]); args->this_rate += rate; args->this_dist += dist; @@ -1453,7 +1450,6 @@ static int64_t choose_tx_size_fix_type(VP10_COMP *cpi, int64_t best_rd = INT64_MAX, last_rd = INT64_MAX; const TX_SIZE max_tx_size = max_txsize_lookup[bs]; TX_SIZE best_tx = max_tx_size; - uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; const int tx_select = cm->tx_mode == TX_MODE_SELECT; const int is_inter = is_inter_block(mbmi); #if CONFIG_EXT_TX @@ -1530,17 +1526,10 @@ static int64_t choose_tx_size_fix_type(VP10_COMP *cpi, *rate = r; *skip = s; *psse = sse; - memcpy(zcoeff_blk[mbmi->tx_size], x->zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); } } mbmi->tx_size = best_tx; - memcpy(x->zcoeff_blk[mbmi->tx_size], zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); - return best_rd; } @@ -1730,7 +1719,6 @@ static void choose_tx_size_type_from_rd(VP10_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs) { MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; - uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; int r, s; int64_t d, sse; int64_t rd = INT64_MAX; @@ -1765,9 +1753,6 @@ static void choose_tx_size_type_from_rd(VP10_COMP *cpi, MACROBLOCK *x, *psse = sse; best_tx_type = tx_type; best_tx = mbmi->tx_size; - memcpy(zcoeff_blk[mbmi->tx_size], x->zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); } } @@ -1778,10 +1763,6 @@ static void choose_tx_size_type_from_rd(VP10_COMP *cpi, MACROBLOCK *x, if (mbmi->tx_size >= TX_32X32) assert(mbmi->tx_type == DCT_DCT); #endif - - memcpy(x->zcoeff_blk[mbmi->tx_size], zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); } static void super_block_yrd(VP10_COMP *cpi, MACROBLOCK *x, int *rate, @@ -2444,9 +2425,7 @@ static void pick_intra_angle_routine_sby(VP10_COMP *cpi, MACROBLOCK *x, TX_TYPE *best_tx_type, INTRA_FILTER *best_filter, BLOCK_SIZE bsize, int rate_overhead, - int64_t *best_rd, - uint8_t zcoeff_blk[][MAX_MIB_SIZE * - MAX_MIB_SIZE * 4]) { + int64_t *best_rd) { int this_rate, this_rate_tokenonly, s; int64_t this_distortion, this_rd; MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi; @@ -2468,9 +2447,6 @@ static void pick_intra_angle_routine_sby(VP10_COMP *cpi, MACROBLOCK *x, *rate_tokenonly = this_rate_tokenonly; *distortion = this_distortion; *skippable = s; - memcpy(zcoeff_blk[mbmi->tx_size], x->zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); } } @@ -2490,7 +2466,6 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, int64_t this_distortion, this_rd; TX_SIZE best_tx_size = mic->mbmi.tx_size; TX_TYPE best_tx_type = mbmi->tx_type; - uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; if (ANGLE_FAST_SEARCH) { int deltas_level1[3] = {0, -2, 2}; @@ -2537,9 +2512,6 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, *rate_tokenonly = this_rate_tokenonly; *distortion = this_distortion; *skippable = s; - memcpy(zcoeff_blk[mbmi->tx_size], x->zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); } } } @@ -2561,7 +2533,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, rate_overhead + cpi->intra_filter_cost [intra_filter_ctx][filter], - &best_rd, zcoeff_blk); + &best_rd); } } } @@ -2583,7 +2555,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, rate_overhead + cpi->intra_filter_cost [intra_filter_ctx][filter], - &best_rd, zcoeff_blk); + &best_rd); } } } @@ -2600,8 +2572,7 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, &best_angle_delta, &best_tx_size, &best_tx_type, &best_filter, bsize, rate_overhead + cpi->intra_filter_cost - [intra_filter_ctx][filter], &best_rd, - zcoeff_blk); + [intra_filter_ctx][filter], &best_rd); } } } @@ -2610,11 +2581,6 @@ static int64_t rd_pick_intra_angle_sby(VP10_COMP *cpi, MACROBLOCK *x, mbmi->angle_delta[0] = best_angle_delta; mic->mbmi.intra_filter = best_filter; mbmi->tx_type = best_tx_type; - if (*rate_tokenonly < INT_MAX) - memcpy(x->zcoeff_blk[mbmi->tx_size], zcoeff_blk[mbmi->tx_size], - sizeof(zcoeff_blk[mbmi->tx_size][0]) * - MAX_MIB_SIZE * MAX_MIB_SIZE * 4); - return best_rd; } @@ -8384,8 +8350,6 @@ static void pick_ext_intra_iframe(VP10_COMP *cpi, MACROBLOCK *x, *best_mbmode = *mbmi; *best_skip2 = 0; *best_mode_skippable = skippable; - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], - sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); } } #endif // CONFIG_EXT_INTRA @@ -9492,9 +9456,6 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi, for (i = 0; i < MAX_MB_PLANE; ++i) memcpy(ctx->blk_skip[i], x->blk_skip[i], sizeof(uint8_t) * ctx->num_4x4_blk); -#else - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], - sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); #endif // TODO(debargha): enhance this test with a better distortion prediction @@ -9756,8 +9717,6 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi, best_mbmode = *mbmi; best_skip2 = 0; best_mode_skippable = skippable; - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], - sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); } } PALETTE_EXIT: @@ -10220,7 +10179,6 @@ void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi, best_rd = best_rd_so_far; best_yrd = best_rd_so_far; #endif // CONFIG_SUPERTX - memset(x->zcoeff_blk[TX_4X4], 0, 4); vp10_zero(best_mbmode); #if CONFIG_EXT_INTRA @@ -10648,7 +10606,6 @@ void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi, tmp_best_mbmode = *mbmi; for (i = 0; i < 4; i++) { tmp_best_bmodes[i] = xd->mi[0]->bmi[i]; - x->zcoeff_blk[TX_4X4][i] = !x->plane[0].eobs[i]; } pred_exists = 1; } @@ -10845,9 +10802,6 @@ void vp10_rd_pick_inter_mode_sub8x8(struct VP10_COMP *cpi, #if CONFIG_VAR_TX for (i = 0; i < MAX_MB_PLANE; ++i) memset(ctx->blk_skip[i], 0, sizeof(uint8_t) * ctx->num_4x4_blk); -#else - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[TX_4X4], - sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); #endif for (i = 0; i < 4; i++) -- 2.40.0