Remove ctx from new-quant profile lookup
This simplifies the profile lookup table and removes the requirement
of computing the ctx for new-quant. This change produces a
0.01% drop in performance on 40 frames of lowres.
Change-Id: Ifcbd7d6e427090e02bb43f6de15e551796aa74c4
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index cb043df..10587ee 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -165,7 +165,7 @@
: cm->giqmatrix[NUM_QM_LEVELS - 1][0][qm_tx_size];
#endif // CONFIG_AOM_QM
#if CONFIG_NEW_QUANT
- int dq = get_dq_profile_from_ctx(mb->qindex, ctx, ref, plane_type);
+ int dq = get_dq_profile(mb->qindex, ref, plane_type);
const dequant_val_type_nuq *dequant_val = p->dequant_val_nuq_QTX[dq];
#endif // CONFIG_NEW_QUANT
int64_t rd_cost0, rd_cost1;
@@ -480,8 +480,7 @@
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, int ctx,
- AV1_XFORM_QUANT xform_quant_idx) {
+ TX_SIZE tx_size, AV1_XFORM_QUANT xform_quant_idx) {
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
#if !CONFIG_DIST_8X8
@@ -542,7 +541,7 @@
#endif
qparam.tx_size = tx_size;
#if CONFIG_NEW_QUANT
- qparam.dq = get_dq_profile_from_ctx(x->qindex, ctx, is_inter, plane_type);
+ qparam.dq = get_dq_profile(x->qindex, is_inter, plane_type);
#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
qparam.qmatrix = qmatrix;
@@ -576,8 +575,6 @@
}
#endif // CONFIG_DIST_8X8
- (void)ctx;
-
txfm_param.tx_type = tx_type;
txfm_param.tx_size = tx_size;
txfm_param.lossless = xd->lossless[mbmi->segment_id];
@@ -621,7 +618,6 @@
AV1_COMMON *cm = args->cm;
MACROBLOCK *const x = args->x;
MACROBLOCKD *const xd = &x->e_mbd;
- int ctx;
struct macroblock_plane *const p = &x->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
@@ -634,14 +630,13 @@
a = &args->ta[blk_col];
l = &args->tl[blk_row];
- ctx = get_entropy_context(tx_size, a, l);
// Assert not magic number (uninitialized).
assert(x->blk_skip[plane][blk_row * bw + blk_col] != 234);
if (x->blk_skip[plane][blk_row * bw + blk_col] == 0) {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- ctx, AV1_XFORM_QUANT_FP);
+ AV1_XFORM_QUANT_FP);
} else {
p->eobs[block] = 0;
}
@@ -734,12 +729,11 @@
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
TxfmParam txfm_param;
uint8_t *dst;
- int ctx = 0;
dst = &pd->dst
.buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]];
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
if (p->eobs[block] > 0) {
txfm_param.bd = xd->bd;
@@ -915,15 +909,14 @@
const ENTROPY_CONTEXT *a = &args->ta[blk_col];
const ENTROPY_CONTEXT *l = &args->tl[blk_row];
- int ctx = combine_entropy_contexts(*a, *l);
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_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size,
a, l, CONFIG_LV_MAP);
} else {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
}
av1_inverse_transform_block(xd, dqcoeff, plane, tx_type, tx_size, dst,
diff --git a/av1/encoder/encodemb.h b/av1/encoder/encodemb.h
index e68674a..adea7cd 100644
--- a/av1/encoder/encodemb.h
+++ b/av1/encoder/encodemb.h
@@ -48,7 +48,7 @@
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, int ctx, AV1_XFORM_QUANT xform_quant_idx);
+ TX_SIZE tx_size, AV1_XFORM_QUANT xform_quant_idx);
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int blk_row,
int blk_col, int block, BLOCK_SIZE plane_bsize,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index f968996..760433b 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -2506,7 +2506,6 @@
TX_TYPE best_tx_type = txk_start;
int64_t best_rd = INT64_MAX;
uint8_t best_eob = 0;
- const int coeff_ctx = combine_entropy_contexts(*a, *l);
RD_STATS best_rd_stats;
TX_TYPE tx_type;
@@ -2532,10 +2531,10 @@
av1_invalid_rd_stats(&this_rd_stats);
#if DISABLE_TRELLISQ_SEARCH
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_FP);
+ AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size,
a, l, 1);
#endif
@@ -2569,10 +2568,10 @@
// can use it for prediction.
#if DISABLE_TRELLISQ_SEARCH
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_FP);
+ AV1_XFORM_QUANT_FP);
av1_optimize_b(cm, x, plane, blk_row, blk_col, block, plane_bsize, tx_size,
a, l, 1);
#endif
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 6352c83..8e6835f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2077,14 +2077,13 @@
}
#if !CONFIG_TXK_SEL
- // full forward transform and quantization
- const int coeff_ctx = combine_entropy_contexts(*a, *l);
+// full forward transform and quantization
#if DISABLE_TRELLISQ_SEARCH
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_FP);
+ AV1_XFORM_QUANT_FP);
// TX-domain results need to shift down to Q2/D10 to match pixel
// domain distortion values which are in Q2^2
@@ -3763,11 +3762,11 @@
#if DISABLE_TRELLISQ_SEARCH
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_B);
+ AV1_XFORM_QUANT_B);
#else
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
- coeff_ctx, AV1_XFORM_QUANT_FP);
+ AV1_XFORM_QUANT_FP);
// TX-domain results need to shift down to Q2/D10 to match pixel
// domain distortion values which are in Q2^2