]> granicus.if.org Git - libvpx/commitdiff
For keyframe-only coding do not boost in q mode
authorUrvang Joshi <urvang@google.com>
Wed, 17 Oct 2018 18:48:10 +0000 (11:48 -0700)
committerUrvang Joshi <urvang@google.com>
Wed, 17 Oct 2018 18:48:10 +0000 (11:48 -0700)
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

vp9/encoder/vp9_ratectrl.c

index 76e310ac2744aa2f6da9a80d652ef339f9a88556..8d1d265f6ba4de6081b7d4557225847957653ce4 100644 (file)
@@ -1216,10 +1216,16 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, int *bottom_index,
   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;