Commit 6a71ad1f authored by Angie Chiang's avatar Angie Chiang
Browse files

Reduce the config branch of NEW_QUANT

Change-Id: I785a0fbef18adf7cbdbd4f09117d132c7fe69156
parent f2f3bcd8
...@@ -497,14 +497,15 @@ typedef enum QUANT_FUNC { ...@@ -497,14 +497,15 @@ typedef enum QUANT_FUNC {
static AV1_QUANT_FACADE static AV1_QUANT_FACADE
quant_func_list[AV1_XFORM_QUANT_TYPES][QUANT_FUNC_TYPES] = { quant_func_list[AV1_XFORM_QUANT_TYPES][QUANT_FUNC_TYPES] = {
#if !CONFIG_NEW_QUANT
{ av1_quantize_fp_facade, av1_highbd_quantize_fp_facade }, { av1_quantize_fp_facade, av1_highbd_quantize_fp_facade },
{ av1_quantize_b_facade, av1_highbd_quantize_b_facade }, { av1_quantize_b_facade, av1_highbd_quantize_b_facade },
{ av1_quantize_dc_facade, av1_highbd_quantize_dc_facade }, { av1_quantize_dc_facade, av1_highbd_quantize_dc_facade },
#if CONFIG_NEW_QUANT #else // !CONFIG_NEW_QUANT
{ av1_quantize_fp_nuq_facade, av1_highbd_quantize_fp_nuq_facade }, { av1_quantize_fp_nuq_facade, av1_highbd_quantize_fp_nuq_facade },
{ av1_quantize_b_nuq_facade, av1_highbd_quantize_b_nuq_facade }, { av1_quantize_b_nuq_facade, av1_highbd_quantize_b_nuq_facade },
{ av1_quantize_dc_nuq_facade, av1_highbd_quantize_dc_nuq_facade }, { av1_quantize_dc_nuq_facade, av1_highbd_quantize_dc_nuq_facade },
#endif // CONFIG_NEW_QUANT #endif // !CONFIG_NEW_QUANT
{ NULL, NULL } { NULL, NULL }
}; };
...@@ -517,14 +518,15 @@ typedef enum QUANT_FUNC { ...@@ -517,14 +518,15 @@ typedef enum QUANT_FUNC {
static AV1_QUANT_FACADE quant_func_list[AV1_XFORM_QUANT_TYPES] static AV1_QUANT_FACADE quant_func_list[AV1_XFORM_QUANT_TYPES]
[QUANT_FUNC_TYPES] = { [QUANT_FUNC_TYPES] = {
#if !CONFIG_NEW_QUANT
{ av1_quantize_fp_facade }, { av1_quantize_fp_facade },
{ av1_quantize_b_facade }, { av1_quantize_b_facade },
{ av1_quantize_dc_facade }, { av1_quantize_dc_facade },
#if CONFIG_NEW_QUANT #else // !CONFIG_NEW_QUANT
{ av1_quantize_fp_nuq_facade }, { av1_quantize_fp_nuq_facade },
{ av1_quantize_b_nuq_facade }, { av1_quantize_b_nuq_facade },
{ av1_quantize_dc_nuq_facade }, { av1_quantize_dc_nuq_facade },
#endif // CONFIG_NEW_QUANT #endif // !CONFIG_NEW_QUANT
{ NULL } { NULL }
}; };
#endif // CONFIG_AOM_HIGHBITDEPTH #endif // CONFIG_AOM_HIGHBITDEPTH
...@@ -771,13 +773,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col, ...@@ -771,13 +773,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#else #else
{ {
#endif #endif
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP); ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
} }
#if CONFIG_VAR_TX #if CONFIG_VAR_TX
else { else {
...@@ -898,13 +895,8 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col, ...@@ -898,13 +895,8 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col,
dst = &pd->dst dst = &pd->dst
.buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]]; .buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]];
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B_NUQ);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B); ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_PVQ #if !CONFIG_PVQ
if (p->eobs[block] > 0) { if (p->eobs[block] > 0) {
#else #else
...@@ -1121,37 +1113,22 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col, ...@@ -1121,37 +1113,22 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
ctx = combine_entropy_contexts(*a, *l); ctx = combine_entropy_contexts(*a, *l);
if (args->enable_optimize_b) { if (args->enable_optimize_b) {
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP_NUQ);
#else // CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP); ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
if (p->eobs[block]) { if (p->eobs[block]) {
av1_optimize_b(cm, x, plane, block, tx_size, ctx); av1_optimize_b(cm, x, plane, block, tx_size, ctx);
} }
} else { } else {
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B_NUQ);
#else // CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_B); ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
} }
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride, av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
*eob); *eob);
#else // #if !CONFIG_PVQ #else // #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP); ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
// *(args->skip) == mbmi->skip // *(args->skip) == mbmi->skip
if (!x->pvq_skip[plane]) *(args->skip) = 0; if (!x->pvq_skip[plane]) *(args->skip) = 0;
......
...@@ -39,11 +39,6 @@ typedef enum AV1_XFORM_QUANT { ...@@ -39,11 +39,6 @@ typedef enum AV1_XFORM_QUANT {
AV1_XFORM_QUANT_FP = 0, AV1_XFORM_QUANT_FP = 0,
AV1_XFORM_QUANT_B = 1, AV1_XFORM_QUANT_B = 1,
AV1_XFORM_QUANT_DC = 2, AV1_XFORM_QUANT_DC = 2,
#if CONFIG_NEW_QUANT
AV1_XFORM_QUANT_FP_NUQ = 3,
AV1_XFORM_QUANT_B_NUQ = 4,
AV1_XFORM_QUANT_DC_NUQ = 5,
#endif // CONFIG_NEW_QUANT
AV1_XFORM_QUANT_SKIP_QUANT, AV1_XFORM_QUANT_SKIP_QUANT,
AV1_XFORM_QUANT_TYPES, AV1_XFORM_QUANT_TYPES,
} AV1_XFORM_QUANT; } AV1_XFORM_QUANT;
......
...@@ -1622,14 +1622,9 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col, ...@@ -1622,14 +1622,9 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
this_rd_stats.dist = (int64_t)tmp * 16; this_rd_stats.dist = (int64_t)tmp * 16;
} }
} else { } else {
// full forward transform and quantization // full forward transform and quantization
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP); coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_PVQ #if !CONFIG_PVQ
if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id]) if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx); av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
...@@ -2793,13 +2788,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -2793,13 +2788,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const int coeff_ctx = const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]); combine_entropy_contexts(tempa[idx], templ[idy]);
#if !CONFIG_PVQ #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8, av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy, tempa + idx, templ + idy,
cpi->sf.use_fast_coef_costing); cpi->sf.use_fast_coef_costing);
...@@ -2854,13 +2844,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -2854,13 +2844,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const int coeff_ctx = const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]); combine_entropy_contexts(tempa[idx], templ[idy]);
#if !CONFIG_PVQ #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8, av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx); av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy, tempa + idx, templ + idy,
...@@ -3026,10 +3011,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -3026,10 +3011,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
block = 4 * block; block = 4 * block;
#endif // CONFIG_CB4X4 #endif // CONFIG_CB4X4
#if !CONFIG_PVQ #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_B_NUQ);
#else
av1_xform_quant(cm, x, 0, block, av1_xform_quant(cm, x, 0, block,
#if CONFIG_CB4X4 #if CONFIG_CB4X4
2 * (row + idy), 2 * (col + idx), 2 * (row + idy), 2 * (col + idx),
...@@ -3037,7 +3018,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -3037,7 +3018,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
row + idy, col + idx, row + idy, col + idx,
#endif // CONFIG_CB4X4 #endif // CONFIG_CB4X4
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_B); BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
ratey += ratey +=
av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, tempa + idx, av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, tempa + idx,
templ + idy, cpi->sf.use_fast_coef_costing); templ + idy, cpi->sf.use_fast_coef_costing);
...@@ -3093,10 +3073,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -3093,10 +3073,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
block = 4 * block; block = 4 * block;
#endif // CONFIG_CB4X4 #endif // CONFIG_CB4X4
#if !CONFIG_PVQ #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, av1_xform_quant(cm, x, 0, block,
#if CONFIG_CB4X4 #if CONFIG_CB4X4
2 * (row + idy), 2 * (col + idx), 2 * (row + idy), 2 * (col + idx),
...@@ -3104,7 +3080,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode( ...@@ -3104,7 +3080,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
row + idy, col + idx, row + idy, col + idx,
#endif // CONFIG_CB4X4 #endif // CONFIG_CB4X4
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx); av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
ratey += ratey +=
av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, tempa + idx, av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, tempa + idx,
...@@ -4017,13 +3992,8 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size, ...@@ -4017,13 +3992,8 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
int coeff_ctx = get_entropy_context(tx_size, a, l); int coeff_ctx = get_entropy_context(tx_size, a, l);
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size, av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP); coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
// TODO(yushin) : If PVQ is enabled, this should not be called. // TODO(yushin) : If PVQ is enabled, this should not be called.
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx); av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
...@@ -5405,13 +5375,8 @@ static int64_t encode_inter_mb_segment_sub8x8( ...@@ -5405,13 +5375,8 @@ static int64_t encode_inter_mb_segment_sub8x8(
idx == 0 && idy == 0)); idx == 0 && idy == 0));
coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1))); coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1)));
#if !CONFIG_PVQ #if !CONFIG_PVQ
#if CONFIG_NEW_QUANT
av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01), av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP); BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0) if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0)
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx); av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
#else #else
......
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