shithub: libvpx

Download patch

ref: 932f8fa04dc15f4adf16df37402556e8c4dc72e7
parent: 2aacb19ca1da664a1b3e288234ad549ddb6e01db
author: Marco Paniconi <marpan@google.com>
date: Thu Nov 29 04:27:52 EST 2018

vp9-svc: Add num_encoded_top layer counter

Useful for noise estimation when top layer
is skipped encoded.

Change-Id: I18cbe6119bac6c21514941b1e3b530a05a42df14

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4855,6 +4855,9 @@
 
   cpi->last_frame_dropped = 0;
   cpi->svc.last_layer_dropped[cpi->svc.spatial_layer_id] = 0;
+  if (cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1)
+    cpi->svc.num_encoded_top_layer++;
+
   // Keep track of the frame buffer index updated/refreshed for the
   // current encoded TL0 superframe.
   if (cpi->svc.temporal_layer_id == 0) {
--- a/vp9/encoder/vp9_noise_estimate.c
+++ b/vp9/encoder/vp9_noise_estimate.c
@@ -148,7 +148,7 @@
       ne->last_h = cm->height;
     }
     return;
-  } else if (frame_counter > 60 &&
+  } else if (frame_counter > 60 && cpi->svc.num_encoded_top_layer > 1 &&
              cpi->rc.frames_since_key > cpi->svc.number_spatial_layers &&
              cpi->svc.spatial_layer_id == cpi->svc.number_spatial_layers - 1 &&
              cpi->rc.avg_frame_low_motion < (low_res ? 70 : 50)) {
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -53,6 +53,7 @@
   svc->previous_frame_is_intra_only = 0;
   svc->superframe_has_layer_sync = 0;
   svc->use_set_ref_frame_config = 0;
+  svc->num_encoded_top_layer = 0;
 
   for (i = 0; i < REF_FRAMES; ++i) {
     svc->fb_idx_spatial_layer_id[i] = -1;
--- a/vp9/encoder/vp9_svc_layercontext.h
+++ b/vp9/encoder/vp9_svc_layercontext.h
@@ -186,6 +186,8 @@
   int64_t timebase_fac;
   int64_t time_stamp_superframe;
   int64_t time_stamp_prev[VPX_SS_MAX_LAYERS];
+
+  int num_encoded_top_layer;
 } SVC;
 
 struct VP9_COMP;