]> granicus.if.org Git - libvpx/commitdiff
vp9-svc: Add num_encoded_top layer counter
authorMarco Paniconi <marpan@google.com>
Thu, 29 Nov 2018 17:27:52 +0000 (09:27 -0800)
committerMarco Paniconi <marpan@google.com>
Thu, 29 Nov 2018 17:34:53 +0000 (09:34 -0800)
Useful for noise estimation when top layer
is skipped encoded.

Change-Id: I18cbe6119bac6c21514941b1e3b530a05a42df14

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_noise_estimate.c
vp9/encoder/vp9_svc_layercontext.c
vp9/encoder/vp9_svc_layercontext.h

index cd3d7e71344403cc3ad36701134eede68a0c5b3f..41f94197f9297cc6f626406e8034f16f219b7269 100644 (file)
@@ -4855,6 +4855,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, size_t *size,
 
   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) {
index e0ae00e50e6750c8ea11ed72e672056dbaa3dfb8..8c9a40f5586c3a8f81f956760a60d371fa58a23b 100644 (file)
@@ -148,7 +148,7 @@ void vp9_update_noise_estimate(VP9_COMP *const cpi) {
       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)) {
index 0296d03d83f637d0472e2f55b174b6153e973fd1..21b920f11ae4bb9589194e310656b9a19eb36489 100644 (file)
@@ -53,6 +53,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
   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;
index 31d95f9d6be6e94b05dead01dfda5555dc227293..9453120449747ad53e40ddde7fe8390256fe26e1 100644 (file)
@@ -186,6 +186,8 @@ typedef struct SVC {
   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;