AOM_QM: enable by default

No change to metrics, as quantization matrices are not used
unless --enable-qm=1 is set on the command line.

Fix no highbitdepth compilation, and fix compile errors and
warnings for PVQ and NEW_QUANT experiments.

Change-Id: I49aceb5acf6ca6790c81e760e5b208788f87086d
diff --git a/aom_dsp/quantize.h b/aom_dsp/quantize.h
index e4bbfb9..03609e8 100644
--- a/aom_dsp/quantize.h
+++ b/aom_dsp/quantize.h
@@ -36,6 +36,14 @@
                       uint16_t *eob_ptr, const int16_t *scan,
                       const int16_t *iscan);
 
+void highbd_quantize_b_helper_c(
+    const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
+    const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr,
+    const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
+    tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
+    const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
+    const qm_val_t *iqm_ptr, const int log_scale);
+
 #if CONFIG_HIGHBITDEPTH
 void aom_highbd_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
                              int skip_block, const int16_t *zbin_ptr,
@@ -44,14 +52,6 @@
                              tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
                              const int16_t *dequant_ptr, uint16_t *eob_ptr,
                              const int16_t *scan, const int16_t *iscan);
-
-void highbd_quantize_b_helper_c(
-    const tran_low_t *coeff_ptr, intptr_t n_coeffs, int skip_block,
-    const int16_t *zbin_ptr, const int16_t *round_ptr, const int16_t *quant_ptr,
-    const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
-    tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
-    const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
-    const qm_val_t *iqm_ptr, const int log_scale);
 #endif
 
 void aom_quantize_dc(const tran_low_t *coeff_ptr, int n_coeffs, int skip_block,
diff --git a/av1/decoder/detokenize.c b/av1/decoder/detokenize.c
index 052ba73..0e95341 100644
--- a/av1/decoder/detokenize.c
+++ b/av1/decoder/detokenize.c
@@ -104,16 +104,17 @@
                         TX_SIZE tx_size, TX_TYPE tx_type, const int16_t *dq,
 #if CONFIG_NEW_QUANT
                         dequant_val_type_nuq *dq_val,
-#endif  // CONFIG_NEW_QUANT
+#else
 #if CONFIG_AOM_QM
                         const qm_val_t *iqm[2][TX_SIZES_ALL],
 #endif  // CONFIG_AOM_QM
+#endif  // CONFIG_NEW_QUANT
                         int ctx, const int16_t *scan, const int16_t *nb,
                         int16_t *max_scan_line, aom_reader *r) {
   FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
   const int max_eob = tx_size_2d[tx_size];
   const int ref = is_inter_block(&xd->mi[0]->mbmi);
-#if CONFIG_AOM_QM
+#if CONFIG_AOM_QM && !CONFIG_NEW_QUANT
   const qm_val_t *iqmatrix = iqm[!ref][tx_size];
 #else
   (void)tx_type;
@@ -300,10 +301,11 @@
       decode_coefs(xd, pd->plane_type, pd->dqcoeff, tx_size, tx_type, dequant,
 #if CONFIG_NEW_QUANT
                    pd->seg_dequant_nuq[seg_id][dq],
-#endif  // CONFIG_NEW_QUANT
+#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);
 #if CONFIG_ADAPT_SCAN
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index d73d994..c5f1c5c 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -483,7 +483,7 @@
   TX_TYPE tx_type =
       av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
 
-#if CONFIG_AOM_QM || CONFIG_NEW_QUANT
+#if (CONFIG_AOM_QM || CONFIG_NEW_QUANT) && !CONFIG_PVQ
   const int is_inter = is_inter_block(mbmi);
 #endif
 
@@ -493,7 +493,7 @@
   tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   uint16_t *const eob = &p->eobs[block];
   const int diff_stride = block_size_wide[plane_bsize];
-#if CONFIG_AOM_QM
+#if CONFIG_AOM_QM && !CONFIG_PVQ
   int seg_id = mbmi->segment_id;
   // Use a flat matrix (i.e. no weighting) for 1D and Identity transforms
   const qm_val_t *qmatrix =
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index c11e51d..3909cf4 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -110,7 +110,7 @@
 set(CONFIG_ALTREF2 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_ALT_INTRA 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_ANS 0 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_AOM_QM 0 CACHE NUMBER "AV1 experiment flag.")
+set(CONFIG_AOM_QM 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_BGSPRITE 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CB4X4 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CDEF 1 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index 1e98a56..be4c401 100755
--- a/configure
+++ b/configure
@@ -521,6 +521,7 @@
     soft_enable parallel_deblocking
     soft_enable rect_intra_pred
     soft_enable convolve_round
+    soft_enable aom_qm
 
     # Backwards/jenkins compatibility with --enable-aom-highbitdepth
     enabled aom_highbitdepth && enable_feature highbitdepth