Code cleanup for dequant_q3
In AV1 TX, the coefficients are always scaled up a factor
of 8 (3 bits), so QTX == Q3. Hence all dequant_q3 related
code is cleaned up.
Change-Id: I606654a98cf25098c9002da0835ac99ab844b85e
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 053cacc..4c1b893 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -410,12 +410,6 @@
qm_val_t *seg_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
qm_val_t *seg_qmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
-
- // the 'dequantizers' below are not literal dequantizer values.
- // They're used by encoder RDO to generate ad-hoc lambda values.
- // They use a hardwired Q3 coeff shift and do not necessarily match
- // the TX scale in use.
- const int16_t *dequant_Q3;
} MACROBLOCKD_PLANE;
#define BLOCK_OFFSET(x, i) \
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c
index d4bdb98..7537949 100644
--- a/av1/common/quant_common.c
+++ b/av1/common/quant_common.c
@@ -16,7 +16,7 @@
#include "av1/common/seg_common.h"
#include "av1/common/blockd.h"
-static const int16_t dc_qlookup_Q3[QINDEX_RANGE] = {
+static const int16_t dc_qlookup_QTX[QINDEX_RANGE] = {
4, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 16, 17, 18,
19, 19, 20, 21, 22, 23, 24, 25, 26, 26, 27, 28, 29, 30,
31, 32, 32, 33, 34, 35, 36, 37, 38, 38, 39, 40, 41, 42,
@@ -38,7 +38,7 @@
1184, 1232, 1282, 1336,
};
-static const int16_t dc_qlookup_10_Q3[QINDEX_RANGE] = {
+static const int16_t dc_qlookup_10_QTX[QINDEX_RANGE] = {
4, 9, 10, 13, 15, 17, 20, 22, 25, 28, 31, 34, 37,
40, 43, 47, 50, 53, 57, 60, 64, 68, 71, 75, 78, 82,
86, 90, 93, 97, 101, 105, 109, 113, 116, 120, 124, 128, 132,
@@ -61,7 +61,7 @@
3953, 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347,
};
-static const int16_t dc_qlookup_12_Q3[QINDEX_RANGE] = {
+static const int16_t dc_qlookup_12_QTX[QINDEX_RANGE] = {
4, 12, 18, 25, 33, 41, 50, 60, 70, 80, 91,
103, 115, 127, 140, 153, 166, 180, 194, 208, 222, 237,
251, 266, 281, 296, 312, 327, 343, 358, 374, 390, 405,
@@ -88,7 +88,7 @@
19718, 20521, 21387,
};
-static const int16_t ac_qlookup_Q3[QINDEX_RANGE] = {
+static const int16_t ac_qlookup_QTX[QINDEX_RANGE] = {
4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
@@ -111,7 +111,7 @@
1567, 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828,
};
-static const int16_t ac_qlookup_10_Q3[QINDEX_RANGE] = {
+static const int16_t ac_qlookup_10_QTX[QINDEX_RANGE] = {
4, 9, 11, 13, 16, 18, 21, 24, 27, 30, 33, 37, 40,
44, 48, 51, 55, 59, 63, 67, 71, 75, 79, 83, 88, 92,
96, 100, 105, 109, 114, 118, 122, 127, 131, 136, 140, 145, 149,
@@ -134,7 +134,7 @@
6268, 6388, 6512, 6640, 6768, 6900, 7036, 7172, 7312,
};
-static const int16_t ac_qlookup_12_Q3[QINDEX_RANGE] = {
+static const int16_t ac_qlookup_12_QTX[QINDEX_RANGE] = {
4, 13, 19, 27, 35, 44, 54, 64, 75, 87, 99,
112, 126, 139, 154, 168, 183, 199, 214, 230, 247, 263,
280, 297, 314, 331, 349, 366, 384, 402, 420, 438, 456,
@@ -190,39 +190,28 @@
// addition, the minimum allowable quantizer is 4; smaller values will
// underflow to 0 in the actual quantization routines.
-int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth) {
- const int q_clamped = clamp(qindex + delta, 0, MAXQ);
- switch (bit_depth) {
- case AOM_BITS_8: return dc_qlookup_Q3[q_clamped];
- case AOM_BITS_10: return dc_qlookup_10_Q3[q_clamped];
- case AOM_BITS_12: return dc_qlookup_12_Q3[q_clamped];
- default:
- assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
- return -1;
- }
-}
-
-int16_t av1_ac_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth) {
- const int q_clamped = clamp(qindex + delta, 0, MAXQ);
- switch (bit_depth) {
- case AOM_BITS_8: return ac_qlookup_Q3[q_clamped];
- case AOM_BITS_10: return ac_qlookup_10_Q3[q_clamped];
- case AOM_BITS_12: return ac_qlookup_12_Q3[q_clamped];
- default:
- assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
- return -1;
- }
-}
-
-// In AV1 TX, the coefficients are always scaled up a factor of 8 (3
-// bits), so QTX == Q3.
-
int16_t av1_dc_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth) {
- return av1_dc_quant_Q3(qindex, delta, bit_depth);
+ const int q_clamped = clamp(qindex + delta, 0, MAXQ);
+ switch (bit_depth) {
+ case AOM_BITS_8: return dc_qlookup_QTX[q_clamped];
+ case AOM_BITS_10: return dc_qlookup_10_QTX[q_clamped];
+ case AOM_BITS_12: return dc_qlookup_12_QTX[q_clamped];
+ default:
+ assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
+ return -1;
+ }
}
int16_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth) {
- return av1_ac_quant_Q3(qindex, delta, bit_depth);
+ const int q_clamped = clamp(qindex + delta, 0, MAXQ);
+ switch (bit_depth) {
+ case AOM_BITS_8: return ac_qlookup_QTX[q_clamped];
+ case AOM_BITS_10: return ac_qlookup_10_QTX[q_clamped];
+ case AOM_BITS_12: return ac_qlookup_12_QTX[q_clamped];
+ default:
+ assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
+ return -1;
+ }
}
int av1_get_qindex(const struct segmentation *seg, int segment_id,
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index 193237d..050dd26 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -38,8 +38,6 @@
struct AV1Common;
-int16_t av1_dc_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
-int16_t av1_ac_quant_Q3(int qindex, int delta, aom_bit_depth_t bit_depth);
int16_t av1_dc_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
int16_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
diff --git a/av1/encoder/aq_complexity.c b/av1/encoder/aq_complexity.c
index 16edbc6..e351451 100644
--- a/av1/encoder/aq_complexity.c
+++ b/av1/encoder/aq_complexity.c
@@ -41,7 +41,7 @@
static int get_aq_c_strength(int q_index, aom_bit_depth_t bit_depth) {
// Approximate base quatizer (truncated to int)
- const int base_quant = av1_ac_quant_Q3(q_index, 0, bit_depth) / 4;
+ const int base_quant = av1_ac_quant_QTX(q_index, 0, bit_depth) / 4;
return (base_quant > 10) + (base_quant > 25);
}
diff --git a/av1/encoder/av1_quantize.c b/av1/encoder/av1_quantize.c
index 66b1b54..6e8973c 100644
--- a/av1/encoder/av1_quantize.c
+++ b/av1/encoder/av1_quantize.c
@@ -531,7 +531,7 @@
}
static int get_qzbin_factor(int q, aom_bit_depth_t bit_depth) {
- const int quant = av1_dc_quant_Q3(q, 0, bit_depth);
+ const int quant = av1_dc_quant_QTX(q, 0, bit_depth);
switch (bit_depth) {
case AOM_BITS_8: return q == 0 ? 64 : (quant < 148 ? 84 : 80);
case AOM_BITS_10: return q == 0 ? 64 : (quant < 592 ? 84 : 80);
@@ -546,7 +546,7 @@
int u_dc_delta_q, int u_ac_delta_q, int v_dc_delta_q,
int v_ac_delta_q, QUANTS *const quants,
Dequants *const deq) {
- int i, q, quant_Q3, quant_QTX;
+ int i, q, quant_QTX;
for (q = 0; q < QINDEX_RANGE; q++) {
const int qzbin_factor = get_qzbin_factor(q, bit_depth);
@@ -554,9 +554,6 @@
for (i = 0; i < 2; ++i) {
int qrounding_factor_fp = 64;
- // y quantizer setup with original coeff shift of Q3
- quant_Q3 = i == 0 ? av1_dc_quant_Q3(q, y_dc_delta_q, bit_depth)
- : av1_ac_quant_Q3(q, 0, bit_depth);
// y quantizer with TX scale
quant_QTX = i == 0 ? av1_dc_quant_QTX(q, y_dc_delta_q, bit_depth)
: av1_ac_quant_QTX(q, 0, bit_depth);
@@ -567,11 +564,7 @@
quants->y_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant_QTX, 7);
quants->y_round[q][i] = (qrounding_factor * quant_QTX) >> 7;
deq->y_dequant_QTX[q][i] = quant_QTX;
- deq->y_dequant_Q3[q][i] = quant_Q3;
- // u quantizer setup with original coeff shift of Q3
- quant_Q3 = i == 0 ? av1_dc_quant_Q3(q, u_dc_delta_q, bit_depth)
- : av1_ac_quant_Q3(q, u_ac_delta_q, bit_depth);
// u quantizer with TX scale
quant_QTX = i == 0 ? av1_dc_quant_QTX(q, u_dc_delta_q, bit_depth)
: av1_ac_quant_QTX(q, u_ac_delta_q, bit_depth);
@@ -582,11 +575,7 @@
quants->u_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant_QTX, 7);
quants->u_round[q][i] = (qrounding_factor * quant_QTX) >> 7;
deq->u_dequant_QTX[q][i] = quant_QTX;
- deq->u_dequant_Q3[q][i] = quant_Q3;
- // v quantizer setup with original coeff shift of Q3
- quant_Q3 = i == 0 ? av1_dc_quant_Q3(q, v_dc_delta_q, bit_depth)
- : av1_ac_quant_Q3(q, v_ac_delta_q, bit_depth);
// v quantizer with TX scale
quant_QTX = i == 0 ? av1_dc_quant_QTX(q, v_dc_delta_q, bit_depth)
: av1_ac_quant_QTX(q, v_ac_delta_q, bit_depth);
@@ -597,7 +586,6 @@
quants->v_zbin[q][i] = ROUND_POWER_OF_TWO(qzbin_factor * quant_QTX, 7);
quants->v_round[q][i] = (qrounding_factor * quant_QTX) >> 7;
deq->v_dequant_QTX[q][i] = quant_QTX;
- deq->v_dequant_Q3[q][i] = quant_Q3;
}
for (i = 2; i < 8; i++) { // 8: SIMD width
@@ -608,7 +596,6 @@
quants->y_zbin[q][i] = quants->y_zbin[q][1];
quants->y_round[q][i] = quants->y_round[q][1];
deq->y_dequant_QTX[q][i] = deq->y_dequant_QTX[q][1];
- deq->y_dequant_Q3[q][i] = deq->y_dequant_Q3[q][1];
quants->u_quant[q][i] = quants->u_quant[q][1];
quants->u_quant_fp[q][i] = quants->u_quant_fp[q][1];
@@ -617,7 +604,6 @@
quants->u_zbin[q][i] = quants->u_zbin[q][1];
quants->u_round[q][i] = quants->u_round[q][1];
deq->u_dequant_QTX[q][i] = deq->u_dequant_QTX[q][1];
- deq->u_dequant_Q3[q][i] = deq->u_dequant_Q3[q][1];
quants->v_quant[q][i] = quants->u_quant[q][1];
quants->v_quant_fp[q][i] = quants->v_quant_fp[q][1];
quants->v_round_fp[q][i] = quants->v_round_fp[q][1];
@@ -625,7 +611,6 @@
quants->v_zbin[q][i] = quants->v_zbin[q][1];
quants->v_round[q][i] = quants->v_round[q][1];
deq->v_dequant_QTX[q][i] = deq->v_dequant_QTX[q][1];
- deq->v_dequant_Q3[q][i] = deq->v_dequant_Q3[q][1];
}
}
}
@@ -667,7 +652,6 @@
sizeof(cm->gqmatrix[qmlevel][0]));
memcpy(&xd->plane[0].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][0],
sizeof(cm->giqmatrix[qmlevel][0]));
- xd->plane[0].dequant_Q3 = cpi->dequants.y_dequant_Q3[qindex];
// U
qmlevel = (xd->lossless[segment_id] || cm->using_qmatrix == 0)
@@ -685,8 +669,6 @@
sizeof(cm->gqmatrix[qmlevel][1]));
memcpy(&xd->plane[1].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][1],
sizeof(cm->giqmatrix[qmlevel][1]));
- x->plane[1].dequant_QTX = cpi->dequants.u_dequant_QTX[qindex];
- xd->plane[1].dequant_Q3 = cpi->dequants.u_dequant_Q3[qindex];
}
// V
qmlevel = (xd->lossless[segment_id] || cm->using_qmatrix == 0)
@@ -704,8 +686,6 @@
sizeof(cm->gqmatrix[qmlevel][2]));
memcpy(&xd->plane[2].seg_iqmatrix[segment_id], cm->giqmatrix[qmlevel][2],
sizeof(cm->giqmatrix[qmlevel][2]));
- x->plane[2].dequant_QTX = cpi->dequants.v_dequant_QTX[qindex];
- xd->plane[2].dequant_Q3 = cpi->dequants.v_dequant_Q3[qindex];
}
x->skip_block = segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP);
x->qindex = qindex;
diff --git a/av1/encoder/av1_quantize.h b/av1/encoder/av1_quantize.h
index 6419265..4a1ca7c 100644
--- a/av1/encoder/av1_quantize.h
+++ b/av1/encoder/av1_quantize.h
@@ -79,10 +79,7 @@
DECLARE_ALIGNED(16, int16_t,
u_dequant_QTX[QINDEX_RANGE][8]); // 8: SIMD width
DECLARE_ALIGNED(16, int16_t,
- v_dequant_QTX[QINDEX_RANGE][8]); // 8: SIMD width
- DECLARE_ALIGNED(16, int16_t, y_dequant_Q3[QINDEX_RANGE][8]); // 8: SIMD width
- DECLARE_ALIGNED(16, int16_t, u_dequant_Q3[QINDEX_RANGE][8]); // 8: SIMD width
- DECLARE_ALIGNED(16, int16_t, v_dequant_Q3[QINDEX_RANGE][8]); // 8: SIMD width
+ v_dequant_QTX[QINDEX_RANGE][8]); // 8: SIMD width
} Dequants;
struct AV1_COMP;
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index c9f985b..5f1edb3 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -456,9 +456,9 @@
(void)cpi;
(void)plane_bsize;
const MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblock_plane *const p = &x->plane[plane];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int qstep = AOMMAX(pd->dequant_Q3[1] >> dequant_shift, 1);
+ const int qstep = AOMMAX(p->dequant_QTX[1] >> dequant_shift, 1);
if (sse == 0) {
if (rate) *rate = 0;
@@ -591,8 +591,8 @@
unsigned int sse;
struct macroblock_plane *const p = &x->plane[0];
struct macroblockd_plane *const pd = &xd->plane[0];
- const uint32_t dc_quant = pd->dequant_Q3[0];
- const uint32_t ac_quant = pd->dequant_Q3[1];
+ const uint32_t dc_quant = p->dequant_QTX[0];
+ const uint32_t ac_quant = p->dequant_QTX[1];
const int64_t dc_thr = dc_quant * dc_quant >> 6;
int64_t ac_thr = ac_quant * ac_quant >> 6;
unsigned int var;
diff --git a/av1/encoder/pickcdef.c b/av1/encoder/pickcdef.c
index c1b1056..4faac5c 100644
--- a/av1/encoder/pickcdef.c
+++ b/av1/encoder/pickcdef.c
@@ -304,7 +304,7 @@
CdefInfo *const cdef_info = &cm->cdef_info;
if (pick_method == CDEF_PICK_FROM_Q) {
const int bd = cm->seq_params.bit_depth;
- const int q = av1_ac_quant_Q3(cm->base_qindex, 0, bd) >> (bd - 8);
+ const int q = av1_ac_quant_QTX(cm->base_qindex, 0, bd) >> (bd - 8);
cdef_info->cdef_bits = 0;
cdef_info->nb_cdef_strengths = 1;
cdef_info->cdef_pri_damping = 3 + (cm->base_qindex >> 6);
@@ -524,7 +524,7 @@
int nb_strength_bits = 0;
uint64_t best_tot_mse = (uint64_t)1 << 63;
const int quantizer =
- av1_ac_quant_Q3(cm->base_qindex, 0, cm->seq_params.bit_depth) >>
+ av1_ac_quant_QTX(cm->base_qindex, 0, cm->seq_params.bit_depth) >>
(cm->seq_params.bit_depth - 8);
aom_clear_system_state();
const double lambda = .12 * quantizer * quantizer / 256.;
diff --git a/av1/encoder/picklpf.c b/av1/encoder/picklpf.c
index 101f47a..52acd5c 100644
--- a/av1/encoder/picklpf.c
+++ b/av1/encoder/picklpf.c
@@ -212,7 +212,8 @@
} else if (method >= LPF_PICK_FROM_Q) {
const int min_filter_level = 0;
const int max_filter_level = av1_get_max_filter_level(cpi);
- const int q = av1_ac_quant_Q3(cm->base_qindex, 0, cm->seq_params.bit_depth);
+ const int q =
+ av1_ac_quant_QTX(cm->base_qindex, 0, cm->seq_params.bit_depth);
// based on tests result for rtc test set
// 0.04590 boosted or 0.02295 non-booseted in 18-bit fixed point
const int strength_boost_q_treshold = 700;
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 0c29d44..4d93341 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -142,9 +142,9 @@
double av1_convert_qindex_to_q(int qindex, aom_bit_depth_t bit_depth) {
// Convert the index to a real Q value (scaled down to match old Q values)
switch (bit_depth) {
- case AOM_BITS_8: return av1_ac_quant_Q3(qindex, 0, bit_depth) / 4.0;
- case AOM_BITS_10: return av1_ac_quant_Q3(qindex, 0, bit_depth) / 16.0;
- case AOM_BITS_12: return av1_ac_quant_Q3(qindex, 0, bit_depth) / 64.0;
+ case AOM_BITS_8: return av1_ac_quant_QTX(qindex, 0, bit_depth) / 4.0;
+ case AOM_BITS_10: return av1_ac_quant_QTX(qindex, 0, bit_depth) / 16.0;
+ case AOM_BITS_12: return av1_ac_quant_QTX(qindex, 0, bit_depth) / 64.0;
default:
assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
return -1.0;
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index e83b4eb..e172507 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -348,7 +348,7 @@
128 };
int av1_compute_rd_mult_based_on_qindex(const AV1_COMP *cpi, int qindex) {
- const int q = av1_dc_quant_Q3(qindex, 0, cpi->common.seq_params.bit_depth);
+ const int q = av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.bit_depth);
int rdmult = q * q;
rdmult = rdmult * 3 + (rdmult * 2 / 3);
switch (cpi->common.seq_params.bit_depth) {
@@ -378,18 +378,18 @@
int av1_get_deltaq_offset(const AV1_COMP *cpi, int qindex, double beta) {
assert(beta > 0.0);
- int q = av1_dc_quant_Q3(qindex, 0, cpi->common.seq_params.bit_depth);
+ int q = av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.bit_depth);
int newq = (int)rint(q / sqrt(beta));
int orig_qindex = qindex;
if (newq < q) {
do {
qindex--;
- q = av1_dc_quant_Q3(qindex, 0, cpi->common.seq_params.bit_depth);
+ q = av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.bit_depth);
} while (newq < q && qindex > 0);
} else {
do {
qindex++;
- q = av1_dc_quant_Q3(qindex, 0, cpi->common.seq_params.bit_depth);
+ q = av1_dc_quant_QTX(qindex, 0, cpi->common.seq_params.bit_depth);
} while (newq > q && qindex < MAXQ);
}
return qindex - orig_qindex;
@@ -399,7 +399,7 @@
assert(beta > 0.0);
const AV1_COMMON *cm = &cpi->common;
int64_t q =
- av1_dc_quant_Q3(cm->base_qindex, 0, cpi->common.seq_params.bit_depth);
+ av1_dc_quant_QTX(cm->base_qindex, 0, cpi->common.seq_params.bit_depth);
int64_t rdmult = 0;
switch (cpi->common.seq_params.bit_depth) {
@@ -429,9 +429,13 @@
static int compute_rd_thresh_factor(int qindex, aom_bit_depth_t bit_depth) {
double q;
switch (bit_depth) {
- case AOM_BITS_8: q = av1_dc_quant_Q3(qindex, 0, AOM_BITS_8) / 4.0; break;
- case AOM_BITS_10: q = av1_dc_quant_Q3(qindex, 0, AOM_BITS_10) / 16.0; break;
- case AOM_BITS_12: q = av1_dc_quant_Q3(qindex, 0, AOM_BITS_12) / 64.0; break;
+ case AOM_BITS_8: q = av1_dc_quant_QTX(qindex, 0, AOM_BITS_8) / 4.0; break;
+ case AOM_BITS_10:
+ q = av1_dc_quant_QTX(qindex, 0, AOM_BITS_10) / 16.0;
+ break;
+ case AOM_BITS_12:
+ q = av1_dc_quant_QTX(qindex, 0, AOM_BITS_12) / 64.0;
+ break;
default:
assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
return -1;
@@ -1340,7 +1344,7 @@
int av1_get_intra_cost_penalty(int qindex, int qdelta,
aom_bit_depth_t bit_depth) {
- const int q = av1_dc_quant_Q3(qindex, qdelta, bit_depth);
+ const int q = av1_dc_quant_QTX(qindex, qdelta, bit_depth);
switch (bit_depth) {
case AOM_BITS_8: return 20 * q;
case AOM_BITS_10: return 5 * q;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index f965d0c..df909e3 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1737,13 +1737,13 @@
int *rate, int64_t *dist) {
(void)num_samples;
const MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblock_plane *const p = &x->plane[plane];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
// Fast approximate the modelling function.
if (cpi->sf.simple_model_rd_from_var) {
const int64_t square_error = sse;
- int quantizer = pd->dequant_Q3[1] >> dequant_shift;
+ int quantizer = p->dequant_QTX[1] >> dequant_shift;
if (quantizer < 120)
*rate = (int)AOMMIN(
(square_error * (280 - quantizer)) >> (16 - AV1_PROB_COST_SHIFT),
@@ -1754,7 +1754,7 @@
*dist = (square_error * quantizer) >> 8;
} else {
av1_model_rd_from_var_lapndz(sse, num_pels_log2_lookup[plane_bsize],
- pd->dequant_Q3[1] >> dequant_shift, rate,
+ p->dequant_QTX[1] >> dequant_shift, rate,
dist);
}
*dist <<= 4;
@@ -2392,7 +2392,7 @@
const int txw = tx_size_wide[tx_size];
const int txh = tx_size_high[tx_size];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int q_step = pd->dequant_Q3[1] >> dequant_shift;
+ const int q_step = p->dequant_QTX[1] >> dequant_shift;
const int num_samples = txw * txh;
const double rate_norm = (double)rd_stats->rate / num_samples;
@@ -2499,7 +2499,7 @@
&bh);
const int num_samples = bw * bh;
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int q_step = pd->dequant_Q3[1] >> dequant_shift;
+ const int q_step = p->dequant_QTX[1] >> dequant_shift;
const double rate_norm = (double)rd_stats->rate / num_samples;
const double dist_norm = (double)rd_stats->dist / num_samples;
@@ -2608,12 +2608,12 @@
int *rate, int64_t *dist) {
const MACROBLOCKD *const xd = &x->e_mbd;
const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblock_plane *const p = &x->plane[plane];
const int log_numpels = num_pels_log2_lookup[plane_bsize];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int q_step = AOMMAX(pd->dequant_Q3[1] >> dequant_shift, 1);
+ const int q_step = AOMMAX(p->dequant_QTX[1] >> dequant_shift, 1);
- const struct macroblock_plane *const p = &x->plane[plane];
int bw, bh;
get_txb_dimensions(xd, plane, plane_bsize, 0, 0, plane_bsize, NULL, NULL, &bw,
&bh);
@@ -2769,9 +2769,9 @@
(void)cpi;
(void)plane_bsize;
const MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblock_plane *const p = &x->plane[plane];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int qstep = AOMMAX(pd->dequant_Q3[1] >> dequant_shift, 1);
+ const int qstep = AOMMAX(p->dequant_QTX[1] >> dequant_shift, 1);
if (sse == 0) {
if (rate) *rate = 0;
if (dist) *dist = 0;
@@ -2874,9 +2874,9 @@
(void)cpi;
(void)plane_bsize;
const MACROBLOCKD *const xd = &x->e_mbd;
- const struct macroblockd_plane *const pd = &xd->plane[plane];
+ const struct macroblock_plane *const p = &x->plane[plane];
const int dequant_shift = (is_cur_buf_hbd(xd)) ? xd->bd - 5 : 3;
- const int qstep = AOMMAX(pd->dequant_Q3[1] >> dequant_shift, 1);
+ const int qstep = AOMMAX(p->dequant_QTX[1] >> dequant_shift, 1);
if (sse == 0) {
if (rate) *rate = 0;
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 2417ec8..4bb5004 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -130,7 +130,7 @@
const int q_cur = gf_group->q_val[frame_idx];
const int16_t qstep_cur =
- ROUND_POWER_OF_TWO(av1_ac_quant_Q3(q_cur, 0, xd->bd), xd->bd - 8);
+ ROUND_POWER_OF_TWO(av1_ac_quant_QTX(q_cur, 0, xd->bd), xd->bd - 8);
const int qstep_cur_noise =
use_satd ? ((int)qstep_cur * pix_num + 16) / (4 * 8)
: ((int)qstep_cur * (int)qstep_cur * pix_num + 384) / (12 * 64);
@@ -196,7 +196,7 @@
int q_ref = gf_group->q_val[gf_group->ref_frame_gop_idx[frame_idx][rf_idx]];
const int16_t qstep_ref =
- ROUND_POWER_OF_TWO(av1_ac_quant_Q3(q_ref, 0, xd->bd), xd->bd - 8);
+ ROUND_POWER_OF_TWO(av1_ac_quant_QTX(q_ref, 0, xd->bd), xd->bd - 8);
const int qstep_ref_noise =
use_satd
? ((int)qstep_ref * pix_num + 16) / (4 * 8)