Adjustments to superes qthresh mode

Obtain the superres parameters directly for the q being used.
Also the kf qthresh default is made a low 32 by default since
the analysis already does a decent job deciding whether to use
superres and by how much.

This effectively reduces the dependence on the qthresh parameter
and may eventually be removed.

Change-Id: Ie1d5204bc029615222d612f3a671bf12fc767f57
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 43a6028..ab5f26a 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -1866,7 +1866,7 @@
         SCALE_NUMERATOR,  // rc_superres_denominator
         SCALE_NUMERATOR,  // rc_superres_kf_denominator
         63,               // rc_superres_qthresh
-        63,               // rc_superres_kf_qthresh
+        32,               // rc_superres_kf_qthresh
 
         AOM_VBR,      // rc_end_usage
         { NULL, 0 },  // rc_twopass_stats_in
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 7652029..d15ea10 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -4161,7 +4161,7 @@
   return new_denom;
 }
 
-#define ENERGY_BY_Q2_THRESH 0.015
+#define ENERGY_BY_Q2_THRESH 0.01
 
 static uint8_t get_superres_denom_from_qindex_energy(int qindex, double *energy,
                                                      double thresh) {
@@ -4219,22 +4219,7 @@
       if (q < qthresh) {
         new_denom = SCALE_NUMERATOR;
       } else {
-        // TODO(debargha): Experiment with the variant below.
-        // new_denom = get_superres_denom_for_qindex(cpi, q);
-        uint8_t max_denom = get_superres_denom_for_qindex(cpi, MAXQ);
-        if (max_denom == SCALE_NUMERATOR) {
-          new_denom = max_denom;
-          break;
-        } else {
-          const uint8_t q_denom_step =
-              max_denom - SCALE_NUMERATOR == 0
-                  ? 255
-                  : (MAXQ - qthresh + 1 + max_denom - SCALE_NUMERATOR - 1) /
-                        (max_denom - SCALE_NUMERATOR);
-          const uint8_t additional_denom =
-              (q - qthresh + 1 + q_denom_step - 1) / q_denom_step;
-          new_denom = AOMMIN(SCALE_NUMERATOR + additional_denom, max_denom);
-        }
+        new_denom = get_superres_denom_for_qindex(cpi, q);
       }
       break;
     }