shithub: libvpx

Download patch

ref: 8bb92e382de7d527f1f788cb0618aec485ffcee8
parent: 6b7848d4c9016efbfbc9529df008ffde0e15b7cc
author: Urvang Joshi <urvang@google.com>
date: Wed Oct 17 07:48:10 EDT 2018

For keyframe-only coding do not boost in q mode

If we are using keyframe only coding - either coding a
single frame, or a sequence of keyframes - in the end-usage=q
mode, use the cq_level directly as the quality of each
coded frame, rather than boost them.

Ported from AV1: 563a0d1eb92bdc1e987df071a568d8406c4ffa92

Change-Id: I6dc929b8b4f0aa18e279139077f3a87958c92245

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1216,10 +1216,16 @@
   ASSIGN_MINQ_TABLE(cm->bit_depth, inter_minq);
 
   if (frame_is_intra_only(cm)) {
-    // Handle the special case for key frames forced when we have reached
-    // the maximum key frame interval. Here force the Q to a range
-    // based on the ambient Q to reduce the risk of popping.
-    if (rc->this_key_frame_forced) {
+    if (rc->frames_to_key == 1 && oxcf->rc_mode == VPX_Q) {
+      // If the next frame is also a key frame or the current frame is the
+      // only frame in the sequence in AOM_Q mode, just use the cq_level
+      // as q.
+      active_best_quality = cq_level;
+      active_worst_quality = cq_level;
+    } else if (rc->this_key_frame_forced) {
+      // Handle the special case for key frames forced when we have reached
+      // the maximum key frame interval. Here force the Q to a range
+      // based on the ambient Q to reduce the risk of popping.
       double last_boosted_q;
       int delta_qindex;
       int qindex;