From d3a2e55af41ea85be57ec68870e1ccd81cb3020d Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Tue, 26 Nov 2013 18:52:10 -0800 Subject: Removing qcoeff buffers from the decoder. We only need qcoeff buffers in the encoder. Reducing TileWorkerData struct and VP9Decompressor struct sizes by 24K. Change-Id: Id148868461f7ffa3d3dd634b371503ae9c57e207 --- vp9/encoder/vp9_block.h | 1 + vp9/encoder/vp9_encodeframe.c | 6 +++--- vp9/encoder/vp9_encodemb.c | 7 ++++--- vp9/encoder/vp9_firstpass.c | 2 +- vp9/encoder/vp9_quantize.c | 2 +- vp9/encoder/vp9_rdopt.c | 11 ++++++----- vp9/encoder/vp9_tokenize.c | 3 ++- 7 files changed, 18 insertions(+), 14 deletions(-) (limited to 'vp9/encoder') diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h index 444597067..71f7e7a52 100644 --- a/vp9/encoder/vp9_block.h +++ b/vp9/encoder/vp9_block.h @@ -69,6 +69,7 @@ typedef struct { struct macroblock_plane { DECLARE_ALIGNED(16, int16_t, src_diff[64 * 64]); + int16_t *qcoeff; int16_t *coeff; struct buf_2d src; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 18cfddd55..38c753849 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -439,14 +439,14 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; for (i = 0; i < max_plane; ++i) { p[i].coeff = ctx->coeff_pbuf[i][1]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][1]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1]; pd[i].eobs = ctx->eobs_pbuf[i][1]; } for (i = max_plane; i < MAX_MB_PLANE; ++i) { p[i].coeff = ctx->coeff_pbuf[i][2]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][2]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][2]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2]; pd[i].eobs = ctx->eobs_pbuf[i][2]; } @@ -675,7 +675,7 @@ static void pick_sb_modes(VP9_COMP *cpi, const TileInfo *const tile, for (i = 0; i < MAX_MB_PLANE; ++i) { p[i].coeff = ctx->coeff_pbuf[i][0]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][0]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][0]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][0]; pd[i].eobs = ctx->eobs_pbuf[i][0]; } diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index bd9678afb..83f87b066 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -136,6 +136,7 @@ static void optimize_b(MACROBLOCK *mb, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, TX_SIZE tx_size) { MACROBLOCKD *const xd = &mb->e_mbd; + struct macroblock_plane *p = &mb->plane[plane]; struct macroblockd_plane *pd = &xd->plane[plane]; const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi); vp9_token_state tokens[1025][2]; @@ -163,7 +164,7 @@ static void optimize_b(MACROBLOCK *mb, assert((!type && !plane) || (type && plane)); dqcoeff_ptr = BLOCK_OFFSET(pd->dqcoeff, block); - qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block); + qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block); assert(eob <= default_eob); /* Now set up a Viterbi trellis to evaluate alternative roundings. */ @@ -368,7 +369,7 @@ void vp9_xform_quant(int plane, int block, BLOCK_SIZE plane_bsize, struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; int16_t *coeff = BLOCK_OFFSET(p->coeff, block); - int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block); + int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); const scan_order *so; uint16_t *eob = &pd->eobs[block]; @@ -530,7 +531,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; int16_t *coeff = BLOCK_OFFSET(p->coeff, block); - int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block); + int16_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block); const scan_order *so; TX_TYPE tx_type; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 924f9f324..930e2f82b 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -530,7 +530,7 @@ void vp9_first_pass(VP9_COMP *cpi) { for (i = 0; i < MAX_MB_PLANE; ++i) { p[i].coeff = ctx->coeff_pbuf[i][1]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][1]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1]; pd[i].eobs = ctx->eobs_pbuf[i][1]; } diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index d24be96f6..698130aed 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -173,7 +173,7 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int y_blocks, int b_idx, vp9_quantize_b(BLOCK_OFFSET(p->coeff, pb_idx.block), 16, x->skip_block, p->zbin, p->round, p->quant, p->quant_shift, - BLOCK_OFFSET(pd->qcoeff, pb_idx.block), + BLOCK_OFFSET(p->qcoeff, pb_idx.block), BLOCK_OFFSET(pd->dqcoeff, pb_idx.block), pd->dequant, p->zbin_extra, &pd->eobs[pb_idx.block], scan, iscan); } diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 43b7d6b7c..0c61b0d9f 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -514,11 +514,12 @@ static INLINE int cost_coeffs(MACROBLOCK *x, const int16_t *scan, const int16_t *nb) { MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; + struct macroblock_plane *p = &x->plane[plane]; struct macroblockd_plane *pd = &xd->plane[plane]; const PLANE_TYPE type = pd->plane_type; const int16_t *band_count = &band_counts[tx_size][1]; const int eob = pd->eobs[block]; - const int16_t *const qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block); + const int16_t *const qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block); const int ref = mbmi->ref_frame[0] != INTRA_FRAME; unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS][MAX_ENTROPY_TOKENS] = x->token_costs[tx_size][type][ref]; @@ -1380,7 +1381,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, struct macroblockd_plane *const pd = x->e_mbd.plane; for (i = 1; i < MAX_MB_PLANE; ++i) { p[i].coeff = ctx->coeff_pbuf[i][2]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][2]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][2]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][2]; pd[i].eobs = ctx->eobs_pbuf[i][2]; @@ -1390,7 +1391,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, ctx->eobs_pbuf[i][2] = ctx->eobs_pbuf[i][0]; ctx->coeff_pbuf[i][0] = p[i].coeff; - ctx->qcoeff_pbuf[i][0] = pd[i].qcoeff; + ctx->qcoeff_pbuf[i][0] = p[i].qcoeff; ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff; ctx->eobs_pbuf[i][0] = pd[i].eobs; } @@ -3057,7 +3058,7 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, for (i = 0; i < max_plane; ++i) { p[i].coeff = ctx->coeff_pbuf[i][1]; - pd[i].qcoeff = ctx->qcoeff_pbuf[i][1]; + p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; pd[i].dqcoeff = ctx->dqcoeff_pbuf[i][1]; pd[i].eobs = ctx->eobs_pbuf[i][1]; @@ -3067,7 +3068,7 @@ static void swap_block_ptr(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, ctx->eobs_pbuf[i][1] = ctx->eobs_pbuf[i][0]; ctx->coeff_pbuf[i][0] = p[i].coeff; - ctx->qcoeff_pbuf[i][0] = pd[i].qcoeff; + ctx->qcoeff_pbuf[i][0] = p[i].qcoeff; ctx->dqcoeff_pbuf[i][0] = pd[i].dqcoeff; ctx->eobs_pbuf[i][0] = pd[i].eobs; } diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 3f1cc6fe8..1aaf72e40 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -108,7 +108,8 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, TOKENEXTRA *t = *tp; /* store tokens starting here */ const int eob = pd->eobs[block]; const PLANE_TYPE type = pd->plane_type; - const int16_t *qcoeff_ptr = BLOCK_OFFSET(pd->qcoeff, block); + struct macroblock_plane *p = &cpi->mb.plane[plane]; + const int16_t *qcoeff_ptr = BLOCK_OFFSET(p->qcoeff, block); const int segment_id = mbmi->segment_id; const int16_t *scan, *nb; -- cgit v1.2.3