From db0c7d4fd00aea6cddca07611482a5d4f023b919 Mon Sep 17 00:00:00 2001 From: Angie Chiang Date: Thu, 23 Mar 2017 16:05:37 -0700 Subject: [PATCH] Use av1_set_txb_context in encode_block Change-Id: Ida4a10fae54591f8f5b740739ab71a2650303958 --- av1/encoder/encodemb.c | 31 ++++++++++++++----------------- av1/encoder/encodemb.h | 3 +-- av1/encoder/rdopt.c | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c index 3f10056fd..dfc4ca2e3 100644 --- a/av1/encoder/encodemb.c +++ b/av1/encoder/encodemb.c @@ -735,26 +735,18 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, } #endif #if !CONFIG_PVQ - if (p->eobs[block] && !xd->lossless[xd->mi[0]->mbmi.segment_id]) { - *a = *l = av1_optimize_b(cm, x, plane, block, tx_size, ctx) > 0; - } else { - *a = *l = p->eobs[block] > 0; - } - -#if CONFIG_VAR_TX - int i; - for (i = 0; i < tx_size_wide_unit[tx_size]; ++i) a[i] = a[0]; - - for (i = 0; i < tx_size_high_unit[tx_size]; ++i) l[i] = l[0]; + if (p->eobs[block] && !xd->lossless[xd->mi[0]->mbmi.segment_id]) + av1_optimize_b(cm, x, plane, block, tx_size, ctx); #endif + av1_set_txb_context(x, plane, block, tx_size, a, l); + +#if !CONFIG_PVQ if (p->eobs[block]) *(args->skip) = 0; if (p->eobs[block] == 0) return; #else (void)ctx; - *a = *l = !x->pvq_skip[plane]; - if (!x->pvq_skip[plane]) *(args->skip) = 0; if (x->pvq_skip[plane]) return; @@ -1010,10 +1002,8 @@ void av1_encode_sb_supertx(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize) { } #endif // CONFIG_SUPERTX -void av1_set_txb_context(MACROBLOCK *x, int plane, int block, - BLOCK_SIZE plane_bsize, TX_SIZE tx_size, +void av1_set_txb_context(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l) { - (void)plane_bsize; (void)tx_size; #if !CONFIG_PVQ struct macroblock_plane *p = &x->plane[plane]; @@ -1022,6 +1012,13 @@ void av1_set_txb_context(MACROBLOCK *x, int plane, int block, (void)block; *a = *l = !x->pvq_skip[plane]; #endif // !CONFIG_PVQ + +#if CONFIG_VAR_TX || CONFIG_LV_MAP + int i; + for (i = 0; i < tx_size_wide_unit[tx_size]; ++i) a[i] = a[0]; + + for (i = 0; i < tx_size_high_unit[tx_size]; ++i) l[i] = l[0]; +#endif } static void encode_block_intra_and_set_context(int plane, int block, @@ -1035,7 +1032,7 @@ static void encode_block_intra_and_set_context(int plane, int block, MACROBLOCK *x = args->x; ENTROPY_CONTEXT *a = &args->ta[blk_col]; ENTROPY_CONTEXT *l = &args->tl[blk_row]; - av1_set_txb_context(x, plane, block, plane_bsize, tx_size, a, l); + av1_set_txb_context(x, plane, block, tx_size, a, l); } void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h index c3a07744b..7fd42f38c 100644 --- a/av1/encoder/encodemb.h +++ b/av1/encoder/encodemb.h @@ -63,8 +63,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block, void av1_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane); -void av1_set_txb_context(MACROBLOCK *x, int plane, int block, - BLOCK_SIZE plane_bsize, TX_SIZE tx_size, +void av1_set_txb_context(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l); void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 240a6d48d..0be894b1e 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c @@ -1581,8 +1581,8 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, #else this_rd_stats.rate = x->rate; #endif // !CONFIG_PVQ - av1_set_txb_context(x, plane, block, plane_bsize, tx_size, - args->t_above + blk_col, args->t_left + blk_row); + av1_set_txb_context(x, plane, block, tx_size, args->t_above + blk_col, + args->t_left + blk_row); rd1 = RDCOST(x->rdmult, x->rddiv, this_rd_stats.rate, this_rd_stats.dist); rd2 = RDCOST(x->rdmult, x->rddiv, 0, this_rd_stats.sse); -- GitLab