Do NOT reduce length of last GF group for q > 128.

Before:
Reducing the GF length was creating pulsing because:
- The last inter frame (before a key frame) used a very low quality
(similar quality as leaf level frames), and
- The next keyframe used a much better quality

This was due to the fact that the last inter frame was NOT an ALT-REF
frame, but in a GF group by itself (along with an overlay frame).

After this patch:
The last inter frame is an ALT-REF frame, so it is at a quality
closer to the subsequent keyframe.
This has a BDRate loss of 0.2%, but the pulsing is resolved.

Note: This change applies to q > 128 only, to get a good compromise
between:
- Reducing pulsing at practical quality settings, and
- Keeping the BDRate loss minimal.

STATS_CHANGED

BUG=aomedia:2308

Change-Id: I82ea59e79fa55d2f58f6ddb710d05a88277280ee
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index 5878803..b64ef30 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -944,11 +944,11 @@
 #define REDUCE_GF_LENGTH_TO_KEY_THRESH 9
 #define REDUCE_GF_LENGTH_BY 1
   int alt_offset = 0;
-  // The length reduction strategy is tweaked using AOM_Q mode, and doesn't work
-  // for VBR mode.
-  // Also, we don't have do adjustment for lossless mode.
+  // The length reduction strategy is tweaked for certain cases, and doesn't
+  // work well for certain other cases.
   const int allow_gf_length_reduction =
-      (cpi->oxcf.rc_mode == AOM_Q || cpi->extra_arf_allowed == 0) &&
+      ((cpi->oxcf.rc_mode == AOM_Q && cpi->oxcf.cq_level <= 128) ||
+       cpi->extra_arf_allowed == 0) &&
       !is_lossless_requested(&cpi->oxcf);
 
   if (allow_gf_length_reduction && use_alt_ref) {