Resolve some compile warnings

Change-Id: I03bd4d2ca21e2851d5d79b6d7af8e2421f4d827e
(cherry picked from commit 8576d524f5bd80ae7ac3ad8aa2da18cf3b7955fe)
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index 993dc66..4844182 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -79,7 +79,11 @@
     return NULL;
   }
   last_coded_q_map_size = mi_rows * mi_cols * sizeof(*cr->last_coded_q_map);
-  cr->last_coded_q_map = aom_malloc(last_coded_q_map_size);
+#if CONFIG_EXTQUANT
+  cr->last_coded_q_map = (uint16_t *)aom_malloc(last_coded_q_map_size);
+#else
+  cr->last_coded_q_map = (uint8_t *)aom_malloc(last_coded_q_map_size);
+#endif  // CONFIG_EXTQUANT
   if (cr->last_coded_q_map == NULL) {
     av1_cyclic_refresh_free(cr);
     return NULL;
@@ -90,11 +94,10 @@
              : bit_depth == AOM_BITS_10
                    ? (MAXQ_10_BITS <= (QINDEX_RANGE_10_BITS - 1))
                    : (MAXQ <= (QINDEX_RANGE - 1)));
-  memset(cr->last_coded_q_map,
-         bit_depth == AOM_BITS_8
-             ? MAXQ_8_BITS
-             : bit_depth == AOM_BITS_10 ? MAXQ_10_BITS : MAXQ,
-         last_coded_q_map_size);
+  const uint16_t qinit = bit_depth == AOM_BITS_8
+                             ? MAXQ_8_BITS
+                             : bit_depth == AOM_BITS_10 ? MAXQ_10_BITS : MAXQ;
+  for (int i = 0; i < mi_rows * mi_cols; ++i) cr->last_coded_q_map[i] = qinit;
 #else
   assert(MAXQ <= 255);
   memset(cr->last_coded_q_map, MAXQ, last_coded_q_map_size);
diff --git a/test/av1_quantize_test.cc b/test/av1_quantize_test.cc
index 96e3e73..c679383 100644
--- a/test/av1_quantize_test.cc
+++ b/test/av1_quantize_test.cc
@@ -19,15 +19,25 @@
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
 #include "av1/common/scan.h"
