Don't dering superblocks that have deringing disabled

Doesn't change the output, but avoids useless deringing with threshold=0

Change-Id: I69f3e54abad2d2493cfbc76c188ad7d190f0aeff
diff --git a/av1/common/dering.c b/av1/common/dering.c
index b0cdfbf..c21d4e5 100644
--- a/av1/common/dering.c
+++ b/av1/common/dering.c
@@ -98,19 +98,22 @@
       int nhb, nvb;
       nhb = AOMMIN(MAX_MIB_SIZE, cm->mi_cols - MAX_MIB_SIZE * sbc);
       nvb = AOMMIN(MAX_MIB_SIZE, cm->mi_rows - MAX_MIB_SIZE * sbr);
+      level = compute_level_from_index(
+          global_level, cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
+                                            MAX_MIB_SIZE * sbc]
+                            ->mbmi.dering_gain);
+      if (level == 0 || sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE))
+        continue;
       for (pli = 0; pli < 3; pli++) {
         int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8];
         int threshold;
-        level = compute_level_from_index(
-            global_level,
-            cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
-                                MAX_MIB_SIZE * sbc]
-                ->mbmi.dering_gain);
         /* FIXME: This is a temporary hack that uses more conservative
            deringing for chroma. */
-        if (pli) level = (level * 5 + 4) >> 3;
-        if (sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE)) continue;
-        threshold = level << coeff_shift;
+        if (pli)
+          threshold = (level * 5 + 4) >> 3 << coeff_shift;
+        else
+          threshold = level << coeff_shift;
+        if (threshold == 0) continue;
         od_dering(dst, MAX_MIB_SIZE * bsize[pli],
                   &src[pli][sbr * stride * bsize[pli] * MAX_MIB_SIZE +
                             sbc * bsize[pli] * MAX_MIB_SIZE],