Remove NEW_QUANT experiment
This experiment has been abandonned for AV1.
Change-Id: I924d172f7ce85b2422bace44684329fcbf71cb5e
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 3cc7cb4..44d3de3 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -31,11 +31,7 @@
extern "C" {
#endif
-#if CONFIG_NEW_QUANT
-#define USE_B_QUANT_NO_TRELLIS 0
-#else
#define USE_B_QUANT_NO_TRELLIS 1
-#endif // CONFIG_NEW_QUANT
#define MAX_MB_PLANE 3
@@ -288,10 +284,6 @@
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#endif
-#if CONFIG_NEW_QUANT
- int dq_off_index;
- int send_dq_bit;
-#endif // CONFIG_NEW_QUANT
/* deringing gain *per-superblock* */
int8_t cdef_strength;
int current_q_index;
@@ -463,9 +455,6 @@
// dequantization process. They have the same coefficient
// shift/scale as TX.
int16_t seg_dequant_QTX[MAX_SEGMENTS][2];
-#if CONFIG_NEW_QUANT
- dequant_val_type_nuq seg_dequant_nuq_QTX[MAX_SEGMENTS][QUANT_PROFILES][2];
-#endif
uint8_t *color_index_map;
// block size in pixels
diff --git a/av1/common/enums.h b/av1/common/enums.h
index e44d97b..7f9b3ff 100644
--- a/av1/common/enums.h
+++ b/av1/common/enums.h
@@ -658,17 +658,6 @@
#define SUPERRES_SCALE_DENOMINATOR_MIN (SCALE_NUMERATOR + 1)
#endif // CONFIG_HORZONLY_FRAME_SUPERRES
-#if CONFIG_NEW_QUANT
-typedef enum ATTRIBUTE_PACKED {
- DQ_MULT, // Dequant is just multiplication
- DQ_MULT_OFFSET1, // Dequant is multiplication and offset1
- DQ_MULT_OFFSET2, // Dequant is multiplication and offset2
- DQ_MULT_OFFSET3, // Dequant is multiplication and offset3
- DQ_TYPES
-} DqType;
-#define DQ_TYPE_BITS 2
-#endif // CONFIG_NEW_QUANT
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index dac8c3f..3083e31 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -386,11 +386,6 @@
int min_qmlevel;
int max_qmlevel;
#endif
-#if CONFIG_NEW_QUANT
- dequant_val_type_nuq y_dequant_nuq_QTX[MAX_SEGMENTS][QUANT_PROFILES][2];
- dequant_val_type_nuq u_dequant_nuq_QTX[MAX_SEGMENTS][QUANT_PROFILES][2];
- dequant_val_type_nuq v_dequant_nuq_QTX[MAX_SEGMENTS][QUANT_PROFILES][2];
-#endif
/* We allocate a MODE_INFO struct for each macroblock, together with
an extra row on top and column on the left to simplify prediction. */
@@ -610,9 +605,6 @@
// TODO(jingning): This can be combined with sign_bias later.
int8_t ref_frame_side[TOTAL_REFS_PER_FRAME];
#endif
-#if CONFIG_NEW_QUANT
- DqType dq_type;
-#endif // CONFIG_NEW_QUANT
#if CONFIG_FRAME_REFS_SIGNALING
int frame_refs_short_signaling;
@@ -800,10 +792,6 @@
memcpy(xd->plane[i].seg_iqmatrix, cm->y_iqmatrix, sizeof(cm->y_iqmatrix));
#endif
-#if CONFIG_NEW_QUANT
- memcpy(xd->plane[i].seg_dequant_nuq_QTX, cm->y_dequant_nuq_QTX,
- sizeof(cm->y_dequant_nuq_QTX));
-#endif
} else {
if (i == AOM_PLANE_U) {
memcpy(xd->plane[i].seg_dequant_QTX, cm->u_dequant_QTX,
@@ -812,10 +800,6 @@
memcpy(xd->plane[i].seg_iqmatrix, cm->u_iqmatrix,
sizeof(cm->u_iqmatrix));
#endif
-#if CONFIG_NEW_QUANT
- memcpy(xd->plane[i].seg_dequant_nuq_QTX, cm->u_dequant_nuq_QTX,
- sizeof(cm->u_dequant_nuq_QTX));
-#endif
} else {
memcpy(xd->plane[i].seg_dequant_QTX, cm->v_dequant_QTX,
sizeof(cm->v_dequant_QTX));
@@ -823,10 +807,6 @@
memcpy(xd->plane[i].seg_iqmatrix, cm->v_iqmatrix,
sizeof(cm->v_iqmatrix));
#endif
-#if CONFIG_NEW_QUANT
- memcpy(xd->plane[i].seg_dequant_nuq_QTX, cm->v_dequant_nuq_QTX,
- sizeof(cm->v_dequant_nuq_QTX));
-#endif
}
}
}
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c
index 34fcbd2..77120d2 100644
--- a/av1/common/quant_common.c
+++ b/av1/common/quant_common.c
@@ -16,255 +16,6 @@
#include "av1/common/seg_common.h"
#include "av1/common/blockd.h"
-#if CONFIG_NEW_QUANT
-// Zero-bin widths expressed as a fraction over 128 of the quant stepsize.
-// So a value x indicates the bin is actually factor x/128 of the
-// nominal quantization step. The width is only
-// for one side of zero, so the actual width is twice that.
-// These are needed only on the encoder side.
-static const uint8_t x0_nuq[X0_PROFILES][2] = {
- {
- // lossless
- 64, 64, // dc, ac
- },
-
- // optimize = 1
- {
- // Y/intra, optimize 1, low quality
- 64, 64, // dc, ac
- },
- {
- // Y/intra, optimize 1, high quality
- 64, 64, // dc, ac
- },
- {
- // UV/intra, optimize 1, low quality
- 64, 64, // dc, ac
- },
- {
- // UV/intra, optimize 1, high quality
- 64, 64, // dc, ac
- },
- {
- // Y/inter, optimize 1, low quality
- 64, 64, // dc, ac
- },
- {
- // Y/inter, optimize 1, high quality
- 64, 64, // dc, ac
- },
- {
- // UV/inter, optimize 1, low quality
- 64, 64, // dc, ac
- },
- {
- // UV/inter, optimize 1, high quality
- 64, 64, // dc, ac
- },
-
- // optimize = 0
- {
- // Y/intra, optimize 0, low quality
- 80, 80, // dc, ac
- },
- {
- // Y/intra, optimize 0, high quality
- 82, 82, // dc, ac
- },
- {
- // UV/intra, optimize 0, low quality
- 80, 80, // dc, ac
- },
- {
- // UV/intra, optimize 0, high quality
- 82, 82, // dc, ac
- },
- {
- // Y/inter, optimize 0, low quality
- 80, 80, // dc, ac
- },
- {
- // Y/inter, optimize 0, high quality
- 82, 82, // dc, ac
- },
- {
- // UV/inter, optimize 0, low quality
- 80, 80, // dc, ac
- },
- {
- // UV/inter, optimize 0, high quality
- 82, 82, // dc, ac
- },
-};
-
-// Offset tables needed on the decoder side
-static const int8_t doff_nuq[QUANT_PROFILES][2] = {
- {
- // lossless
- 0, 0, // dc, ac
- },
-
- // dq_type = 1
- {
- // Y/intra, dq_type 1, low quality
- -4, -6, // dc, ac
- },
- {
- // Y/intra, dq_type 1, high quality
- -2, -3, // dc, ac
- },
- {
- // UV/intra, dq_type 1, low quality
- -4, -6, // dc, ac
- },
- {
- // UV/intra, dq_type 1, high quality
- -2, -3, // dc, ac
- },
- {
- // Y/inter, dq_type 1, low quality
- -4, -6, // dc, ac
- },
- {
- // Y/inter, dq_type 1, high quality
- -3, -4, // dc, ac
- },
- {
- // UV/inter, dq_type 1, low quality
- -4, -6, // dc, ac
- },
- {
- // UV/inter, dq_type 1, high quality
- -3, -4, // dc, ac
- },
-
- // dq_type = 2
- {
- // Y/intra, dq_type 2, low quality
- 0, -2, // dc, ac
- },
- {
- // Y/intra, dq_type 2, high quality
- 5, 3, // dc, ac
- },
- {
- // UV/intra, dq_type 2, low quality
- -1, -3, // dc, ac
- },
- {
- // UV/intra, dq_type 2, high quality
- 4, 2, // dc, ac
- },
- {
- // Y/inter, dq_type 2, low quality
- -2, -4, // dc, ac
- },
- {
- // Y/inter, dq_type 2, high quality
- 2, 1, // dc, ac
- },
- {
- // UV/inter, dq_type 2, low quality
- -3, -5, // dc, ac
- },
- {
- // UV/inter, dq_type 2, high quality
- 1, 0, // dc, ac
- },
-
- // dq_type = 3
- {
- // Y/intra, dq_type 3, low quality
- 4, 2, // dc, ac
- },
- {
- // Y/intra, dq_type 3, high quality
- 12, 10, // dc, ac
- },
- {
- // UV/intra, dq_type 3, low quality
- 2, 0, // dc, ac
- },
- {
- // UV/intra, dq_type 3, high quality
- 10, 8, // dc, ac
- },
- {
- // Y/inter, dq_type 3, low quality
- 0, -2, // dc, ac
- },
- {
- // Y/inter, dq_type 3, high quality
- 8, 6, // dc, ac
- },
- {
- // UV/inter, dq_type 3, low quality
- -2, -4, // dc, ac
- },
- {
- // UV/inter, dq_type 3, high quality
- 6, 4, // dc, ac
- },
-};
-
-// Encoder only
-static INLINE uint8_t get_nuq_zbin(int is_ac_coeff, int x0_profile) {
- return x0_nuq[x0_profile][is_ac_coeff];
-}
-
-// Encoder only
-void av1_get_cuml_bins_nuq(int q, int is_ac_coeff, tran_low_t *zbin_width,
- int x0_profile) {
- const uint8_t zbin = get_nuq_zbin(is_ac_coeff, x0_profile);
- zbin_width[0] = ROUND_POWER_OF_TWO(zbin * q, 7);
-}
-
-static INLINE int8_t quant_to_doff_fixed(int is_ac_coeff, int q_profile) {
- return doff_nuq[q_profile][is_ac_coeff];
-}
-
-void av1_get_dequant_val_nuq(int q, int is_ac_coeff, tran_low_t *dq,
- int q_profile) {
- // Get the dequantization offset that will be applied to all non-zero bins.
- const tran_low_t doff = quant_to_doff_fixed(is_ac_coeff, q_profile);
- dq[0] = ROUND_POWER_OF_TWO_SIGNED(doff * q, 7);
- dq[1] = ROUND_POWER_OF_TWO_SIGNED(doff * q, 8);
- dq[2] = ROUND_POWER_OF_TWO_SIGNED(doff * q, 9);
-}
-
-tran_low_t av1_dequant_abscoeff_nuq(int v, int q,
-#if CONFIG_AOM_QM
- int q_profile, int is_ac_coeff,
-#else
- const tran_low_t *dq,
-#endif // CONFIG_AOM_QM
- int shift) {
- if (v == 0) return 0;
-#if CONFIG_AOM_QM
- const uint8_t doff = quant_to_doff_fixed(is_ac_coeff, q_profile);
- return ((q * v) >> shift) + ROUND_POWER_OF_TWO_SIGNED(doff * q, 7 + shift);
-#else
- return ((q * v) >> shift) + dq[shift];
-#endif
-}
-
-tran_low_t av1_dequant_coeff_nuq(int v, int q,
-#if CONFIG_AOM_QM
- int q_profile, int is_ac_coeff,
-#else
- const tran_low_t *dq,
-#endif // CONFIG_AOM_QM
- int shift) {
-#if CONFIG_AOM_QM
- tran_low_t dqmag =
- av1_dequant_abscoeff_nuq(abs(v), q, q_profile, is_ac_coeff, shift);
-#else
- tran_low_t dqmag = av1_dequant_abscoeff_nuq(abs(v), q, dq, shift);
-#endif // CONFIG_AOM_QM
- return (v < 0 ? -dqmag : dqmag);
-}
-#endif // CONFIG_NEW_QUANT
-
static const int16_t dc_qlookup_Q3[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,
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index f749dd9..1cbfc5f 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -63,91 +63,6 @@
TX_SIZE tx_size);
#endif // CONFIG_AOM_QM
-#if CONFIG_NEW_QUANT
-
-#define QUANT_PROFILES ((DQ_TYPES - 1) * 8 + 1)
-#define QUANT_RANGES 2
-#define NUQ_KNOTS 1
-
-// Encoder only
-#define X0_PROFILES (2 * 8 + 1)
-
-// dequant_val_type_nuq needs space for the 3 possible shift values
-// for different tx sizes
-typedef tran_low_t dequant_val_type_nuq[NUQ_KNOTS * 3];
-typedef tran_low_t cuml_bins_type_nuq[NUQ_KNOTS];
-void av1_get_dequant_val_nuq(int q, int is_ac_coeff, tran_low_t *dq,
- int dq_off_index);
-void av1_get_cuml_bins_nuq(int q, int is_ac_coeff, tran_low_t *cuml_bins,
- int q_profile);
-tran_low_t av1_dequant_abscoeff_nuq(int v, int q,
-#if CONFIG_AOM_QM
- int q_profile, int is_ac_coeff,
-#else
- const tran_low_t *dq,
-#endif // CONFIG_AOM_QM
- int shift);
-tran_low_t av1_dequant_coeff_nuq(int v, int q,
-#if CONFIG_AOM_QM
- int q_profile, int is_ac_coeff,
-#else
- const tran_low_t *dq,
-#endif // CONFIG_AOM_QM
- int shift);
-
-static INLINE int qindex_to_qrange(int qindex) {
- return (qindex < 140 ? 1 : 0);
-}
-
-static INLINE int get_dq_profile(DqType dqtype, int qindex, int is_inter,
- PLANE_TYPE plane_type) {
- // intra/inter, Y/UV, ctx, qrange
- static const int
- dq_profile_lookup[DQ_TYPES][REF_TYPES][PLANE_TYPES][QUANT_RANGES] = {
- {
- { { 0, 0 }, { 0, 0 } }, // intra: Y, UV
- { { 0, 0 }, { 0, 0 } }, // inter: Y, UV
- },
- {
- { { 1, 2 }, { 3, 4 } }, // intra: Y, UV
- { { 5, 6 }, { 7, 8 } }, // inter: Y, UV
- },
- {
- { { 9, 10 }, { 11, 12 } }, // intra: Y, UV
- { { 13, 14 }, { 15, 16 } }, // inter: Y, UV
- },
- {
- { { 17, 18 }, { 19, 20 } }, // intra: Y, UV
- { { 21, 22 }, { 23, 24 } }, // inter: Y, UV
- },
- };
- if (!qindex) return 0; // lossless
- if (!dqtype) return 0; // DQ_MULT
- return dq_profile_lookup[dqtype][is_inter][plane_type]
- [qindex_to_qrange(qindex)];
-}
-
-// Encoder only
-static INLINE int get_x0_profile(int optimize, int qindex, int is_inter,
- PLANE_TYPE plane_type) {
- // intra/inter, Y/UV, ctx, qrange
- static const int x0_profile_lookup[2][REF_TYPES][PLANE_TYPES][QUANT_RANGES] =
- {
- {
- { { 1, 2 }, { 3, 4 } }, // intra: Y, UV
- { { 5, 6 }, { 7, 8 } }, // inter: Y, UV
- },
- {
- { { 9, 10 }, { 11, 12 } }, // intra: Y, UV
- { { 13, 14 }, { 15, 16 } }, // inter: Y, UV
- },
- };
- if (!qindex) return 0; // lossless
- return x0_profile_lookup[!optimize][is_inter][plane_type]
- [qindex_to_qrange(qindex)];
-}
-#endif // CONFIG_NEW_QUANT
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 590d53b..1cf9752 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -1150,19 +1150,6 @@
cm->v_iqmatrix[i][j] = av1_iqmatrix(cm, qmlevel, AOM_PLANE_V, j);
}
#endif // CONFIG_AOM_QM
-#if CONFIG_NEW_QUANT
- for (int dq = 0; dq < QUANT_PROFILES; dq++) {
- // DC and AC coefs
- for (int b = 0; b < 2; ++b) {
- av1_get_dequant_val_nuq(cm->y_dequant_QTX[i][b != 0], b,
- cm->y_dequant_nuq_QTX[i][dq][b], dq);
- av1_get_dequant_val_nuq(cm->u_dequant_QTX[i][b != 0], b,
- cm->u_dequant_nuq_QTX[i][dq][b], dq);
- av1_get_dequant_val_nuq(cm->v_dequant_QTX[i][b != 0], b,
- cm->v_dequant_nuq_QTX[i][dq][b], dq);
- }
- }
-#endif // CONFIG_NEW_QUANT
}
}
@@ -3343,13 +3330,6 @@
}
cm->all_lossless = all_lossless(cm, xd);
setup_segmentation_dequant(cm);
-#if CONFIG_NEW_QUANT
- if (!cm->all_lossless) {
- cm->dq_type = aom_rb_read_literal(rb, DQ_TYPE_BITS);
- } else {
- cm->dq_type = DQ_MULT;
- }
-#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
setup_cdef(cm, rb);
}
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index 6a2b0a8..b1833e3 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -50,7 +50,6 @@
return eob;
}
-#if !CONFIG_NEW_QUANT
static INLINE int get_dqv(const int16_t *dequant, int coeff_idx,
const qm_val_t *iqmatrix) {
int dqv = dequant[!!coeff_idx];
@@ -63,18 +62,10 @@
#endif
return dqv;
}
-#endif
uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *const r, const int blk_row,
const int blk_col, const int plane,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- int dq_profile,
-#else
- dequant_val_type_nuq *dq_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
const TXB_CTX *const txb_ctx, const TX_SIZE tx_size,
int16_t *const max_scan_line, int *const eob) {
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
@@ -89,13 +80,6 @@
const int16_t *const dequant = pd->seg_dequant_QTX[mbmi->segment_id];
tran_low_t *const tcoeffs = pd->dqcoeff;
const int shift = av1_get_tx_scale(tx_size);
-#if CONFIG_NEW_QUANT
-#if !CONFIG_AOM_QM
- const tran_low_t *dqv_val = &dq_val[0][0];
-#endif // !CONFIG_AOM_QM
-
- const int nq_shift = shift;
-#endif // CONFIG_NEW_QUANT && !CONFIG_AOM_QM
const int bwl = get_txb_bwl(tx_size);
const int width = get_txb_wide(tx_size);
const int height = get_txb_high(tx_size);
@@ -273,19 +257,8 @@
}
cul_level += level;
tran_low_t dq_coeff;
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq_coeff = av1_dequant_abscoeff_nuq(level, dequant[!!c], dq_profile, !!c,
- nq_shift);
-#else
- dqv_val = &dq_val[pos != 0][0];
- dq_coeff =
- av1_dequant_abscoeff_nuq(level, dequant[!!c], dqv_val, nq_shift);
-#endif // CONFIG_AOM_QM
-#else
dq_coeff = level * get_dqv(dequant, scan[c], iqmatrix);
dq_coeff = dq_coeff >> shift;
-#endif // CONFIG_NEW_QUANT
if (sign) {
dq_coeff = -dq_coeff;
}
@@ -312,25 +285,12 @@
const BLOCK_SIZE bsize = mbmi->sb_type;
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
-#if CONFIG_NEW_QUANT
- const int seg_id = mbmi->segment_id;
- const int ref = is_inter_block(mbmi);
- int dq = get_dq_profile(cm->dq_type, xd->qindex[seg_id], ref, pd->plane_type);
-#endif // CONFIG_NEW_QUANT
TXB_CTX txb_ctx;
get_txb_ctx(plane_bsize, tx_size, plane, pd->above_context + col,
pd->left_context + row, &txb_ctx);
- uint8_t cul_level =
- av1_read_coeffs_txb(cm, xd, r, row, col, plane,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq,
-#else
- pd->seg_dequant_nuq_QTX[seg_id][dq],
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- &txb_ctx, tx_size, max_scan_line, eob);
+ uint8_t cul_level = av1_read_coeffs_txb(cm, xd, r, row, col, plane, &txb_ctx,
+ tx_size, max_scan_line, eob);
av1_set_contexts(xd, pd, plane, tx_size, cul_level, col, row);
return cul_level;
}
diff --git a/av1/decoder/decodetxb.h b/av1/decoder/decodetxb.h
index 13f089d..fb0b19f 100644
--- a/av1/decoder/decodetxb.h
+++ b/av1/decoder/decodetxb.h
@@ -21,13 +21,6 @@
uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *const xd,
aom_reader *const r, const int blk_row,
const int blk_col, const int plane,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- int dq_profile,
-#else
- dequant_val_type_nuq *dq_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
const TXB_CTX *const txb_ctx, const TX_SIZE tx_size,
int16_t *const max_scan_line, int *const eob);
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 9bdd831..b1418da 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -60,13 +60,6 @@
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
-#if CONFIG_AOM_QM
- int dq_profile,
-#else
- dequant_val_type_nuq *dq_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
qm_val_t *iqm[TX_SIZES_ALL],
#endif // CONFIG_AOM_QM
@@ -91,16 +84,9 @@
const uint8_t *band_translate = get_band_translate(tx_size);
int v, token;
int32_t dqv = dq[0];
-#if CONFIG_NEW_QUANT && !CONFIG_AOM_QM
- const tran_low_t *dqv_val = &dq_val[0][0];
-#endif // CONFIG_NEW_QUANT && !CONFIG_AOM_QM
int dq_shift = av1_get_tx_scale(tx_size);
-#if CONFIG_NEW_QUANT
- int nq_shift = dq_shift;
-#endif // CONFIG_NEW_QUANT
-
band = *band_translate++;
int more_data = 1;
@@ -109,10 +95,6 @@
int last_pos = (c + 1 == max_eob);
int first_pos = (c == 0);
-#if CONFIG_NEW_QUANT && !CONFIG_AOM_QM
- dqv_val = &dq_val[band != 0][0];
-#endif // CONFIG_NEW_QUANT && !CONFIG_AOM_QM
-
comb_token = last_pos ? 2 * aom_read_bit(r, ACCT_STR) + 2
: aom_read_symbol(r, coef_head_cdfs[band][ctx],
HEAD_TOKENS + first_pos, ACCT_STR) +
@@ -144,9 +126,6 @@
if (token > ONE_TOKEN)
token +=
aom_read_symbol(r, coef_tail_cdfs[band][ctx], TAIL_TOKENS, ACCT_STR);
-#if CONFIG_NEW_QUANT && !CONFIG_AOM_QM
- dqv_val = &dq_val[band != 0][0];
-#endif // CONFIG_NEW_QUANT && !CONFIG_AOM_QM
*max_scan_line = AOMMAX(*max_scan_line, scan[c]);
token_cache[scan[c]] = av1_pt_energy_class[token];
@@ -158,15 +137,7 @@
dqv = ((iqmatrix[scan[c]] * (int)dqv) + (1 << (AOM_QM_BITS - 1))) >>
AOM_QM_BITS;
#endif
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- v = av1_dequant_abscoeff_nuq(val, dqv, dq_profile, band != 0, nq_shift);
-#else
- v = av1_dequant_abscoeff_nuq(val, dqv, dqv_val, nq_shift);
-#endif // CONFIG_AOM_QM
-#else
v = (int)(((int64_t)val * dqv) >> dq_shift);
-#endif
v = (int)check_range(aom_read_bit(r, ACCT_STR) ? -v : v, xd->bd);
@@ -270,24 +241,12 @@
const int16_t *const dequant = pd->seg_dequant_QTX[seg_id];
const int ctx =
get_entropy_context(tx_size, pd->above_context + x, pd->left_context + y);
-#if CONFIG_NEW_QUANT
- const int ref = is_inter_block(&xd->mi[0]->mbmi);
- int dq = get_dq_profile(cm->dq_type, xd->qindex[seg_id], ref, pd->plane_type);
-#endif // CONFIG_NEW_QUANT
const int eob =
decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq, pd->seg_iqmatrix[seg_id],
-#else
- pd->seg_dequant_nuq_QTX[seg_id][dq],
-#endif // CONFIG_AOM_QM
-#else
#if CONFIG_AOM_QM
pd->seg_iqmatrix[seg_id],
#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
ctx, sc->scan, sc->neighbors, max_scan_line, r);
av1_set_contexts(xd, pd, plane, tx_size, eob > 0, x, y);
(void)cm;
diff --git a/av1/encoder/av1_quantize.c b/av1/encoder/av1_quantize.c
index 2a97640..599caa7 100644
--- a/av1/encoder/av1_quantize.c
+++ b/av1/encoder/av1_quantize.c
@@ -24,512 +24,6 @@
#include "av1/encoder/encoder.h"
#include "av1/encoder/rd.h"
-#if CONFIG_NEW_QUANT
-static INLINE int quantize_coeff_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t quant_shift,
- const int zbin, const int16_t dequant, int dq, int is_ac_coeff,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const qm_val_t wt) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- if (abs_coeff * wt >= (AOMMAX(zbin, cuml_bins_ptr[0]) * (1 << AOM_QM_BITS))) {
- int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
- tmp -= cuml_bins_ptr[0];
- tmp *= wt;
- q = NUQ_KNOTS +
- (((((tmp * quant) >> 16) + tmp) * quant_shift) >> (16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, 0);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dequant_val, 0);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int quantize_coeff_bigtx_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t quant_shift,
- const int zbin, const int16_t dequant, int dq, int is_ac_coeff,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const qm_val_t wt,
- int logsizeby16) {
- const int zbin_val = ROUND_POWER_OF_TWO(zbin, logsizeby16);
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- const int cuml_bins_ptr_val =
- ROUND_POWER_OF_TWO(cuml_bins_ptr[0], logsizeby16);
- if (abs_coeff * wt >=
- (AOMMAX(zbin_val, cuml_bins_ptr_val) * (1 << AOM_QM_BITS))) {
- int tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
- tmp -= cuml_bins_ptr_val;
- tmp *= wt;
- q = NUQ_KNOTS + (((((tmp * quant) >> 16) + tmp) * quant_shift) >>
- (16 - logsizeby16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, logsizeby16);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dequant_val, logsizeby16);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int quantize_coeff_fp_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t dequant, int dq,
- int is_ac_coeff, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, const qm_val_t wt) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
-
- if (abs_coeff * wt >= (cuml_bins_ptr[0] * (1 << AOM_QM_BITS))) {
- int64_t tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
- q = NUQ_KNOTS +
- (int)(((tmp - cuml_bins_ptr[0]) * wt * quant) >> (16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, 0);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dequant_val, 0);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int quantize_coeff_bigtx_fp_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t dequant, int dq,
- int is_ac_coeff, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, const qm_val_t wt, int logsizeby16) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- if (abs_coeff * wt >=
- (cuml_bins_ptr[0] * (1 << (AOM_QM_BITS - logsizeby16)))) {
- int64_t tmp = clamp(abs_coeff, INT16_MIN, INT16_MAX);
- q = NUQ_KNOTS +
- (int)(((tmp - ROUND_POWER_OF_TWO(cuml_bins_ptr[0], logsizeby16)) * wt *
- quant) >>
- (16 - logsizeby16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, logsizeby16);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dequant_val, logsizeby16);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-void quantize_dc_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_nuq(coeff_ptr[rc], quant, quant_shift, zbin_ptr[rc],
- dequant_iwt, dq, rc, cuml_bins_ptr, dequant_val,
- qcoeff_ptr, dqcoeff_ptr, wt))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_dc_fp_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t quant,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_fp_nuq(coeff_ptr[rc], quant, dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_dc_32x32_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_bigtx_nuq(coeff_ptr[rc], quant, quant_shift,
- zbin_ptr[rc], dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt, av1_get_tx_scale(TX_32X32)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_dc_32x32_fp_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t quant,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc], quant, dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_32X32)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_dc_64x64_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_bigtx_nuq(coeff_ptr[rc], quant, quant_shift,
- zbin_ptr[rc], dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt, av1_get_tx_scale(TX_64X64)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_dc_64x64_fp_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t quant,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc], quant, dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_64X64)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t *quant_ptr, const int16_t *quant_shift_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_nuq(coeff_ptr[rc], quant_ptr[rc != 0],
- quant_shift_ptr[rc != 0], zbin_ptr[rc != 0],
- dequant_iwt, dq, rc != 0, cuml_bins_ptr[rc != 0],
- dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_fp_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *quant_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_fp_nuq(coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt,
- dq, rc != 0, cuml_bins_ptr[rc != 0],
- dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_32x32_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t *quant_ptr,
- const int16_t *quant_shift_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], quant_shift_ptr[rc != 0],
- zbin_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_32X32)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_32x32_fp_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *quant_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_bigtx_fp_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_32X32)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_64x64_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t *quant_ptr,
- const int16_t *quant_shift_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], quant_shift_ptr[rc != 0],
- zbin_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_64X64)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void quantize_64x64_fp_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *quant_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (quantize_coeff_bigtx_fp_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_64X64)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-#endif // CONFIG_NEW_QUANT
-
void av1_quantize_skip(intptr_t n_coeffs, tran_low_t *qcoeff_ptr,
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr) {
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
@@ -818,206 +312,14 @@
const qm_val_t *qm_ptr = qparam->qmatrix;
const qm_val_t *iqm_ptr = qparam->iqmatrix;
#else
- const qm_val_t *qm_ptr = NULL;
- const qm_val_t *iqm_ptr = NULL;
+ const qm_val_t *qm_ptr = NULL;
+ const qm_val_t *iqm_ptr = NULL;
#endif
quantize_dc(coeff_ptr, (int)n_coeffs, skip_block, p->round_QTX,
p->quant_fp_QTX[0], qcoeff_ptr, dqcoeff_ptr, p->dequant_QTX[0],
eob_ptr, qm_ptr, iqm_ptr, qparam->log_scale);
}
-#if CONFIG_NEW_QUANT
-void av1_quantize_b_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- quantize_nuq(coeff_ptr, n_coeffs, skip_block, p->zbin_QTX, p->quant_QTX,
- p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 1:
- quantize_32x32_nuq(coeff_ptr, n_coeffs, skip_block, p->zbin_QTX,
- p->quant_QTX, p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)
- p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr,
- iqm_ptr);
- break;
- case 2:
- quantize_64x64_nuq(coeff_ptr, n_coeffs, skip_block, p->zbin_QTX,
- p->quant_QTX, p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)
- p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr,
- iqm_ptr);
- break;
- default: assert(0);
- }
-}
-
-void av1_quantize_fp_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- quantize_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 1:
- quantize_32x32_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 2:
- quantize_64x64_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- default: assert(0);
- }
-}
-
-void av1_quantize_dc_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- (void)sc;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- quantize_dc_fp_nuq(coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- case 1:
- quantize_dc_32x32_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- case 2:
- quantize_dc_64x64_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- default: assert(0);
- }
-}
-#endif // CONFIG_NEW_QUANT
-
void av1_highbd_quantize_fp_facade(const tran_low_t *coeff_ptr,
intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
tran_low_t *qcoeff_ptr,
@@ -1154,8 +456,8 @@
const qm_val_t *qm_ptr = qparam->qmatrix;
const qm_val_t *iqm_ptr = qparam->iqmatrix;
#else
- const qm_val_t *qm_ptr = NULL;
- const qm_val_t *iqm_ptr = NULL;
+ const qm_val_t *qm_ptr = NULL;
+ const qm_val_t *iqm_ptr = NULL;
#endif // CONFIG_AOM_QM
(void)sc;
@@ -1166,688 +468,6 @@
qparam->log_scale);
}
-#if CONFIG_NEW_QUANT
-static INLINE int highbd_quantize_coeff_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t quant_shift,
- const int zbin, const int16_t dequant, int dq, int is_ac_coeff,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const qm_val_t wt) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- if (abs_coeff * wt >= (AOMMAX(zbin, cuml_bins_ptr[0]) * (1 << AOM_QM_BITS))) {
- int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
- tmp -= cuml_bins_ptr[0];
- tmp *= wt;
- q = NUQ_KNOTS + (int)(((((tmp * quant) >> 16) + tmp) * quant_shift) >>
- (16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, 0);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dequant_val, 0);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int highbd_quantize_coeff_fp_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t dequant, int dq,
- int is_ac_coeff, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, const qm_val_t wt) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- if (abs_coeff * wt >= (cuml_bins_ptr[0] * (1 << AOM_QM_BITS))) {
- int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
- q = NUQ_KNOTS +
- (int)(((tmp - cuml_bins_ptr[0]) * wt * quant) >> (16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, 0);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr = av1_dequant_abscoeff_nuq(q, dequant, dequant_val, 0);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int highbd_quantize_coeff_bigtx_fp_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t dequant, int dq,
- int is_ac_coeff, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, const qm_val_t wt, int logsizeby16) {
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- if (abs_coeff * wt >=
- (cuml_bins_ptr[0] * (1 << (AOM_QM_BITS - logsizeby16)))) {
- int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
- q = NUQ_KNOTS +
- (int)(((tmp - ROUND_POWER_OF_TWO(cuml_bins_ptr[0], logsizeby16)) * wt *
- quant) >>
- (16 - logsizeby16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, logsizeby16);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dequant_val, logsizeby16);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-static INLINE int highbd_quantize_coeff_bigtx_nuq(
- const tran_low_t coeffv, const int16_t quant, const int16_t quant_shift,
- const int zbin, const int16_t dequant, int dq, int is_ac_coeff,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const qm_val_t wt,
- int logsizeby16) {
- const int zbin_val = ROUND_POWER_OF_TWO(zbin, logsizeby16);
- const int coeff = coeffv;
- const int coeff_sign = (coeff >> 31);
- const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
- int q = 0;
- const int cuml_bins_ptr_val =
- ROUND_POWER_OF_TWO(cuml_bins_ptr[0], logsizeby16);
- if (abs_coeff * wt >=
- (AOMMAX(zbin_val, cuml_bins_ptr_val) * (1 << AOM_QM_BITS))) {
- int64_t tmp = clamp(abs_coeff, INT32_MIN, INT32_MAX);
- tmp -= cuml_bins_ptr_val;
- tmp *= wt;
- q = NUQ_KNOTS + (int)(((((tmp * quant) >> 16) + tmp) * quant_shift) >>
- (16 - logsizeby16 + AOM_QM_BITS));
-#if CONFIG_AOM_QM
- (void)dequant_val;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dq, is_ac_coeff, logsizeby16);
-#else
- (void)dq;
- (void)is_ac_coeff;
- *dqcoeff_ptr =
- av1_dequant_abscoeff_nuq(q, dequant, dequant_val, logsizeby16);
-#endif
- *qcoeff_ptr = (q ^ coeff_sign) - coeff_sign;
- *dqcoeff_ptr = *qcoeff_ptr < 0 ? -*dqcoeff_ptr : *dqcoeff_ptr;
- } else {
- *qcoeff_ptr = 0;
- *dqcoeff_ptr = 0;
- }
- return (q != 0);
-}
-
-void highbd_quantize_dc_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_nuq(
- coeff_ptr[rc], quant, quant_shift, zbin_ptr[rc], dequant_iwt, dq,
- rc, cuml_bins_ptr, dequant_val, qcoeff_ptr, dqcoeff_ptr, wt))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_dc_fp_nuq(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t quant,
- const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_fp_nuq(coeff_ptr[rc], quant, dequant_iwt, dq, rc,
- cuml_bins_ptr, dequant_val, qcoeff_ptr,
- dqcoeff_ptr, wt))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *zbin_ptr,
- const int16_t *quant_ptr,
- const int16_t *quant_shift_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], quant_shift_ptr[rc != 0],
- zbin_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_32x32_nuq_c(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *zbin_ptr, const int16_t *quant_ptr,
- const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], quant_shift_ptr[rc != 0],
- zbin_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_32X32)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_32x32_fp_nuq_c(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *quant_ptr, const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_bigtx_fp_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_32X32)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_64x64_nuq_c(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *zbin_ptr, const int16_t *quant_ptr,
- const int16_t *quant_shift_ptr, const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], quant_shift_ptr[rc != 0],
- zbin_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_64X64)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_64x64_fp_nuq_c(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *quant_ptr, const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_bigtx_fp_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt, av1_get_tx_scale(TX_64X64)))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_fp_nuq_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- int skip_block, const int16_t *quant_ptr,
- const int16_t *dequant_ptr, int dq,
- const cuml_bins_type_nuq *cuml_bins_ptr,
- const dequant_val_type_nuq *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const int16_t *scan,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- int i;
- for (i = 0; i < n_coeffs; i++) {
- const int rc = scan[i];
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
- AOM_QM_BITS
- : dequant_ptr[rc != 0];
- if (highbd_quantize_coeff_fp_nuq(
- coeff_ptr[rc], quant_ptr[rc != 0], dequant_iwt, dq, rc != 0,
- cuml_bins_ptr[rc != 0], dequant_val[rc != 0], &qcoeff_ptr[rc],
- &dqcoeff_ptr[rc], wt))
- eob = i;
- }
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_dc_32x32_nuq(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *zbin_ptr, const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant, quant_shift, zbin_ptr[rc], dequant_iwt, dq,
- rc, cuml_bins_ptr, dequant_val, qcoeff_ptr, dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_32X32)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_dc_32x32_fp_nuq(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t quant, const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc], quant, dequant_iwt,
- dq, rc, cuml_bins_ptr, dequant_val,
- qcoeff_ptr, dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_32X32)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_dc_64x64_nuq(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t *zbin_ptr, const int16_t quant, const int16_t quant_shift,
- const int16_t dequant, int dq, const tran_low_t *cuml_bins_ptr,
- const tran_low_t *dequant_val, tran_low_t *qcoeff_ptr,
- tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr, const qm_val_t *qm_ptr,
- const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_bigtx_nuq(
- coeff_ptr[rc], quant, quant_shift, zbin_ptr[rc], dequant_iwt, dq,
- rc, cuml_bins_ptr, dequant_val, qcoeff_ptr, dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_64X64)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void highbd_quantize_dc_64x64_fp_nuq(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
- const int16_t quant, const int16_t dequant, int dq,
- const tran_low_t *cuml_bins_ptr, const tran_low_t *dequant_val,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr) {
- int eob = -1;
- memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
- memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
- if (!skip_block) {
- const int rc = 0;
- const qm_val_t wt = qm_ptr ? qm_ptr[rc] : (1 << AOM_QM_BITS);
- const qm_val_t iwt = iqm_ptr ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
- const int16_t dequant_iwt =
- CONFIG_AOM_QM
- ? (dequant * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS
- : dequant;
- if (highbd_quantize_coeff_bigtx_fp_nuq(coeff_ptr[rc], quant, dequant_iwt,
- dq, rc, cuml_bins_ptr, dequant_val,
- qcoeff_ptr, dqcoeff_ptr, wt,
- av1_get_tx_scale(TX_64X64)))
- eob = 0;
- }
- *eob_ptr = eob + 1;
-}
-
-void av1_highbd_quantize_b_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- highbd_quantize_nuq(coeff_ptr, n_coeffs, skip_block, p->zbin_QTX,
- p->quant_QTX, p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)
- p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr,
- iqm_ptr);
- break;
- case 1:
- highbd_quantize_32x32_nuq(
- coeff_ptr, n_coeffs, skip_block, p->zbin_QTX, p->quant_QTX,
- p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 2:
- highbd_quantize_64x64_nuq(
- coeff_ptr, n_coeffs, skip_block, p->zbin_QTX, p->quant_QTX,
- p->quant_shift_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- default: assert(0);
- }
-}
-
-void av1_highbd_quantize_fp_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- highbd_quantize_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 1:
- highbd_quantize_32x32_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- case 2:
- highbd_quantize_64x64_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX, p->dequant_QTX, dq,
- (const cuml_bins_type_nuq *)p->cuml_bins_nuq[x0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- (const dequant_val_type_nuq *)p->dequant_val_nuq_QTX[dq],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, sc->scan, qm_ptr, iqm_ptr);
- break;
- default: assert(0);
- }
-}
-
-void av1_highbd_quantize_dc_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam) {
- // obsolete skip_block
- const int skip_block = 0;
- const int dq = qparam->dq;
- const int x0 = qparam->x0;
- (void)sc;
- const qm_val_t *qm_ptr;
- const qm_val_t *iqm_ptr;
-#if CONFIG_AOM_QM
- if (qparam->qmatrix != NULL && qparam->iqmatrix != NULL) {
- qm_ptr = qparam->qmatrix;
- iqm_ptr = qparam->iqmatrix;
- } else {
- qm_ptr = NULL;
- iqm_ptr = NULL;
- }
-#else
- qm_ptr = NULL;
- iqm_ptr = NULL;
-#endif // CONFIG_AOM_QM
-
- switch (qparam->log_scale) {
- case 0:
- highbd_quantize_dc_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- case 1:
- highbd_quantize_dc_32x32_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- case 2:
- highbd_quantize_dc_64x64_fp_nuq(
- coeff_ptr, n_coeffs, skip_block, p->quant_fp_QTX[0],
- p->dequant_QTX[0], dq, p->cuml_bins_nuq[x0][0],
-#if CONFIG_AOM_QM
- NULL,
-#else
- p->dequant_val_nuq_QTX[dq][0],
-#endif // CONFIG_AOM_QM
- qcoeff_ptr, dqcoeff_ptr, eob_ptr, qm_ptr, iqm_ptr);
- break;
- default: assert(0);
- }
-}
-#endif // CONFIG_NEW_QUANT
-
void av1_highbd_quantize_fp_c(
const tran_low_t *coeff_ptr, intptr_t count, int skip_block,
const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr,
@@ -1940,41 +560,6 @@
deq->v_dequant_Q3[q][i] = quant_Q3;
}
-#if CONFIG_NEW_QUANT
- int x0;
- for (x0 = 0; x0 < X0_PROFILES; x0++) {
- // DC and AC coefs
- for (i = 0; i < 2; i++) {
- const int y_quant = deq->y_dequant_QTX[q][i != 0];
- const int u_quant = deq->u_dequant_QTX[q][i != 0];
- const int v_quant = deq->v_dequant_QTX[q][i != 0];
- av1_get_cuml_bins_nuq(y_quant, i, quants->y_cuml_bins_nuq[x0][q][i],
- x0);
- av1_get_cuml_bins_nuq(u_quant, i, quants->u_cuml_bins_nuq[x0][q][i],
- x0);
- av1_get_cuml_bins_nuq(v_quant, i, quants->v_cuml_bins_nuq[x0][q][i],
- x0);
- }
- }
- int dq;
- for (dq = 0; dq < QUANT_PROFILES; dq++) {
- // DC and AC coefs
- for (i = 0; i < 2; i++) {
-#if !CONFIG_AOM_QM
- const int y_quant = deq->y_dequant_QTX[q][i != 0];
- const int u_quant = deq->u_dequant_QTX[q][i != 0];
- const int v_quant = deq->v_dequant_QTX[q][i != 0];
- av1_get_dequant_val_nuq(y_quant, i,
- deq->y_dequant_val_nuq_QTX[dq][q][i], dq);
- av1_get_dequant_val_nuq(u_quant, i,
- deq->u_dequant_val_nuq_QTX[dq][q][i], dq);
- av1_get_dequant_val_nuq(v_quant, i,
- deq->v_dequant_val_nuq_QTX[dq][q][i], dq);
-#endif // !CONFIG_AOM_QM
- }
- }
-#endif // CONFIG_NEW_QUANT
-
for (i = 2; i < 8; i++) { // 8: SIMD width
quants->y_quant[q][i] = quants->y_quant[q][1];
quants->y_quant_fp[q][i] = quants->y_quant_fp[q][1];
@@ -2026,10 +611,10 @@
? cm->base_qindex + xd->delta_qindex
: cm->base_qindex));
#else
- int current_q_index = AOMMAX(
- 0, AOMMIN(QINDEX_RANGE - 1, cm->delta_q_present_flag
- ? cm->base_qindex + xd->delta_qindex
- : cm->base_qindex));
+ int current_q_index = AOMMAX(
+ 0, AOMMIN(QINDEX_RANGE - 1, cm->delta_q_present_flag
+ ? cm->base_qindex + xd->delta_qindex
+ : cm->base_qindex));
#endif
const int qindex = av1_get_qindex(&cm->seg, segment_id, current_q_index);
const int rdmult = av1_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q);
@@ -2063,17 +648,6 @@
sizeof(cm->giqmatrix[qmlevel][0]));
#endif
xd->plane[0].dequant_Q3 = cpi->dequants.y_dequant_Q3[qindex];
-#if CONFIG_NEW_QUANT
- for (int x0 = 0; x0 < X0_PROFILES; x0++) {
- x->plane[0].cuml_bins_nuq[x0] = quants->y_cuml_bins_nuq[x0][qindex];
- }
- for (int dq = 0; dq < QUANT_PROFILES; dq++) {
-#if !CONFIG_AOM_QM
- x->plane[0].dequant_val_nuq_QTX[dq] =
- cpi->dequants.y_dequant_val_nuq_QTX[dq][qindex];
-#endif // !CONFIG_AOM_QM
- }
-#endif // CONFIG_NEW_QUANT
// U
#if CONFIG_AOM_QM
@@ -2099,17 +673,6 @@
#endif
x->plane[1].dequant_QTX = cpi->dequants.u_dequant_QTX[qindex];
xd->plane[1].dequant_Q3 = cpi->dequants.u_dequant_Q3[qindex];
-#if CONFIG_NEW_QUANT
- for (int x0 = 0; x0 < X0_PROFILES; x0++) {
- x->plane[1].cuml_bins_nuq[x0] = quants->u_cuml_bins_nuq[x0][qindex];
- }
- for (int dq = 0; dq < QUANT_PROFILES; dq++) {
-#if !CONFIG_AOM_QM
- x->plane[1].dequant_val_nuq_QTX[dq] =
- cpi->dequants.u_dequant_val_nuq_QTX[dq][qindex];
-#endif // !CONFIG_AOM_QM
- }
-#endif // CONFIG_NEW_QUANT
}
// V
#if CONFIG_AOM_QM
@@ -2135,17 +698,6 @@
#endif
x->plane[2].dequant_QTX = cpi->dequants.v_dequant_QTX[qindex];
xd->plane[2].dequant_Q3 = cpi->dequants.v_dequant_Q3[qindex];
-#if CONFIG_NEW_QUANT
- for (int x0 = 0; x0 < X0_PROFILES; x0++) {
- x->plane[2].cuml_bins_nuq[x0] = quants->v_cuml_bins_nuq[x0][qindex];
- }
- for (int dq = 0; dq < QUANT_PROFILES; dq++) {
-#if !CONFIG_AOM_QM
- x->plane[2].dequant_val_nuq_QTX[dq] =
- cpi->dequants.v_dequant_val_nuq_QTX[dq][qindex];
-#endif // !CONFIG_AOM_QM
- }
-#endif // CONFIG_NEW_QUANT
}
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 6bb8c88..149b1e7 100644
--- a/av1/encoder/av1_quantize.h
+++ b/av1/encoder/av1_quantize.h
@@ -24,10 +24,6 @@
typedef struct QUANT_PARAM {
int log_scale;
TX_SIZE tx_size;
-#if CONFIG_NEW_QUANT
- int dq;
- int x0;
-#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
const qm_val_t *qmatrix;
const qm_val_t *iqmatrix;
@@ -45,14 +41,6 @@
// av1_quantize.c.
// All of its fields use the same coefficient shift/scaling at TX.
typedef struct {
-#if CONFIG_NEW_QUANT
- DECLARE_ALIGNED(16, tran_low_t,
- y_cuml_bins_nuq[QUANT_PROFILES][QINDEX_RANGE][2][NUQ_KNOTS]);
- DECLARE_ALIGNED(16, tran_low_t,
- u_cuml_bins_nuq[QUANT_PROFILES][QINDEX_RANGE][2][NUQ_KNOTS]);
- DECLARE_ALIGNED(16, tran_low_t,
- v_cuml_bins_nuq[QUANT_PROFILES][QINDEX_RANGE][2][NUQ_KNOTS]);
-#endif // CONFIG_NEW_QUANT
// 0: dc 1: ac 2-8: ac repeated to SIMD width
DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]);
DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]);
@@ -92,14 +80,6 @@
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
-#if CONFIG_NEW_QUANT && !CONFIG_AOM_QM
- DECLARE_ALIGNED(16, dequant_val_type_nuq,
- y_dequant_val_nuq_QTX[QUANT_PROFILES][QINDEX_RANGE][2]);
- DECLARE_ALIGNED(16, dequant_val_type_nuq,
- u_dequant_val_nuq_QTX[QUANT_PROFILES][QINDEX_RANGE][2]);
- DECLARE_ALIGNED(16, dequant_val_type_nuq,
- v_dequant_val_nuq_QTX[QUANT_PROFILES][QINDEX_RANGE][2]);
-#endif // CONFIG_NEW_QUANT && !CONFIG_AOM_QM
} Dequants;
struct AV1_COMP;
@@ -141,26 +121,6 @@
tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
const SCAN_ORDER *sc, const QUANT_PARAM *qparam);
-#if CONFIG_NEW_QUANT
-void av1_quantize_fp_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam);
-
-void av1_quantize_b_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam);
-
-void av1_quantize_dc_nuq_facade(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
- const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
- uint16_t *eob_ptr, const SCAN_ORDER *sc,
- const QUANT_PARAM *qparam);
-#endif // CONFIG_NEW_QUANT
-
void av1_highbd_quantize_fp_facade(const tran_low_t *coeff_ptr,
intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
tran_low_t *qcoeff_ptr,
@@ -182,23 +142,6 @@
const SCAN_ORDER *sc,
const QUANT_PARAM *qparam);
-#if CONFIG_NEW_QUANT
-void av1_highbd_quantize_fp_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam);
-
-void av1_highbd_quantize_b_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam);
-
-void av1_highbd_quantize_dc_nuq_facade(
- const tran_low_t *coeff_ptr, intptr_t n_coeffs, const MACROBLOCK_PLANE *p,
- tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, uint16_t *eob_ptr,
- const SCAN_ORDER *sc, const QUANT_PARAM *qparam);
-#endif // CONFIG_NEW_QUANT
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index dff1983..b0c37fa 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3937,11 +3937,6 @@
}
}
}
-#if CONFIG_NEW_QUANT
- if (!cm->all_lossless) {
- aom_wb_write_literal(wb, cm->dq_type, DQ_TYPE_BITS);
- }
-#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
encode_cdef(cm, wb);
}
@@ -4349,11 +4344,6 @@
}
}
}
-#if CONFIG_NEW_QUANT
- if (!cm->all_lossless) {
- aom_wb_write_literal(wb, cm->dq_type, DQ_TYPE_BITS);
- }
-#endif // CONFIG_NEW_QUANT
if (!cm->all_lossless) {
encode_cdef(cm, wb);
}
diff --git a/av1/encoder/block.h b/av1/encoder/block.h
index 08e1da1..7c890b8 100644
--- a/av1/encoder/block.h
+++ b/av1/encoder/block.h
@@ -51,10 +51,6 @@
const int16_t *zbin_QTX;
const int16_t *round_QTX;
const int16_t *dequant_QTX;
-#if CONFIG_NEW_QUANT
- const cuml_bins_type_nuq *cuml_bins_nuq[X0_PROFILES];
- const dequant_val_type_nuq *dequant_val_nuq_QTX[QUANT_PROFILES];
-#endif // CONFIG_NEW_QUANT
} MACROBLOCK_PLANE;
typedef int av1_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][COEFF_CONTEXTS]
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 3448866..189a1dd 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4600,13 +4600,6 @@
// Indicates whether or not to use a default reduced set for ext-tx
// rather than the potential full set of 16 transforms
cm->reduced_tx_set_used = 0;
-#if CONFIG_NEW_QUANT
- switch (cpi->sf.optimize_coefficients) {
- case NO_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET3; break;
- case FINAL_PASS_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET3; break;
- case FULL_TRELLIS_OPT: cm->dq_type = DQ_MULT_OFFSET1; break;
- }
-#endif // CONFIG_NEW_QUANT
if (cm->show_frame == 0) {
int arf_offset = AOMMIN(
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index eb30a9f..7bb3044 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -151,12 +151,6 @@
? pd->seg_iqmatrix[seg_id][qm_tx_size]
: cm->giqmatrix[NUM_QM_LEVELS - 1][0][qm_tx_size];
#endif // CONFIG_AOM_QM
-#if CONFIG_NEW_QUANT
- int dq = get_dq_profile(cm->dq_type, mb->qindex, ref, plane_type);
-#if !CONFIG_AOM_QM
- const dequant_val_type_nuq *dequant_val = p->dequant_val_nuq_QTX[dq];
-#endif // !CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
int64_t rd_cost0, rd_cost1;
int16_t t0, t1;
int i, final_eob = 0;
@@ -236,18 +230,7 @@
*/
int64_t d2_a;
if (x_a != 0) {
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dx = av1_dequant_coeff_nuq(x_a, dqv, dq, rc != 0, 0) -
- (coeff[rc] * (1 << shift));
-#else
- dx = av1_dequant_coeff_nuq(x_a, dqv, dequant_val[rc != 0], 0) -
- (coeff[rc] * (1 << shift));
-#endif // CONFIG_AOM_QM
- dx >>= xd->bd - 8;
-#else // CONFIG_NEW_QUANT
dx -= ((dqv >> (xd->bd - 8)) + sz) ^ sz;
-#endif // CONFIG_NEW_QUANT
d2_a = (int64_t)dx * dx;
} else {
d2_a = d0;
@@ -321,20 +304,10 @@
int dqc_a = 0;
if (best_x || best_eob_x) {
if (x_a != 0) {
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dqc_a = av1_dequant_abscoeff_nuq(abs(x_a), dqv, dq, rc != 0, shift);
-#else
- dqc_a = av1_dequant_abscoeff_nuq(abs(x_a), dqv, dequant_val[rc != 0],
- shift);
-#endif // CONFIG_AOM_QM
- if (sz) dqc_a = -dqc_a;
-#else
if (x_a < 0)
dqc_a = -((-x_a * dqv) >> shift);
else
dqc_a = (x_a * dqv) >> shift;
-#endif // CONFIG_NEW_QUANT
} else {
dqc_a = 0;
}
@@ -427,15 +400,9 @@
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 },
-#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
{ NULL, NULL }
};
@@ -450,9 +417,6 @@
TX_TYPE tx_type = av1_get_tx_type(plane_type, xd, blk_row, blk_col, tx_size,
cm->reduced_tx_set_used);
-#if CONFIG_NEW_QUANT
- const int is_inter = is_inter_block(mbmi);
-#endif
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
tran_low_t *const coeff = BLOCK_OFFSET(p->coeff, block);
@@ -481,10 +445,6 @@
&p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
qparam.log_scale = av1_get_tx_scale(tx_size);
qparam.tx_size = tx_size;
-#if CONFIG_NEW_QUANT
- qparam.dq = get_dq_profile(cm->dq_type, x->qindex, is_inter, plane_type);
- qparam.x0 = get_x0_profile(x->optimize, x->qindex, is_inter, plane_type);
-#endif // CONFIG_NEW_QUANT
#if CONFIG_AOM_QM
qparam.qmatrix = qmatrix;
qparam.iqmatrix = iqmatrix;
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 569b3d2..e76a9ac 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -145,26 +145,9 @@
}
static INLINE tran_low_t qcoeff_to_dqcoeff(tran_low_t qc, int coeff_idx,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- int dq_idx,
-#else
- const tran_low_t *nq_dq,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
int dqv, int shift,
const qm_val_t *iqmatrix) {
int sgn = qc < 0 ? -1 : 1;
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- int is_ac_coeff = coeff_idx != 0;
- int dqcoeff = av1_dequant_coeff_nuq(abs(qc), dqv, dq_idx, is_ac_coeff, shift);
-#else
- (void)coeff_idx;
- int dqcoeff = av1_dequant_coeff_nuq(abs(qc), dqv, nq_dq, shift);
-#endif // CONFIG_AOM_QM
- return sgn * dqcoeff;
-#endif // CONFIG_NEW_QUANT
if (iqmatrix != NULL)
dqv =
((iqmatrix[coeff_idx] * dqv) + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS;
@@ -295,13 +278,6 @@
const tran_low_t tqc = txb_info->tcoeff[coeff_idx];
const int dqv = txb_info->dequant[coeff_idx != 0];
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- const int dq_idx = txb_info->dq_idx;
-#else
- const tran_low_t *nq_dequant_val = txb_info->nq_dequant_vals[coeff_idx != 0];
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
const int coeff_ctx =
get_nz_map_ctx(levels, coeff_idx, txb_info->bwl, txb_info->height,
@@ -313,29 +289,13 @@
stats->rate = qc_cost;
return;
} else {
- const tran_low_t dqc =
- qcoeff_to_dqcoeff(qc, coeff_idx,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq_idx,
-#else
- nq_dequant_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- dqv, txb_info->shift, txb_info->iqmatrix);
+ const tran_low_t dqc = qcoeff_to_dqcoeff(
+ qc, coeff_idx, dqv, txb_info->shift, txb_info->iqmatrix);
const int64_t dqc_dist = get_coeff_dist(tqc, dqc, txb_info->shift);
// distortion difference when coefficient is quantized to 0
- const tran_low_t dqc0 =
- qcoeff_to_dqcoeff(0, coeff_idx,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq_idx,
-#else
- nq_dequant_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- dqv, txb_info->shift, txb_info->iqmatrix);
+ const tran_low_t dqc0 = qcoeff_to_dqcoeff(
+ 0, coeff_idx, dqv, txb_info->shift, txb_info->iqmatrix);
stats->dist0 = get_coeff_dist(tqc, dqc0, txb_info->shift);
stats->dist = dqc_dist - stats->dist0;
@@ -352,16 +312,8 @@
if (stats->low_qc == 0) {
stats->dist_low = 0;
} else {
- stats->low_dqc =
- qcoeff_to_dqcoeff(stats->low_qc, coeff_idx,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq_idx,
-#else
- nq_dequant_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- dqv, txb_info->shift, txb_info->iqmatrix);
+ stats->low_dqc = qcoeff_to_dqcoeff(stats->low_qc, coeff_idx, dqv,
+ txb_info->shift, txb_info->iqmatrix);
const int64_t low_dqc_dist =
get_coeff_dist(tqc, stats->low_dqc, txb_info->shift);
stats->dist_low = low_dqc_dist - stats->dist0;
@@ -402,23 +354,8 @@
const TxbInfo *const txb_info) {
update_qcoeff(coeff_idx, qc, txb_info);
const int dqv = txb_info->dequant[coeff_idx != 0];
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- const int dq_idx = txb_info->dq_idx;
-#else
- const tran_low_t *nq_dequant_val = txb_info->nq_dequant_vals[coeff_idx != 0];
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- txb_info->dqcoeff[coeff_idx] =
- qcoeff_to_dqcoeff(qc, coeff_idx,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq_idx,
-#else
- nq_dequant_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- dqv, txb_info->shift, txb_info->iqmatrix);
+ txb_info->dqcoeff[coeff_idx] = qcoeff_to_dqcoeff(
+ qc, coeff_idx, dqv, txb_info->shift, txb_info->iqmatrix);
}
static INLINE void av1_txb_init_levels(const tran_low_t *const coeff,
@@ -2129,12 +2066,6 @@
const int is_inter = is_inter_block(mbmi);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const LV_MAP_COEFF_COST txb_costs = x->coeff_costs[txs_ctx][plane_type];
-#if CONFIG_NEW_QUANT
- int dq = get_dq_profile(cm->dq_type, x->qindex, is_inter, plane_type);
-#if !CONFIG_AOM_QM
- const dequant_val_type_nuq *dequant_val = p->dequant_val_nuq_QTX[dq];
-#endif // !CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
const int eob_multi_size = txsize_log2_minus4[tx_size];
const LV_MAP_EOB_COST txb_eob_costs =
x->eob_costs[eob_multi_size][plane_type];
@@ -2157,31 +2088,9 @@
#endif
assert(width == (1 << bwl));
TxbInfo txb_info = {
- qcoeff,
- levels,
- dqcoeff,
- tcoeff,
- dequant,
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- dq,
-#else
- dequant_val,
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
- shift,
- tx_size,
- txs_ctx,
- tx_type,
- bwl,
- width,
- height,
- eob,
- seg_eob,
- scan_order,
- txb_ctx,
- rdmult,
- &cm->coeff_ctx_table,
+ qcoeff, levels, dqcoeff, tcoeff, dequant, shift,
+ tx_size, txs_ctx, tx_type, bwl, width, height,
+ eob, seg_eob, scan_order, txb_ctx, rdmult, &cm->coeff_ctx_table,
iqmatrix,
};
diff --git a/av1/encoder/encodetxb.h b/av1/encoder/encodetxb.h
index 059bca6..54e01b8 100644
--- a/av1/encoder/encodetxb.h
+++ b/av1/encoder/encodetxb.h
@@ -29,13 +29,6 @@
tran_low_t *dqcoeff;
const tran_low_t *tcoeff;
const int16_t *dequant;
-#if CONFIG_NEW_QUANT
-#if CONFIG_AOM_QM
- const int dq_idx;
-#else
- const dequant_val_type_nuq *nq_dequant_vals;
-#endif // CONFIG_AOM_QM
-#endif // CONFIG_NEW_QUANT
int shift;
TX_SIZE tx_size;
TX_SIZE txs_ctx;
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 5e79371..8692c3f 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -134,7 +134,6 @@
set(CONFIG_MAX_TILE 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_MFMV 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_MONO_VIDEO 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_NEW_QUANT 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_NO_FRAME_CONTEXT_SIGNALING 0 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_OBU 1 CACHE NUMBER "AV1 experiment flag.")
set(CONFIG_OBU_NO_IVF 0 CACHE NUMBER "AV1 experiment flag.")
diff --git a/test/test.cmake b/test/test.cmake
index 4182fc3..20611f8 100644
--- a/test/test.cmake
+++ b/test/test.cmake
@@ -239,12 +239,6 @@
"${AOM_ROOT}/test/sum_squares_test.cc"
"${AOM_ROOT}/test/variance_test.cc")
- if (NOT CONFIG_AOM_QM AND NOT CONFIG_NEW_QUANT)
- set(AOM_UNIT_TEST_ENCODER_SOURCES
- ${AOM_UNIT_TEST_ENCODER_SOURCES}
- "${AOM_ROOT}/test/quantize_func_test.cc")
- endif ()
-
set(AOM_UNIT_TEST_ENCODER_SOURCES
${AOM_UNIT_TEST_ENCODER_SOURCES}
"${AOM_ROOT}/test/convolve_round_test.cc")