[tcq] Set qindex incr at 2 for 8b and 4 for 10b;  STATS_CHANGED

Factor out tuning of qindex into a separate function, so that it's more flexible (e.g., different decisions per bit depth or qindex range).
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index bf5433a..b66904c 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -24,13 +24,15 @@
 #endif
 
 #if CONFIG_DQ
-#define TCQ_HDR_FLAG 1  // Enable through header flag(s)
-#define DQENABLE 0      // Determine whether to enable based on tx_size
-#define NEWQINDEX 1     // QP shift
-#define QINDEX_INCR 2   // tunable QP index increment
-#define NEWHR 1         // 1:parity is determined by (base + LR)
-#define TCQ_DIS_CHR 1   // 1:disable TCQ for chroma blocks
-#define TCQ_DIS_1D 1    // [WIP] 1:disable TCQ for 1D scan blocks
+#define TCQ_HDR_FLAG 1         // Enable through header flag(s)
+#define DQENABLE 0             // Determine whether to enable based on tx_size
+#define NEWQINDEX 1            // QP shift
+#define QINDEX_INCR 2          // tunable QP index increment
+#define QINDEX_INCR_8_BITS 2   // tunable QP index increment
+#define QINDEX_INCR_10_BITS 4  // tunable QP index increment
+#define NEWHR 1                // 1:parity is determined by (base + LR)
+#define TCQ_DIS_CHR 1          // 1:disable TCQ for chroma blocks
+#define TCQ_DIS_1D 1           // [WIP] 1:disable TCQ for 1D scan blocks
 #else
 #define TCQ_HDR_FLAG 0
 #define DQENABLE 0   // Determine whether to use DQ by dq_enable()
@@ -114,13 +116,25 @@
 int32_t av1_ac_quant_QTX(int qindex, int delta, aom_bit_depth_t bit_depth);
 
 #if CONFIG_DQ
+static INLINE int get_new_qindex(int qindex, aom_bit_depth_t bit_depth) {
+  switch (bit_depth) {
+    case AOM_BITS_8: return clamp(qindex + QINDEX_INCR_8_BITS, 1, MAXQ_8_BITS);
+    case AOM_BITS_10:
+      return clamp(qindex + QINDEX_INCR_10_BITS, 1, MAXQ_10_BITS);
+    case AOM_BITS_12: return clamp(qindex + QINDEX_INCR, 1, MAXQ);
+    default:
+      assert(0 && "bit_depth should be AOM_BITS_8, AOM_BITS_10 or AOM_BITS_12");
+      return qindex;  // fall back to no change on qindex
+  }
+}
+
 static INLINE int32_t av1_dc_quant_QTX_tcq(int qindex, int delta,
                                            int base_dc_delta_q,
                                            aom_bit_depth_t bit_depth,
                                            int use_tcq_offset) {
   if (use_tcq_offset && qindex != 0) {
 #if NEWQINDEX
-    qindex += QINDEX_INCR;
+    qindex = get_new_qindex(qindex, bit_depth);
 #endif
   }
   return av1_dc_quant_QTX(qindex, delta, base_dc_delta_q, bit_depth);
@@ -131,7 +145,7 @@
                                            int use_tcq_offset) {
   if (use_tcq_offset && qindex != 0) {
 #if NEWQINDEX
-    qindex += QINDEX_INCR;
+    qindex = get_new_qindex(qindex, bit_depth);
 #endif
   }
   return av1_ac_quant_QTX(qindex, delta, bit_depth);