From: Marco Paniconi Date: Thu, 29 Nov 2018 17:27:52 +0000 (-0800) Subject: vp9-svc: Add num_encoded_top layer counter X-Git-Tag: v1.8.0~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=932f8fa04dc15f4adf16df37402556e8c4dc72e7;p=libvpx 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 cd3d7e713..41f94197f 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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) { diff --git a/vp9/encoder/vp9_noise_estimate.c b/vp9/encoder/vp9_noise_estimate.c index e0ae00e50..8c9a40f55 100644 --- a/vp9/encoder/vp9_noise_estimate.c +++ b/vp9/encoder/vp9_noise_estimate.c @@ -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)) { diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 0296d03d8..21b920f11 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -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; diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h index 31d95f9d6..945312044 100644 --- a/vp9/encoder/vp9_svc_layercontext.h +++ b/vp9/encoder/vp9_svc_layercontext.h @@ -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;