From: Marco Paniconi Date: Mon, 19 Nov 2018 20:24:52 +0000 (-0800) Subject: vp9: Fix to the svc buffer update X-Git-Tag: v1.8.0~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac3eccdc24bccece5f73ee67b88154f3bf4a4e9a;p=libvpx vp9: Fix to the svc buffer update Condition the pre-encode buffer update based on TS diff on temporal layers = 1 for now, as some fix is needed for the case where #temporal_layers > 1. Change-Id: I58163b956db415217e4687a31f8ba110545b09f5 --- diff --git a/test/svc_datarate_test.cc b/test/svc_datarate_test.cc index 8e1533629..0c35163bd 100644 --- a/test/svc_datarate_test.cc +++ b/test/svc_datarate_test.cc @@ -1163,7 +1163,7 @@ TEST_P(DatarateOnePassCbrSvcSmallKF, OnePassCbrSvc3SL3TLSmallKf) { AssignLayerBitrates(); ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); // TODO(jianj): webm:1554 - CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.76, + CheckLayerRateTargeting(number_spatial_layers_, number_temporal_layers_, 0.70, 1.15); #if CONFIG_VP9_DECODER // The non-reference frames are expected to be mismatched frames as the diff --git a/test/vp9_datarate_test.cc b/test/vp9_datarate_test.cc index 62f2852f6..4a7a8253e 100644 --- a/test/vp9_datarate_test.cc +++ b/test/vp9_datarate_test.cc @@ -649,7 +649,7 @@ TEST_P(DatarateTestVP9RealTime, << " The datarate for the file is lower than target by too much, " "for layer: " << j; - ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15) + ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.20) << " The datarate for the file is greater than target by too much, " "for layer: " << j; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 129e0a1c1..bb316fe11 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -274,12 +274,12 @@ static void update_buffer_level_svc_preencode(VP9_COMP *cpi) { LAYER_IDS_TO_IDX(svc->spatial_layer_id, i, svc->number_temporal_layers); LAYER_CONTEXT *const lc = &svc->layer_context[layer]; RATE_CONTROL *const lrc = &lc->rc; - if (use_timestamp && cpi->svc.use_set_ref_frame_config && ts_delta > 0 && + if (use_timestamp && cpi->svc.use_set_ref_frame_config && + svc->number_temporal_layers == 1 && ts_delta > 0 && svc->current_superframe > 0) { + // TODO(marpan): This may need to be modified for temporal layers. const double framerate_pts = 10000000.0 / ts_delta; - const double lc_framerate_pts = - framerate_pts / cpi->oxcf.ts_rate_decimator[i]; - lrc->bits_off_target += (int)(lc->target_bandwidth / lc_framerate_pts); + lrc->bits_off_target += (int)(lc->target_bandwidth / framerate_pts); } else { lrc->bits_off_target += (int)(lc->target_bandwidth / lc->framerate); }