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.
Unified · Split
| @@ -270,6 +270,7 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest, · 269 unmodified lines | |||
| 270 | for (int i = 0; i < VPX_MAX_LAYERS; ++i) { | 270 | for (int i = 0; i < VPX_MAX_LAYERS; ++i) { |
| 271 | svc_params_.max_quantizers[i] = 56; | 271 | svc_params_.max_quantizers[i] = 56; |
| 272 | svc_params_.min_quantizers[i] = 2; | 272 | svc_params_.min_quantizers[i] = 2; |
| 273 | svc_params_.speed_per_layer[i] = 7; | ||
| 273 | } | 274 | } |
| 274 | cfg_.rc_end_usage = VPX_CBR; | 275 | cfg_.rc_end_usage = VPX_CBR; |
| 275 | cfg_.g_lag_in_frames = 0; | 276 | cfg_.g_lag_in_frames = 0; |
| @@ -318,6 +319,7 @@ class RcInterfaceSvcTest : public ::libvpx_test::EncoderTest, · 42 unmodified lines | |||
| 318 | rc_cfg_.ss_number_layers = 3; | 319 | rc_cfg_.ss_number_layers = 3; |
| 319 | rc_cfg_.ts_number_layers = 3; | 320 | rc_cfg_.ts_number_layers = 3; |
| 320 | rc_cfg_.rc_mode = VPX_CBR; | 321 | rc_cfg_.rc_mode = VPX_CBR; |
| 322 | rc_cfg_.aq_mode = aq_mode_; | ||
| 321 | 323 | ||
| 322 | rc_cfg_.scaling_factor_num[0] = 1; | 324 | rc_cfg_.scaling_factor_num[0] = 1; |
| 323 | rc_cfg_.scaling_factor_den[0] = 4; | 325 | rc_cfg_.scaling_factor_den[0] = 4; |
| @@ -367,7 +369,7 @@ TEST_P(RcInterfaceSvcTest, Svc) { RunSvc(); } · 43 unmodified lines | |||
| 367 | 369 | ||
| 368 | VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3), | 370 | VP9_INSTANTIATE_TEST_SUITE(RcInterfaceTest, ::testing::Values(0, 3), |
| 369 | ::testing::Values(VPX_CBR, VPX_VBR)); | 371 | ::testing::Values(VPX_CBR, VPX_VBR)); |
| 370 | VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0)); | 372 | VP9_INSTANTIATE_TEST_SUITE(RcInterfaceSvcTest, ::testing::Values(0, 3)); |
| 371 | } // namespace | 373 | } // namespace |
| 372 | 374 | ||
| 373 | int main(int argc, char **argv) { | 375 | int main(int argc, char **argv) { |
| @@ -277,9 +277,9 @@ static void update_buffer_level_svc_preencode(VP9_COMP *cpi) { · 276 unmodified lines | |||
| 277 | svc->current_superframe > 0) { | 277 | svc->current_superframe > 0) { |
| 278 | // TODO(marpan): This may need to be modified for temporal layers. | 278 | // TODO(marpan): This may need to be modified for temporal layers. |
| 279 | const double framerate_pts = 10000000.0 / ts_delta; | 279 | const double framerate_pts = 10000000.0 / ts_delta; |
| 280 | lrc->bits_off_target += (int)(lc->target_bandwidth / framerate_pts); | 280 | lrc->bits_off_target += (int)round(lc->target_bandwidth / framerate_pts); |
| 281 | } else { | 281 | } else { |
| 282 | lrc->bits_off_target += (int)(lc->target_bandwidth / lc->framerate); | 282 | lrc->bits_off_target += (int)round(lc->target_bandwidth / lc->framerate); |
| 283 | } | 283 | } |
| 284 | // Clip buffer level to maximum buffer size for the layer. | 284 | // Clip buffer level to maximum buffer size for the layer. |
| 285 | lrc->bits_off_target = | 285 | lrc->bits_off_target = |
| @@ -105,7 +105,7 @@ void VP9RateControlRTC::UpdateRateControl( · 104 unmodified lines | |||
| 105 | cpi_->framerate = rc_cfg.framerate; | 105 | cpi_->framerate = rc_cfg.framerate; |
| 106 | cpi_->svc.number_spatial_layers = rc_cfg.ss_number_layers; | 106 | cpi_->svc.number_spatial_layers = rc_cfg.ss_number_layers; |
| 107 | cpi_->svc.number_temporal_layers = rc_cfg.ts_number_layers; | 107 | cpi_->svc.number_temporal_layers = rc_cfg.ts_number_layers; |
| 108 | 108 | vp9_set_mb_mi(cm, cm->width, cm->height); | |
| 109 | for (int sl = 0; sl < cpi_->svc.number_spatial_layers; ++sl) { | 109 | for (int sl = 0; sl < cpi_->svc.number_spatial_layers; ++sl) { |
| 110 | for (int tl = 0; tl < cpi_->svc.number_temporal_layers; ++tl) { | 110 | for (int tl = 0; tl < cpi_->svc.number_temporal_layers; ++tl) { |
| 111 | const int layer = | 111 | const int layer = |