Remove NEW_QUANT experiment

This experiment has been abandonned for AV1.

Change-Id: I924d172f7ce85b2422bace44684329fcbf71cb5e
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;