Converting target_bandwidth to Bit/s at very beginning.
Change-Id: I1d8c9fe4228e2f1ef67a66883694842a9545e7b9
This commit is contained in:
parent
d7d7cedaaa
commit
3fff4bd2df
@ -632,9 +632,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
|
||||
cpi->oxcf.maximum_buffer_size = 240000;
|
||||
}
|
||||
|
||||
// Convert target bandwidth from Kbit/s to Bit/s
|
||||
cpi->oxcf.target_bandwidth *= 1000;
|
||||
|
||||
cpi->oxcf.starting_buffer_level =
|
||||
vp9_rescale(cpi->oxcf.starting_buffer_level,
|
||||
cpi->oxcf.target_bandwidth, 1000);
|
||||
|
@ -46,10 +46,10 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
|
||||
lrc->key_frame_rate_correction_factor = 1.0;
|
||||
|
||||
if (svc->number_temporal_layers > 1) {
|
||||
lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
|
||||
lc->target_bandwidth = oxcf->ts_target_bitrate[layer];
|
||||
lrc->last_q[INTER_FRAME] = oxcf->worst_allowed_q;
|
||||
} else {
|
||||
lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
|
||||
lc->target_bandwidth = oxcf->ss_target_bitrate[layer];
|
||||
lrc->last_q[0] = oxcf->best_allowed_q;
|
||||
lrc->last_q[1] = oxcf->best_allowed_q;
|
||||
lrc->last_q[2] = oxcf->best_allowed_q;
|
||||
@ -82,9 +82,9 @@ void vp9_update_layer_context_change_config(VP9_COMP *const cpi,
|
||||
RATE_CONTROL *const lrc = &lc->rc;
|
||||
|
||||
if (svc->number_temporal_layers > 1) {
|
||||
lc->target_bandwidth = oxcf->ts_target_bitrate[layer] * 1000;
|
||||
lc->target_bandwidth = oxcf->ts_target_bitrate[layer];
|
||||
} else {
|
||||
lc->target_bandwidth = oxcf->ss_target_bitrate[layer] * 1000;
|
||||
lc->target_bandwidth = oxcf->ss_target_bitrate[layer];
|
||||
}
|
||||
bitrate_alloc = (float)lc->target_bandwidth / target_bandwidth;
|
||||
// Update buffer-related quantities.
|
||||
@ -132,8 +132,7 @@ void vp9_update_temporal_layer_framerate(VP9_COMP *const cpi) {
|
||||
} else {
|
||||
const double prev_layer_framerate =
|
||||
oxcf->framerate / oxcf->ts_rate_decimator[layer - 1];
|
||||
const int prev_layer_target_bandwidth =
|
||||
oxcf->ts_target_bitrate[layer - 1] * 1000;
|
||||
const int prev_layer_target_bandwidth = oxcf->ts_target_bitrate[layer - 1];
|
||||
lc->avg_frame_size =
|
||||
(int)((lc->target_bandwidth - prev_layer_target_bandwidth) /
|
||||
(lc->framerate - prev_layer_framerate));
|
||||
|
@ -327,7 +327,8 @@ static vpx_codec_err_t set_encoder_config(
|
||||
else if (cfg->rc_end_usage == VPX_CBR)
|
||||
oxcf->rc_mode = RC_MODE_CBR;
|
||||
|
||||
oxcf->target_bandwidth = cfg->rc_target_bitrate;
|
||||
// Convert target bandwidth from Kbit/s to Bit/s
|
||||
oxcf->target_bandwidth = 1000 * cfg->rc_target_bitrate;
|
||||
oxcf->rc_max_intra_bitrate_pct = extra_cfg->rc_max_intra_bitrate_pct;
|
||||
|
||||
oxcf->best_allowed_q = vp9_quantizer_to_qindex(cfg->rc_min_quantizer);
|
||||
@ -387,7 +388,9 @@ static vpx_codec_err_t set_encoder_config(
|
||||
oxcf->ss_number_layers = cfg->ss_number_layers;
|
||||
|
||||
if (oxcf->ss_number_layers > 1) {
|
||||
vp9_copy(oxcf->ss_target_bitrate, cfg->ss_target_bitrate);
|
||||
int i;
|
||||
for (i = 0; i < VPX_SS_MAX_LAYERS; ++i)
|
||||
oxcf->ss_target_bitrate[i] = 1000 * cfg->ss_target_bitrate[i];
|
||||
} else if (oxcf->ss_number_layers == 1) {
|
||||
oxcf->ss_target_bitrate[0] = (int)oxcf->target_bandwidth;
|
||||
}
|
||||
@ -395,8 +398,11 @@ static vpx_codec_err_t set_encoder_config(
|
||||
oxcf->ts_number_layers = cfg->ts_number_layers;
|
||||
|
||||
if (oxcf->ts_number_layers > 1) {
|
||||
vp9_copy(oxcf->ts_target_bitrate, cfg->ts_target_bitrate);
|
||||
vp9_copy(oxcf->ts_rate_decimator, cfg->ts_rate_decimator);
|
||||
int i;
|
||||
for (i = 0; i < VPX_TS_MAX_LAYERS; ++i) {
|
||||
oxcf->ts_target_bitrate[i] = 1000 * cfg->ts_target_bitrate[i];
|
||||
oxcf->ts_rate_decimator[i] = cfg->ts_rate_decimator[i];
|
||||
}
|
||||
} else if (oxcf->ts_number_layers == 1) {
|
||||
oxcf->ts_target_bitrate[0] = (int)oxcf->target_bandwidth;
|
||||
oxcf->ts_rate_decimator[0] = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user