[tcq] Make qindex increment tunable
Make qindex increment tunable, and tie with lambda derivation. Default to QINDEX_INCR=2 (same choice as before).
STATS_CHANGED
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index d10ffe6..d7e14dc 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -27,6 +27,7 @@
#define TCQ_HDR_FLAG 1 // Enable through header flag(s)
#define DQENABLE 0 // Determine whether to use DQ by dq_enable()
#define NEWQINDEX 1 // QP shift
+#define QINDEX_INCR 2 // tunable QP index increment
#define NEWHR 1 // 1:parity is determined by (base + LR)
#else
#define TCQ_HDR_FLAG 0
@@ -111,7 +112,7 @@
int use_tcq_offset) {
if (use_tcq_offset && qindex != 0) {
#if NEWQINDEX
- qindex += 2;
+ qindex += QINDEX_INCR;
#endif
}
return av1_dc_quant_QTX(qindex, delta, base_dc_delta_q, bit_depth);
@@ -122,7 +123,7 @@
int use_tcq_offset) {
if (use_tcq_offset && qindex != 0) {
#if NEWQINDEX
- qindex += 2;
+ qindex += QINDEX_INCR;
#endif
}
return av1_ac_quant_QTX(qindex, delta, bit_depth);
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 2ee7963..fc24f8d 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -933,9 +933,17 @@
};
int av1_compute_rd_mult_based_on_qindex(const AV1_COMP *cpi, int qindex) {
+#if CONFIG_DQ
+ const int tcq_mode = cpi->common.quant_params.tcq_mode;
+ const int q =
+ av1_dc_quant_QTX_tcq(qindex, 0, cpi->common.seq_params.base_y_dc_delta_q,
+ cpi->common.seq_params.bit_depth, tcq_mode);
+#else
const int q =
av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.base_y_dc_delta_q,
cpi->common.seq_params.bit_depth);
+#endif // CONFIG_DQ
+
int64_t rdmult = ROUND_POWER_OF_TWO_64(
(int64_t)((int64_t)q * q * RDMULT_FROM_Q2_NUM / RDMULT_FROM_Q2_DEN),
2 * QUANT_TABLE_BITS);