shithub: libvpx

Download patch

ref: e20be1b2340dd3115cd445eafd9c1c717b621298
parent: fa0076282e62f649483bde868602aab86448a661
parent: 50a90744407be7b88c47737d1bba79e7ffb5c2d3
author: Jingning Han <jingning@google.com>
date: Tue Oct 30 00:44:09 EDT 2018

Merge "Properly space qp in q mode for multi-layer ARF"

--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1303,8 +1303,14 @@
 
         // Modify best quality for second level arfs. For mode VPX_Q this
         // becomes the baseline frame q.
-        if (gf_group->rf_level[gf_group_index] == GF_ARF_LOW)
-          active_best_quality = (active_best_quality + cq_level + 1) / 2;
+        if (gf_group->rf_level[gf_group_index] == GF_ARF_LOW) {
+          const int layer_depth = gf_group->layer_depth[gf_group_index];
+          // linearly fit the frame q depending on the layer depth index from
+          // the base layer ARF.
+          active_best_quality = ((layer_depth - 1) * cq_level +
+                                 active_best_quality + layer_depth / 2) /
+                                layer_depth;
+        }
       }
     } else {
       active_best_quality = get_gf_active_quality(cpi, q, cm->bit_depth);