shithub: libvpx

Download patch

ref: 32d633ba17aa5ceb8cb12fa2c665747239b3593a
parent: b2f29a9a716b119c2297befeb2e119202a259c41
author: “Michael <[email protected]>
date: Tue Apr 9 12:28:06 EDT 2019

Add fast-adapt mechanism for VNR

Change-Id: Ia1d9cde418cc981ee08dc94a2e375d6cb4542250

--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -46,6 +46,7 @@
     ne->thresh = 115;
   }
   ne->num_frames_estimate = 15;
+  ne->adapt_thresh = (3 * ne->thresh) >> 1;
 }
 
 static int enable_noise_estimation(VP9_COMP *const cpi) {
@@ -277,7 +278,12 @@
 
     // Scale by 40 to work with existing thresholds
     ne->value = (int)((3 * ne->value + max_bin * 40) >> 2);
-    ne->count++;
+    // Quickly increase VNR strength when the noise level increases suddenly.
+    if (ne->level < kMedium && ne->value > ne->adapt_thresh) {
+      ne->count = ne->num_frames_estimate;
+    } else {
+      ne->count++;
+    }
     if (ne->count == ne->num_frames_estimate) {
       // Reset counter and check noise level condition.
       ne->num_frames_estimate = 30;
--- a/vp9/encoder/vp9_noise_estimate.h
+++ b/vp9/encoder/vp9_noise_estimate.h
@@ -32,6 +32,7 @@
   NOISE_LEVEL level;
   int value;
   int thresh;
+  int adapt_thresh;
   int count;
   int last_w;
   int last_h;