rc->source_alt_ref_active = 0;
rc->frames_till_gf_update_due = 0;
+ rc->constrain_gf_key_freq_onepass_vbr = 1;
rc->ni_av_qi = oxcf->worst_allowed_q;
rc->ni_tot_qi = 0;
rc->ni_frames = 0;
}
#if CONFIG_RATE_CTRL
- if (cpi->encode_command.use_external_target_frame_bits) {
- rc->this_frame_target = cpi->encode_command.target_frame_bits;
+ if (cpi->oxcf.use_simple_encode_api) {
+ if (cpi->encode_command.use_external_target_frame_bits) {
+ rc->this_frame_target = cpi->encode_command.target_frame_bits;
+ }
}
-#endif
+#endif // CONFIG_RATE_CTRL
// Target rate per SB64 (including partial SB64s.
rc->sb64_target_rate = (int)(((int64_t)rc->this_frame_target * 64 * 64) /
}
}
-int vp9_calc_pframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
+int vp9_calc_pframe_target_size_one_pass_vbr(const VP9_COMP *cpi) {
const RATE_CONTROL *const rc = &cpi->rc;
const int af_ratio = rc->af_ratio_onepass_vbr;
int64_t target =
return vp9_rc_clamp_pframe_target_size(cpi, (int)target);
}
-int vp9_calc_iframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
+int vp9_calc_iframe_target_size_one_pass_vbr(const VP9_COMP *cpi) {
static const int kf_ratio = 25;
const RATE_CONTROL *rc = &cpi->rc;
const int target = rc->avg_frame_bandwidth * kf_ratio;
rc->gfu_boost = DEFAULT_GF_BOOST >> 1;
rc->af_ratio_onepass_vbr = VPXMIN(15, VPXMAX(5, 3 * rc->gfu_boost / 400));
}
- adjust_gfint_frame_constraint(cpi, rc->frames_to_key);
+ if (rc->constrain_gf_key_freq_onepass_vbr)
+ adjust_gfint_frame_constraint(cpi, rc->frames_to_key);
rc->frames_till_gf_update_due = rc->baseline_gf_interval;
cpi->refresh_golden_frame = 1;
rc->source_alt_ref_pending = 0;
rc->min_gf_interval = FIXED_GF_INTERVAL;
rc->static_scene_max_gf_interval = FIXED_GF_INTERVAL;
} else {
+ double framerate = cpi->framerate;
// Set Maximum gf/arf interval
rc->max_gf_interval = oxcf->max_gf_interval;
rc->min_gf_interval = oxcf->min_gf_interval;
#if CONFIG_RATE_CTRL
+ if (oxcf->use_simple_encode_api) {
+ // In this experiment, we avoid framerate being changed dynamically during
+ // encoding.
+ framerate = oxcf->init_framerate;
+ }
+#endif // CONFIG_RATE_CTRL
if (rc->min_gf_interval == 0) {
rc->min_gf_interval = vp9_rc_get_default_min_gf_interval(
- oxcf->width, oxcf->height, oxcf->init_framerate);
+ oxcf->width, oxcf->height, framerate);
}
if (rc->max_gf_interval == 0) {
- rc->max_gf_interval = vp9_rc_get_default_max_gf_interval(
- oxcf->init_framerate, rc->min_gf_interval);
+ rc->max_gf_interval =
+ vp9_rc_get_default_max_gf_interval(framerate, rc->min_gf_interval);
}
-#else
- if (rc->min_gf_interval == 0)
- rc->min_gf_interval = vp9_rc_get_default_min_gf_interval(
- oxcf->width, oxcf->height, cpi->framerate);
- if (rc->max_gf_interval == 0)
- rc->max_gf_interval = vp9_rc_get_default_max_gf_interval(
- cpi->framerate, rc->min_gf_interval);
-#endif
// Extended max interval for genuinely static scenes like slide shows.
rc->static_scene_max_gf_interval = MAX_STATIC_GF_GROUP_LENGTH;