vp9-svc: Add num_encoded_top layer counter
Useful for noise estimation when top layer
is skipped encoded.
Change-Id: I18cbe6119bac6c21514941b1e3b530a05a42df14
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index cd3d7e7..41f9419 100644
--- 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) {
diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c
index e0ae00e..8c9a40f 100644
--- 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)) {
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 0296d03..21b920f 100644
--- 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;
diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h
index 31d95f9..9453120 100644
--- 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;