From: Marco Paniconi Date: Mon, 13 Aug 2018 04:35:15 +0000 (-0700) Subject: vp9-svc: Fixes for cyclic refresh for SVC. X-Git-Tag: v1.8.0~427^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62261d5eb83183f67113cd9cea9d8c0759137f68;p=libvpx vp9-svc: Fixes for cyclic refresh for SVC. Add metrics that are being updated per-frame to the layer struct, so each layer using the cyclic refresh has the correct update. This is more consistent for the rate control and refresh rate. Some improvement in screen content clips. Neutral for SVC on rtc set. Change-Id: I0a9862fb6b6a79e894e2ff30c120dc4aa26fcda5 --- diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc index 6858b325f..63e4c3c6a 100644 --- a/test/svc_datarate_test.cc +++ b/test/svc_datarate_test.cc @@ -1353,7 +1353,7 @@ TEST_P(DatarateOnePassCbrSvcSingleBR, OnePassCbrSvc2QL1TLScreen) { } ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.73, - 1.2); + 1.25); #if CONFIG_VP9_DECODER // The non-reference frames are expected to be mismatched frames as the // encoder will avoid loopfilter on these frames. diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 2b3397747..3fa25ae14 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -146,6 +146,9 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { size_t consec_zero_mv_size; VP9_COMMON *const cm = &cpi->common; lc->sb_index = 0; + lc->actual_num_seg1_blocks = 0; + lc->actual_num_seg2_blocks = 0; + lc->counter_encode_maxq_scene_change = 0; CHECK_MEM_ERROR(cm, lc->map, vpx_malloc(mi_rows * mi_cols * sizeof(*lc->map))); memset(lc->map, 0, mi_rows * mi_cols); @@ -349,6 +352,9 @@ void vp9_restore_layer_context(VP9_COMP *const cpi) { cpi->consec_zero_mv = lc->consec_zero_mv; lc->consec_zero_mv = temp3; cr->sb_index = lc->sb_index; + cr->actual_num_seg1_blocks = lc->actual_num_seg1_blocks; + cr->actual_num_seg2_blocks = lc->actual_num_seg2_blocks; + cr->counter_encode_maxq_scene_change = lc->counter_encode_maxq_scene_change; } } @@ -376,6 +382,9 @@ void vp9_save_layer_context(VP9_COMP *const cpi) { lc->consec_zero_mv = cpi->consec_zero_mv; cpi->consec_zero_mv = temp3; lc->sb_index = cr->sb_index; + lc->actual_num_seg1_blocks = cr->actual_num_seg1_blocks; + lc->actual_num_seg2_blocks = cr->actual_num_seg2_blocks; + lc->counter_encode_maxq_scene_change = cr->counter_encode_maxq_scene_change; } } diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h index 964a04511..b911575fc 100644 --- a/vp9/encoder/vp9_svc_layercontext.h +++ b/vp9/encoder/vp9_svc_layercontext.h @@ -60,10 +60,14 @@ typedef struct { size_t layer_size; struct vpx_psnr_pkt psnr_pkt; // Cyclic refresh parameters (aq-mode=3), that need to be updated per-frame. + // TODO(jianj/marpan): Is it better to use the full cyclic refresh struct. int sb_index; signed char *map; uint8_t *last_coded_q_map; uint8_t *consec_zero_mv; + int actual_num_seg1_blocks; + int actual_num_seg2_blocks; + int counter_encode_maxq_scene_change; uint8_t speed; } LAYER_CONTEXT;