From a6aed6e4b3f63896cbb152b89cb161baf91ffc8d Mon Sep 17 00:00:00 2001 From: Sarah Parker Date: Tue, 12 Jul 2016 14:16:00 -0700 Subject: [PATCH] Add new_quant quantization in rdopt for 4x4 blocks and intra Originally the uniform quantization function was not being replaced with the new_quant version in rdopt when new_quant is turned on. This fixes the bug. Change-Id: I593793bb909e1e1a6f89544eeca6783fe0576f25 --- vp10/encoder/rdopt.c | 46 +++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index 45c10cd47..6c407d88c 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -1166,22 +1166,13 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, MACROBLOCK *const x = args->x; MACROBLOCKD *const xd = &x->e_mbd; MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; -#if CONFIG_NEW_QUANT - int ctx; - struct macroblockd_plane *const pd = &xd->plane[plane]; -#endif // CONFIG_NEW_QUANT int64_t rd1, rd2, rd; int rate; int64_t dist; int64_t sse; - ENTROPY_CONTEXT coeff_ctx = combine_entropy_contexts( + int coeff_ctx = combine_entropy_contexts( *(args->t_above + blk_col), *(args->t_left + blk_row)); -#if CONFIG_NEW_QUANT - ctx = get_entropy_context(tx_size, pd->above_context + blk_col, - pd->left_context + blk_row); -#endif // CONFIG_NEW_QUANT - if (args->exit_early) return; @@ -1228,7 +1219,7 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, // full forward transform and quantization #if CONFIG_NEW_QUANT vp10_xform_quant_fp_nuq(x, plane, block, blk_row, blk_col, plane_bsize, - tx_size, ctx); + tx_size, coeff_ctx); #else vp10_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize, tx_size, VP10_XFORM_QUANT_FP); @@ -2070,12 +2061,17 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, if (xd->lossless[xd->mi[0]->mbmi.segment_id]) { TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type, 0); -#if CONFIG_VAR_TX +#if CONFIG_VAR_TX | CONFIG_NEW_QUANT const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); -#endif // CONFIG_VAR_TX +#endif // CONFIG_VAR_TX | CONFIG_NEW_QUANT +#if CONFIG_NEW_QUANT + vp10_xform_quant_fp_nuq(x, 0, block, row + idy, col + idx, + BLOCK_8X8, TX_4X4, coeff_ctx); +#else vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8, TX_4X4, VP10_XFORM_QUANT_FP); +#endif // CONFIG_NEW_QUANT #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, so->neighbors, cpi->sf.use_fast_coef_costing); @@ -2099,8 +2095,13 @@ static int64_t rd_pick_intra4x4block(VP10_COMP *cpi, MACROBLOCK *x, const scan_order *so = get_scan(TX_4X4, tx_type, 0); const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); +#if CONFIG_NEW_QUANT + vp10_xform_quant_fp_nuq(x, 0, block, row + idy, col + idx, + BLOCK_8X8, TX_4X4, coeff_ctx); +#else vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8, TX_4X4, VP10_XFORM_QUANT_FP); +#endif // CONFIG_NEW_QUANT vp10_optimize_b(x, 0, block, TX_4X4, coeff_ctx); #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, @@ -2192,12 +2193,17 @@ next_highbd: if (xd->lossless[xd->mi[0]->mbmi.segment_id]) { TX_TYPE tx_type = get_tx_type(PLANE_TYPE_Y, xd, block, TX_4X4); const scan_order *so = get_scan(TX_4X4, tx_type, 0); -#if CONFIG_VAR_TX +#if CONFIG_VAR_TX | CONFIG_NEW_QUANT const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); -#endif +#endif // CONFIG_VAR_TX | CONFIG_NEW_QUANT +#if CONFIG_NEW_QUANT + vp10_xform_quant_fp_nuq(x, 0, block, row + idy, col + idx, BLOCK_8X8, + TX_4X4, coeff_ctx); +#else vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8, TX_4X4, VP10_XFORM_QUANT_B); +#endif // CONFIG_NEW_QUANT #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, so->neighbors, cpi->sf.use_fast_coef_costing); @@ -2220,8 +2226,13 @@ next_highbd: const scan_order *so = get_scan(TX_4X4, tx_type, 0); const int coeff_ctx = combine_entropy_contexts(*(tempa + idx), *(templ + idy)); +#if CONFIG_NEW_QUANT + vp10_xform_quant_fp_nuq(x, 0, block, row + idy, col + idx, BLOCK_8X8, + TX_4X4, coeff_ctx); +#else vp10_xform_quant(x, 0, block, row + idy, col + idx, BLOCK_8X8, TX_4X4, VP10_XFORM_QUANT_FP); +#endif // CONFIG_NEW_QUANT vp10_optimize_b(x, 0, block, TX_4X4, coeff_ctx); #if CONFIG_VAR_TX ratey += cost_coeffs(x, 0, block, coeff_ctx, TX_4X4, so->scan, @@ -4457,8 +4468,13 @@ static int64_t encode_inter_mb_segment(VP10_COMP *cpi, k += (idy * 2 + idx); coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1))); +#if CONFIG_NEW_QUANT + vp10_xform_quant_fp_nuq(x, 0, k, idy + (i >> 1), idx + (i & 0x01), + BLOCK_8X8, TX_4X4, coeff_ctx); +#else vp10_xform_quant(x, 0, k, idy + (i >> 1), idx + (i & 0x01), BLOCK_8X8, TX_4X4, VP10_XFORM_QUANT_FP); +#endif // CONFIG_NEW_QUANT if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0) vp10_optimize_b(x, 0, k, TX_4X4, coeff_ctx); dist_block(cpi, x, 0, k, idy + (i >> 1), idx + (i & 0x1), TX_4X4,