shithub: libvpx

Download patch

ref: 03abd2c8f358549a445dce452e26aa72d3853e55
parent: 1bb29e24553bc03c8cb2b3bb11daff8c109cc462
author: Marco Paniconi <marpan@google.com>
date: Mon Jul 2 08:55:29 EDT 2018

vp9: Adjust segment weight for cyclic refresh.

For screen-content: use the previous actual number of seg
blocks for the segment weight, used in the rate control
for setting frame-level Q.

Small overall increase in psnr on several screen-content clips.

Change-Id: Id414fb7f1b0ba578d464437d7f9c1783a0cad310

--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -503,6 +503,14 @@
                    num8x8bl;
   if (weight_segment_target < 7 * weight_segment / 8)
     weight_segment = weight_segment_target;
+  // For screen-content: don't include target for the weight segment, since
+  // all for all flat areas the segment is reset, so its more accurate to
+  // just use the previous actual number of seg blocks for the weight.
+  if (cpi->oxcf.content == VP9E_CONTENT_SCREEN)
+    weight_segment =
+        (double)((cr->actual_num_seg1_blocks + cr->actual_num_seg2_blocks) >>
+                 1) /
+        num8x8bl;
   cr->weight_segment = weight_segment;
 }