+#include "av1/encoder/av1_quantize.h"
 
 namespace {
 
+#if CONFIG_EXTQUANT
+typedef void (*QuantizeFpFunc)(
+    const tran_low_t *coeff_ptr, intptr_t count, const int32_t *zbin_ptr,
+    const int32_t *round_ptr, const int32_t *quant_ptr,
+    const int32_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
+    tran_low_t *dqcoeff_ptr, const int32_t *dequant_ptr, uint16_t *eob_ptr,
+    const int16_t *scan, const int16_t *iscan, int log_scale);
+#else
 typedef void (*QuantizeFpFunc)(
     const tran_low_t *coeff_ptr, intptr_t count, 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, int log_scale);
+#endif  // CONFIG_EXTQUANT
 
 struct QuantizeFuncParams {
   QuantizeFuncParams(QuantizeFpFunc qF = NULL, QuantizeFpFunc qRefF = NULL,
@@ -42,14 +52,31 @@
 
 const int numTests = 1000;
 const int maxSize = 1024;
+#if CONFIG_EXTQUANT
+const int roundFactorRange = 64;
+const int dequantRange = 1048576;
+#else
 const int roundFactorRange = 127;
 const int dequantRange = 32768;
+#endif
 const int coeffRange = (1 << 20) - 1;
 
 class AV1QuantizeTest : public ::testing::TestWithParam<QuantizeFuncParams> {
  public:
   void RunQuantizeTest() {
     ACMRandom rnd(ACMRandom::DeterministicSeed());
+#if CONFIG_EXTQUANT
+    DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, int32_t, zbin_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, round_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, quant_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, quant_shift_ptr[8]);
+    DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, int32_t, dequant_ptr[8]);
+#else
     DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
     DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
@@ -60,6 +87,7 @@
     DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
+#endif  // CONFIG_EXTQUANT
     uint16_t eob;
     uint16_t ref_eob;
     int err_count_total = 0;
@@ -79,12 +107,23 @@
       }
 
       for (int j = 0; j < 2; j++) {
+#if CONFIG_EXTQUANT
+        zbin_ptr[j] = rnd.Rand31();
+        quant_shift_ptr[j] = rnd.Rand31();
+        // int32_t positive
+        dequant_ptr[j] = abs(rnd(dequantRange));
+        quant_ptr[j] = static_cast<int32_t>(
+            (1 << (16 + QUANT_FP_BITS + QUANT_TABLE_BITS)) / dequant_ptr[j]);
+        round_ptr[j] = (abs(rnd(roundFactorRange)) * dequant_ptr[j]) >>
+                       (7 + QUANT_TABLE_BITS);
+#else
         zbin_ptr[j] = rnd.Rand16();
         quant_shift_ptr[j] = rnd.Rand16();
         // int16_t positive
         dequant_ptr[j] = abs(rnd(dequantRange));
         quant_ptr[j] = (1 << 16) / dequant_ptr[j];
         round_ptr[j] = (abs(rnd(roundFactorRange)) * dequant_ptr[j]) >> 7;
+#endif  // CONFIG_EXTQUANT
       }
       for (int j = 2; j < 8; ++j) {
         zbin_ptr[j] = zbin_ptr[1];
@@ -125,6 +164,18 @@
 
   void RunEobTest() {
     ACMRandom rnd(ACMRandom::DeterministicSeed());
+#if CONFIG_EXTQUANT
+    DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, int32_t, zbin_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, round_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, quant_ptr[8]);
+    DECLARE_ALIGNED(16, int32_t, quant_shift_ptr[8]);
+    DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[maxSize]);
+    DECLARE_ALIGNED(16, int32_t, dequant_ptr[8]);
+#else
     DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
     DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
@@ -135,6 +186,7 @@
     DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[maxSize]);
     DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
+#endif  // CONFIG_EXTQUANT
     uint16_t eob;
     uint16_t ref_eob;
     int count = params_.coeffCount;
@@ -155,12 +207,23 @@
       coeff_ptr[rnd(count)] = rnd(coeffRange);
 
       for (int j = 0; j < 2; j++) {
+#if CONFIG_EXTQUANT
+        zbin_ptr[j] = rnd.Rand31();
+        quant_shift_ptr[j] = rnd.Rand31();
+        // int32_t positive
+        dequant_ptr[j] = abs(rnd(dequantRange));
+        quant_ptr[j] =
+            ((1 << (16 + QUANT_FP_BITS + QUANT_TABLE_BITS)) / dequant_ptr[j]);
+        round_ptr[j] = (abs(rnd(roundFactorRange)) * dequant_ptr[j]) >>
+                       (7 + QUANT_TABLE_BITS);
+#else
         zbin_ptr[j] = rnd.Rand16();
         quant_shift_ptr[j] = rnd.Rand16();
         // int16_t positive
         dequant_ptr[j] = abs(rnd(dequantRange));
         quant_ptr[j] = (1 << 16) / dequant_ptr[j];
         round_ptr[j] = (abs(rnd(roundFactorRange)) * dequant_ptr[j]) >> 7;
+#endif  // CONFIG_EXTQUANT
       }
       for (int j = 2; j < 8; ++j) {
         zbin_ptr[j] = zbin_ptr[1];
@@ -206,8 +269,9 @@
 TEST_P(AV1QuantizeTest, BitExactCheck) { RunQuantizeTest(); }
 TEST_P(AV1QuantizeTest, EobVerify) { RunEobTest(); }
 
-#if HAVE_SSE4_1 && !CONFIG_EXTQUANT
-const QuantizeFuncParams qfps[4] = {
+#if HAVE_SSE4_1
+const QuantizeFuncParams qfps[] = {
+#if !CONFIG_EXTQUANT
   QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
                      16),
   QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
@@ -216,13 +280,17 @@
                      256),
   QuantizeFuncParams(&av1_highbd_quantize_fp_sse4_1, &av1_highbd_quantize_fp_c,
                      1024),
+#else
+  QuantizeFuncParams(&av1_highbd_quantize_fp_c, &av1_highbd_quantize_fp_c, 16)
+#endif  // !CONFIG_EXTQUANT
 };
 
 INSTANTIATE_TEST_SUITE_P(SSE4_1, AV1QuantizeTest, ::testing::ValuesIn(qfps));
 #endif  // HAVE_SSE4_1
 
-#if HAVE_AVX2 && !CONFIG_EXTQUANT
-const QuantizeFuncParams qfps_avx2[4] = {
+#if HAVE_AVX2
+const QuantizeFuncParams qfps_avx2[] = {
+#if !CONFIG_EXTQUANT
   QuantizeFuncParams(&av1_highbd_quantize_fp_avx2, &av1_highbd_quantize_fp_c,
                      16),
   QuantizeFuncParams(&av1_highbd_quantize_fp_avx2, &av1_highbd_quantize_fp_c,
@@ -231,6 +299,9 @@
                      256),
   QuantizeFuncParams(&av1_highbd_quantize_fp_avx2, &av1_highbd_quantize_fp_c,
                      1024),
+#else
+  QuantizeFuncParams(&av1_highbd_quantize_fp_c, &av1_highbd_quantize_fp_c, 16),
+#endif  // !CONFIG_EXTQUANT
 };
 
 INSTANTIATE_TEST_SUITE_P(AVX2, AV1QuantizeTest, ::testing::ValuesIn(qfps_avx2));
diff --git a/test/quantize_func_test.cc b/test/quantize_func_test.cc
index d41b52a..686bab5 100644
--- a/test/quantize_func_test.cc
+++ b/test/quantize_func_test.cc
@@ -358,8 +358,9 @@
 
 using std::make_tuple;
 
-#if HAVE_AVX2 && !CONFIG_EXTQUANT
+#if HAVE_AVX2
 const QuantizeParam kQParamArrayAvx2[] = {
+#if !CONFIG_EXTQUANT
   make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
              static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
   make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_avx2,
@@ -435,14 +436,20 @@
   make_tuple(&aom_highbd_quantize_b_32x32_adaptive_c,
              &aom_highbd_quantize_b_32x32_adaptive_avx2,
              static_cast<TX_SIZE>(TX_32X32), TYPE_B, AOM_BITS_12)
+#else
+  // dummy to avoid compiler warning
+  make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_c,
+             static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
+#endif  // !CONFIG_EXTQUANT
 };
 
 INSTANTIATE_TEST_SUITE_P(AVX2, QuantizeTest,
                          ::testing::ValuesIn(kQParamArrayAvx2));
 #endif  // HAVE_AVX2
 
-#if HAVE_SSE2 && !CONFIG_EXTQUANT
+#if HAVE_SSE2
 const QuantizeParam kQParamArraySSE2[] = {
+#if !CONFIG_EXTQUANT
   make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
              static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
   make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_sse2,
@@ -524,11 +531,15 @@
   make_tuple(&aom_quantize_b_64x64_adaptive_c,
              &aom_quantize_b_64x64_adaptive_sse2,
              static_cast<TX_SIZE>(TX_64X64), TYPE_B, AOM_BITS_8)
+#else
+  make_tuple(&av1_quantize_fp_c, &av1_quantize_fp_c,
+             static_cast<TX_SIZE>(TX_16X16), TYPE_FP, AOM_BITS_8),
+#endif
 };
 
 INSTANTIATE_TEST_SUITE_P(SSE2, QuantizeTest,
                          ::testing::ValuesIn(kQParamArraySSE2));
-#endif
+#endif  // HAVE_SSE2
 
 #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_EXTQUANT
 INSTANTIATE_TEST_SUITE_P(