Allow low-delay sub-GOP config + fixed QP offsets.

get_q_using_fixed_offsets() now respects pyramid level that maybe
specified in the user-given subGOP config, even for visible frames
that implicitly have update type = LF_UPDATE.

This allows low-delay configuration to also have pyramid-like levels
with per-level fixed QP offsets, when using --use-fixed-qp-offsets.

Change-Id: I2b671635e9746e0f8311a603df3cb15033e9e66e
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 561f889..b98bfc5 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -1024,8 +1024,14 @@
   } else if (update_type == INTNL_ARF_UPDATE) {
     offset_idx =
         AOMMIN(gf_group->layer_depth[gf_index], FIXED_QP_OFFSET_COUNT - 1);
-  } else {  // Leaf level / overlay frame.
-    assert(update_type == LF_UPDATE || update_type == OVERLAY_UPDATE ||
+  } else if (update_type == LF_UPDATE) {
+    if (gf_group->layer_depth[gf_index] >= FIXED_QP_OFFSET_COUNT) {  // Leaf.
+      return qp;  // Directly Return worst quality allowed.
+    }
+    offset_idx =
+        AOMMIN(gf_group->layer_depth[gf_index], FIXED_QP_OFFSET_COUNT - 1);
+  } else {  // Overlay frame.
+    assert(update_type == OVERLAY_UPDATE ||
            update_type == INTNL_OVERLAY_UPDATE);
     return qp;  // Directly Return worst quality allowed.
   }