Commit 3511c37d authored by Angie Chiang's avatar Angie Chiang

Pass above/left ctx plane_bsize to av1_optimize_b

This is to facilitate lv_map experiment

Change-Id: Ife779b172c4b81a9b2b4640464163300996e3969
parent 5e012fe6
......@@ -803,13 +803,21 @@ static int optimize_b_org(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
#endif // USE_GREEDY_OPTIMIZE_B
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
TX_SIZE tx_size, int ctx) {
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l) {
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
const int eob = p->eobs[block];
assert((mb->qindex == 0) ^ (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0));
if (eob == 0) return eob;
if (xd->lossless[xd->mi[0]->mbmi.segment_id]) return eob;
#if CONFIG_VAR_TX
int ctx = get_entropy_context(tx_size, a, l);
#else
int ctx = combine_entropy_contexts(*a, *l);
#endif
#if CONFIG_PVQ
(void)cm;
(void)tx_size;
......@@ -817,6 +825,7 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
return eob;
#endif
(void)plane_bsize;
#if USE_GREEDY_OPTIMIZE_B
return optimize_b_greedy(cm, mb, plane, block, tx_size, ctx);
#else // USE_GREEDY_OPTIMIZE_B
......@@ -1113,7 +1122,7 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#endif
#if !CONFIG_PVQ
av1_optimize_b(cm, x, plane, block, tx_size, ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
av1_set_txb_context(x, plane, block, tx_size, a, l);
......@@ -1734,7 +1743,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
if (args->enable_optimize_b) {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, block, tx_size, ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
} else {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B);
......
......@@ -54,7 +54,8 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
TX_SIZE tx_size, int ctx, AV1_XFORM_QUANT xform_quant_idx);
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
TX_SIZE tx_size, int ctx);
BLOCK_SIZE plane_bsize, TX_SIZE tx_size,
const ENTROPY_CONTEXT *a, const ENTROPY_CONTEXT *l);
void av1_subtract_txb(MACROBLOCK *x, int plane, BLOCK_SIZE plane_bsize,
int blk_col, int blk_row, TX_SIZE tx_size);
......
......@@ -1850,7 +1850,7 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
av1_invalid_rd_stats(&this_rd_stats);
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
av1_dist_block(cpi, x, plane, plane_bsize, block, blk_row, blk_col, tx_size,
&this_rd_stats.dist, &this_rd_stats.sse,
OUTPUT_HAS_PREDICTED_PIXELS);
......@@ -1871,7 +1871,7 @@ int64_t av1_search_txk_type(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
// copy the best result in the above tx_type search for loop
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
if (!is_inter_block(mbmi)) {
// intra mode needs decoded result such that the next transform block
// can use it for prediction.
......
......@@ -1491,7 +1491,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
const int coeff_ctx = combine_entropy_contexts(*a, *l);
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
if (!is_inter_block(mbmi)) {
struct macroblock_plane *const p = &x->plane[plane];
......@@ -2817,7 +2817,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
#if !CONFIG_PVQ
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx,
templ + idy);
ratey += av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy,
cpi->sf.use_fast_coef_costing);
......@@ -2976,7 +2977,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
#endif // CONFIG_CB4X4
BLOCK_8X8, tx_size, coeff_ctx, xform_quant);
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, 0, block, BLOCK_8X8, tx_size, tempa + idx,
templ + idy);
ratey +=
av1_cost_coeffs(cpi, x, 0, block, tx_size, scan_order, tempa + idx,
......@@ -3927,7 +3929,7 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
av1_optimize_b(cm, x, plane, block, plane_bsize, tx_size, a, l);
// TODO(any): Use av1_dist_block to compute distortion
#if CONFIG_HIGHBITDEPTH
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment