Commit f0305584 authored by Debargha Mukherjee's avatar Debargha Mukherjee

Harmonize quantizers for new-quant and regular

Change-Id: Ia8ccf6f270c06d14ecd37882860ce6a5a50434e5
parent 95ae0d6d
......@@ -52,6 +52,9 @@ static INLINE int read_coeff(const aom_prob *probs, int n, aom_reader *r) {
#if CONFIG_AOM_QM
static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
TX_SIZE tx_size, TX_TYPE tx_type, const int16_t *dq,
#if CONFIG_NEW_QUANT
dequant_val_type_nuq *dq_val,
#endif // CONFIG_NEW_QUANT
int ctx, const int16_t *scan, const int16_t *nb,
int16_t *max_scan_line, aom_reader *r,
const qm_val_t *iqm[2][TX_SIZES])
......@@ -63,7 +66,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
#endif // CONFIG_NEW_QUANT
int ctx, const int16_t *scan, const int16_t *nb,
int16_t *max_scan_line, aom_reader *r)
#endif
#endif // CONFIG_AOM_QM
{
FRAME_COUNTS *counts = xd->counts;
FRAME_CONTEXT *const fc = xd->fc;
......@@ -71,7 +74,7 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
const int ref = is_inter_block(&xd->mi[0]->mbmi);
#if CONFIG_AOM_QM
const qm_val_t *iqmatrix = iqm[!ref][tx_size];
#endif
#endif // CONFIG_AOM_QM
int band, c = 0;
const int tx_size_ctx = txsize_sqr_map[tx_size];
aom_prob(*coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
......@@ -99,6 +102,9 @@ static int decode_coefs(MACROBLOCKD *xd, PLANE_TYPE type, tran_low_t *dqcoeff,
const uint8_t *cat5_prob;
const uint8_t *cat6_prob;
(void)tx_type;
#if CONFIG_AOM_QM
(void)iqmatrix;
#endif // CONFIG_AOM_QM
if (counts) {
coef_counts = counts->coef[tx_size_ctx][type][ref];
......@@ -345,9 +351,12 @@ int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const int eob = decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size,
tx_type, dequant, ctx, sc->scan, sc->neighbors,
max_scan_line, r, pd->seg_iqmatrix[seg_id]);
const int eob = decode_coefs(
xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
#if CONFIG_NEW_QUANT
pd->seg_dequant_nuq[seg_id][dq],
#endif // CONFIG_NEW_QUANT
ctx, sc->scan, sc->neighbors, max_scan_line, r, pd->seg_iqmatrix[seg_id]);
#else
const int eob =
decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
......
This diff is collapsed.
......@@ -39,8 +39,13 @@ typedef enum AV1_XFORM_QUANT {
AV1_XFORM_QUANT_FP = 0,
AV1_XFORM_QUANT_B = 1,
AV1_XFORM_QUANT_DC = 2,
AV1_XFORM_QUANT_SKIP_QUANT = 3,
AV1_XFORM_QUANT_LAST = 4
#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;
void av1_encode_sb(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize);
......@@ -50,21 +55,7 @@ void av1_encode_sb_supertx(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize);
void av1_encode_sby_pass1(AV1_COMMON *cm, MACROBLOCK *x, BLOCK_SIZE bsize);
void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
int blk_row, int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, AV1_XFORM_QUANT xform_quant_idx);
#if CONFIG_NEW_QUANT
void av1_xform_quant_nuq(const AV1_COMMON *cm, MACROBLOCK *x, int plane,
int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int ctx);
void av1_xform_quant_dc_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, int ctx);
void av1_xform_quant_fp_nuq(const AV1_COMMON *cm, MACROBLOCK *x, int plane,
int block, int blk_row, int blk_col,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, int ctx);
void av1_xform_quant_dc_fp_nuq(MACROBLOCK *x, int plane, int block, int blk_row,
int blk_col, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, int ctx);
#endif
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);
......
This diff is collapsed.
This diff is collapsed.
......@@ -1222,11 +1222,11 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
} else {
// full forward transform and quantization
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, coeff_ctx);
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_FP);
coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
#if !CONFIG_PVQ
if (x->plane[plane].eobs[block])
......@@ -2065,11 +2065,11 @@ static int64_t rd_pick_intra4x4block(
const int coeff_ctx =
combine_entropy_contexts(*(tempa + idx), *(templ + idy));
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, 0, block, row + idy, col + idx,
BLOCK_8X8, TX_4X4, coeff_ctx);
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, AV1_XFORM_QUANT_FP);
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
ratey += av1_cost_coeffs(cm, x, 0, block, coeff_ctx, TX_4X4,
scan_order->scan, scan_order->neighbors,
......@@ -2090,11 +2090,11 @@ static int64_t rd_pick_intra4x4block(
const int coeff_ctx =
combine_entropy_contexts(*(tempa + idx), *(templ + idy));
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, 0, block, row + idy, col + idx,
BLOCK_8X8, TX_4X4, coeff_ctx);
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, AV1_XFORM_QUANT_FP);
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
av1_optimize_b(cm, x, 0, block, TX_4X4, coeff_ctx);
ratey += av1_cost_coeffs(cm, x, 0, block, coeff_ctx, TX_4X4,
......@@ -2229,11 +2229,11 @@ static int64_t rd_pick_intra4x4block(
const int coeff_ctx =
combine_entropy_contexts(*(tempa + idx), *(templ + idy));
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, 0, block, row + idy, col + idx,
BLOCK_8X8, TX_4X4, coeff_ctx);
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_B_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, AV1_XFORM_QUANT_B);
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_B);
#endif // CONFIG_NEW_QUANT
ratey += av1_cost_coeffs(cm, x, 0, block, coeff_ctx, TX_4X4,
scan_order->scan, scan_order->neighbors,
......@@ -2268,11 +2268,11 @@ static int64_t rd_pick_intra4x4block(
const int coeff_ctx =
combine_entropy_contexts(*(tempa + idx), *(templ + idy));
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, 0, block, row + idy, col + idx,
BLOCK_8X8, TX_4X4, coeff_ctx);
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP_NUQ);
#else
av1_xform_quant(cm, x, 0, block, row + idy, col + idx, BLOCK_8X8,
TX_4X4, AV1_XFORM_QUANT_FP);
TX_4X4, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
av1_optimize_b(cm, x, 0, block, TX_4X4, coeff_ctx);
ratey += av1_cost_coeffs(cm, x, 0, block, coeff_ctx, TX_4X4,
......@@ -3137,11 +3137,11 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
max_blocks_wide >>= tx_size_wide_log2[0];
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, plane, block, blk_row, blk_col, plane_bsize,
tx_size, coeff_ctx);
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_FP);
coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // CONFIG_NEW_QUANT
// TODO(yushin) : If PVQ is enabled, this should not be called.
......@@ -4590,11 +4590,11 @@ static int64_t encode_inter_mb_segment(const AV1_COMP *const cpi, MACROBLOCK *x,
#if !CONFIG_PVQ
coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1)));
#if CONFIG_NEW_QUANT
av1_xform_quant_fp_nuq(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
BLOCK_8X8, tx_size, coeff_ctx);
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, 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)
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
......
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