]> granicus.if.org Git - libvpx/commitdiff
Reduce sampling time for noise estimate.
authorMarco <marpan@google.com>
Fri, 13 Nov 2015 16:09:17 +0000 (08:09 -0800)
committerMarco <marpan@google.com>
Fri, 13 Nov 2015 16:11:30 +0000 (08:11 -0800)
Change-Id: I46abd85e2187b8f4c2846416a23fab26d9b9f67d

vp9/encoder/vp9_noise_estimate.c
vp9/encoder/vp9_noise_estimate.h

index c3a3171d61c14f4b891cbba080c9583e81ce071b..b41ffd0a36d0582b22ead9a102db55b7512996bb 100644 (file)
@@ -36,6 +36,7 @@ void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne,
   } else if (width * height >= 1280 * 720) {
     ne->thresh = 130;
   }
+  ne->num_frames_estimate = 20;
 }
 
 int enable_noise_estimation(VP9_COMP *const cpi) {
@@ -91,7 +92,6 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
   unsigned int thresh_sum_diff = 100;
   unsigned int thresh_sum_spatial = (200 * 200) << 8;
   unsigned int thresh_spatial_var = (32 * 32) << 8;
-  int num_frames_estimate = 20;
   int min_blocks_estimate = cm->mi_rows * cm->mi_cols >> 7;
   // Estimate is between current source and last source.
   YV12_BUFFER_CONFIG *last_source = cpi->Last_Source;
@@ -216,9 +216,9 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
       // Update noise estimate.
       ne->value = (int)((15 * ne->value + avg_est) >> 4);
       ne->count++;
-      if (ne->count == num_frames_estimate) {
+      if (ne->count == ne->num_frames_estimate) {
         // Reset counter and check noise level condition.
-        num_frames_estimate = 40;
+        ne->num_frames_estimate = 30;
         ne->count = 0;
         if (ne->value > (ne->thresh << 1))
           ne->level = kHigh;
index b5dded9efb7a6341804e95ecc14a1934625f7d0c..0d22ef04248759c2c28e7ee45880ab15042cac13 100644 (file)
@@ -38,6 +38,7 @@ typedef struct noise_estimate {
   int count;
   int last_w;
   int last_h;
+  int num_frames_estimate;
 } NOISE_ESTIMATE;
 
 struct VP9_COMP;