Merge "vp9-rtc: Fix to rate cost for switchable filter"
diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c
index 2ed192a..9696529 100644
--- 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;
diff --git a/vp9/encoder/vp9_noise_estimate.h b/vp9/encoder/vp9_noise_estimate.h
index e30ad31..7fc94ff 100644
--- 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;