Reduce the config branch of NEW_QUANT

Change-Id: I785a0fbef18adf7cbdbd4f09117d132c7fe69156
This commit is contained in:
Angie Chiang 2017-04-03 11:19:00 -07:00
Родитель f2f3bcd849
Коммит 6a71ad1f92
3 изменённых файлов: 7 добавлений и 70 удалений

Просмотреть файл

@ -497,14 +497,15 @@ typedef enum QUANT_FUNC {
static AV1_QUANT_FACADE
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_b_facade, av1_highbd_quantize_b_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_b_nuq_facade, av1_highbd_quantize_b_nuq_facade },
{ av1_quantize_dc_nuq_facade, av1_highbd_quantize_dc_nuq_facade },
#endif // CONFIG_NEW_QUANT
#endif // !CONFIG_NEW_QUANT
{ NULL, NULL }
};
@ -517,14 +518,15 @@ typedef enum QUANT_FUNC {
static AV1_QUANT_FACADE quant_func_list[AV1_XFORM_QUANT_TYPES]
[QUANT_FUNC_TYPES] = {
#if !CONFIG_NEW_QUANT
{ av1_quantize_fp_facade },
{ av1_quantize_b_facade },
{ av1_quantize_dc_facade },
#if CONFIG_NEW_QUANT
#else // !CONFIG_NEW_QUANT
{ av1_quantize_fp_nuq_facade },
{ av1_quantize_b_nuq_facade },
{ av1_quantize_dc_nuq_facade },
#endif // CONFIG_NEW_QUANT
#endif // !CONFIG_NEW_QUANT
{ NULL }
};
#endif // CONFIG_AOM_HIGHBITDEPTH
@ -771,13 +773,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
#else
{
#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,
ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
}
#if CONFIG_VAR_TX
else {
@ -898,13 +895,8 @@ static void encode_block_pass1(int plane, int block, int blk_row, int blk_col,
dst = &pd->dst
.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,
ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_PVQ
if (p->eobs[block] > 0) {
#else
@ -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);
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,
ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
if (p->eobs[block]) {
av1_optimize_b(cm, x, plane, block, tx_size, ctx);
}
} 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,
ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
}
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
*eob);
#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,
ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
// *(args->skip) == mbmi->skip
if (!x->pvq_skip[plane]) *(args->skip) = 0;

Просмотреть файл

@ -39,11 +39,6 @@ typedef enum AV1_XFORM_QUANT {
AV1_XFORM_QUANT_FP = 0,
AV1_XFORM_QUANT_B = 1,
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_TYPES,
} AV1_XFORM_QUANT;

Просмотреть файл

@ -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;
}
} else {
// 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
// full forward transform and quantization
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_PVQ
if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
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(
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);
#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,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy,
cpi->sf.use_fast_coef_costing);
@ -2854,13 +2844,8 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
const int coeff_ctx =
combine_entropy_contexts(tempa[idx], templ[idy]);
#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,
tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
ratey += av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order,
tempa + idx, templ + idy,
@ -3026,10 +3011,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
block = 4 * block;
#endif // CONFIG_CB4X4
#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,
#if CONFIG_CB4X4
2 * (row + idy), 2 * (col + idx),
@ -3037,7 +3018,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
row + idy, col + idx,
#endif // CONFIG_CB4X4
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
ratey +=
av1_cost_coeffs(cm, x, 0, block, tx_size, scan_order, tempa + idx,
templ + idy, cpi->sf.use_fast_coef_costing);
@ -3093,10 +3073,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
block = 4 * block;
#endif // CONFIG_CB4X4
#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,
#if CONFIG_CB4X4
2 * (row + idy), 2 * (col + idx),
@ -3104,7 +3080,6 @@ static int64_t rd_pick_intra_sub_8x8_y_subblock_mode(
row + idy, col + idx,
#endif // CONFIG_CB4X4
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);
ratey +=
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,
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,
coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
// TODO(yushin) : If PVQ is enabled, this should not be called.
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
@ -5405,13 +5375,8 @@ static int64_t encode_inter_mb_segment_sub8x8(
idx == 0 && idy == 0));
coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1)));
#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),
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0)
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
#else