shithub: libvpx

Download patch

ref: c4305ba57d050dd5c7c229fa38bf2f9325a772d1
parent: 5cbd333f3b491f6ecb41387acf72e8ec27d8a474
author: Yunqing Wang <yunqingwang@google.com>
date: Fri Dec 21 09:46:52 EST 2018

Adjustment to noise factor in first pass.

Adjustments to the calculation and use of a noise estimate in
the first pass Q estimate and adaptation of temporal filtering.

This change was tested and gave gains for both auto-alt-ref=1
and auto-alt-ref=6 as follows:

Results are Av PSNR, Overall PSNR, SSIM  and PSNR-HVS

auto-alt-ref=1
low_res 0.007, -0.042, -0.018, 0.074
mid_res -0.142, -0.239, -0.173, -0.129
hd_res -0.322, -0.405, -0.397, -0.367
NF_2K -0.058, -0.099, -0.201, 0.028

auto-alt-ref=6
low_res  -0.058, -0.171, -0.188, -0.027
mide_res -0.149, -0.155, -0.171, -0.137
hd_res -0.252, -0.339, -0.259, -0.297
NF_2K -0.015, -0.068, -0.120, 0.092

In all sets there were some winners and losers but significantly
more winners. The biggest change was Stockholm in the
hd set with an improvement of 5-6%

Change-Id: Ieec71e1c4e3e09b76c288efa7b4d1b00015b3a11

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -549,7 +549,7 @@
 }
 
 #define FP_DN_THRESH 8
-#define FP_MAX_DN_THRESH 16
+#define FP_MAX_DN_THRESH 24
 #define KERNEL_SIZE 3
 
 // Baseline Kernal weights for first pass noise metric
@@ -843,6 +843,7 @@
   double mb_intra_factor;
   double mb_brightness_factor;
   double mb_neutral_count;
+  int scaled_low_intra_thresh = scale_sse_threshold(cm, LOW_I_THRESH);
 
   // First pass code requires valid last and new frame buffers.
   assert(new_yv12 != NULL);
@@ -1254,7 +1255,6 @@
             }
           }
 #endif
-
           // Does the row vector point inwards or outwards?
           if (mb_row < cm->mb_rows / 2) {
             if (mv.row > 0)
@@ -1280,14 +1280,13 @@
             else if (mv.col < 0)
               --(fp_acc_data->sum_in_vectors);
           }
-          fp_acc_data->frame_noise_energy += (int64_t)SECTION_NOISE_DEF;
-        } else if (this_intra_error < scale_sse_threshold(cm, LOW_I_THRESH)) {
+        }
+        if (this_intra_error < scaled_low_intra_thresh) {
           fp_acc_data->frame_noise_energy += fp_estimate_block_noise(x, bsize);
-        } else {  // 0,0 mv but high error
+        } else {
           fp_acc_data->frame_noise_energy += (int64_t)SECTION_NOISE_DEF;
         }
       } else {  // Intra < inter error
-        int scaled_low_intra_thresh = scale_sse_threshold(cm, LOW_I_THRESH);
         if (this_intra_error < scaled_low_intra_thresh) {
           fp_acc_data->frame_noise_energy += fp_estimate_block_noise(x, bsize);
           if (this_motion_error < scaled_low_intra_thresh) {
@@ -2399,8 +2398,12 @@
 
   twopass->arnr_strength_adjustment = 0;
 
-  if ((section_zeromv < 0.10) || (section_noise <= (SECTION_NOISE_DEF * 0.75)))
+  if (section_noise < 150) {
     twopass->arnr_strength_adjustment -= 1;
+    if (section_noise < 75) twopass->arnr_strength_adjustment -= 1;
+  } else if (section_noise > 250)
+    twopass->arnr_strength_adjustment += 1;
+
   if (section_zeromv > 0.50) twopass->arnr_strength_adjustment += 1;
 }