]> granicus.if.org Git - libvpx/commitdiff
vp9: Update to noise estimation for denoising.
authorMarco <marpan@google.com>
Mon, 30 Nov 2015 16:51:25 +0000 (08:51 -0800)
committerMarco <marpan@google.com>
Mon, 30 Nov 2015 18:03:20 +0000 (10:03 -0800)
Change initial state of noise level, and only update
denoiser with noise level when estimate is done.

Change-Id: If44090d29949d3e4927e855d88241634cdb395dc

vp9/encoder/vp9_noise_estimate.c

index b41ffd0a36d0582b22ead9a102db55b7512996bb..b26f6f217b595d7f21c308cebaf8650c468f736f 100644 (file)
@@ -25,7 +25,7 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne,
                              int width,
                              int height) {
   ne->enabled = 0;
-  ne->level = kLow;
+  ne->level = kLowLow;
   ne->value = 0;
   ne->count = 0;
   ne->thresh = 90;
@@ -220,22 +220,25 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
         // Reset counter and check noise level condition.
         ne->num_frames_estimate = 30;
         ne->count = 0;
-        if (ne->value > (ne->thresh << 1))
+        if (ne->value > (ne->thresh << 1)) {
           ne->level = kHigh;
-        else
+        } else {
           if (ne->value > ne->thresh)
             ne->level = kMedium;
           else if (ne->value > (ne->thresh >> 1))
             ne->level = kLow;
           else
             ne->level = kLowLow;
+        }
+#if CONFIG_VP9_TEMPORAL_DENOISING
+        if (cpi->oxcf.noise_sensitivity > 0)
+          vp9_denoiser_set_noise_level(&cpi->denoiser, ne->level);
+#endif
       }
     }
   }
 #if CONFIG_VP9_TEMPORAL_DENOISING
-  if (cpi->oxcf.noise_sensitivity > 0) {
+  if (cpi->oxcf.noise_sensitivity > 0)
     copy_frame(&cpi->denoiser.last_source, cpi->Source);
-    vp9_denoiser_set_noise_level(&cpi->denoiser, ne->level);
-  }
 #endif
 }