ref: 59c9e1d87ef33bc82fca82cfcf5202d4b86c92e7
parent: 15a75b45304248f746634b43763c496322bf8968
author: Jerome Jiang <jianj@google.com>
date: Tue Aug 24 10:30:54 EDT 2021
vp9 rc lib: Allow aq 3 to work for SVC with unit test Also use round to cast float to int with more accurate calculation to avoid error accumulation which causes qp to be different after ~290 frames. Change-Id: Iff65a8fdc67401814fd253dbf148afe9887df97f
--- a/test/ratectrl_rtc_test.cc
+++ b/test/ratectrl_rtc_test.cc
@@ -270,6 +270,7 @@
for (int i = 0; i < VPX_MAX_LAYERS; ++i) {
svc_params_.max_quantizers[i] = 56;
svc_params_.min_quantizers[i] = 2;
+ svc_params_.speed_per_layer[i] = 7;
}
cfg_.rc_end_usage = VPX_CBR;
cfg_.g_lag_in_frames = 0;
@@ -318,6 +319,7 @@
rc_cfg_.ss_number_layers = 3;
rc_cfg_.ts_number_layers = 3;
rc_cfg_.rc_mode = VPX_CBR;
+ rc_cfg_.aq_mode = aq_mode_;
rc_cfg_.scaling_factor_num[0] = 1;
rc_cfg_.scaling_factor_den[0] = 4;
@@ -367,7 +369,7 @@
VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3),
::testing::Values(VPX_CBR, VPX_VBR));
-VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0));
+VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0, 3));
} // namespace
int main(int argc, char **argv) {
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -277,9 +277,9 @@
svc->current_superframe > 0) {
// TODO(marpan): This may need to be modified for temporal layers.
const double framerate_pts = 10000000.0 / ts_delta;
- lrc->bits_off_target += (int)(lc->target_bandwidth / framerate_pts);
+ lrc->bits_off_target += (int)round(lc->target_bandwidth / framerate_pts);
} else {
- lrc->bits_off_target += (int)(lc->target_bandwidth / lc->framerate);
+ lrc->bits_off_target += (int)round(lc->target_bandwidth / lc->framerate);
}
// Clip buffer level to maximum buffer size for the layer.
lrc->bits_off_target =
--- a/vp9/ratectrl_rtc.cc
+++ b/vp9/ratectrl_rtc.cc
@@ -105,7 +105,7 @@
cpi_->framerate = rc_cfg.framerate;
cpi_->svc.number_spatial_layers = rc_cfg.ss_number_layers;
cpi_->svc.number_temporal_layers = rc_cfg.ts_number_layers;
-
+ vp9_set_mb_mi(cm, cm->width, cm->height);
for (int sl = 0; sl < cpi_->svc.number_spatial_layers; ++sl) {
for (int tl = 0; tl < cpi_->svc.number_temporal_layers; ++tl) {
const int layer =