svc_ctx.spatial_layers, frame_cnt == 0,
&ref_frame_config);
}
+ ref_frame_config.duration[0] = frame_duration * 1;
+ ref_frame_config.duration[1] = frame_duration * 1;
+
vpx_codec_control(&codec, VP9E_SET_SVC_REF_FRAME_CONFIG,
&ref_frame_config);
// Keep track of input frames, to account for frame drops in rate control
// adjust frame rates based on timestamps given
if (cm->show_frame) {
- adjust_frame_rate(cpi, source);
+ if (cpi->use_svc && cpi->svc.use_set_ref_frame_config &&
+ cpi->svc.duration[cpi->svc.spatial_layer_id] > 0)
+ vp9_svc_adjust_frame_rate(cpi);
+ else
+ adjust_frame_rate(cpi, source);
}
if (is_one_pass_cbr_svc(cpi)) {
vp9_copy_flags_ref_update_idx(cpi);
vp9_svc_update_ref_frame_buffer_idx(cpi);
}
+
+void vp9_svc_adjust_frame_rate(VP9_COMP *cpi) {
+ int64_t this_duration =
+ cpi->svc.timebase_fac * cpi->svc.duration[cpi->svc.spatial_layer_id];
+ vp9_new_framerate(cpi, 10000000.0 / this_duration);
+}
int temporal_layer_id_per_spatial[VPX_SS_MAX_LAYERS];
int first_spatial_layer_to_encode;
+
+ int64_t duration[VPX_SS_MAX_LAYERS];
+
+ int64_t timebase_fac;
} SVC;
struct VP9_COMP;
void vp9_svc_update_ref_frame(struct VP9_COMP *const cpi);
+void vp9_svc_adjust_frame_rate(struct VP9_COMP *const cpi);
+
#ifdef __cplusplus
} // extern "C"
#endif
size_t size, cx_data_sz;
unsigned char *cx_data;
+ cpi->svc.timebase_fac = timebase_units_to_ticks(timebase, 1);
+
// Set up internal flags
if (ctx->base.init_flags & VPX_CODEC_USE_PSNR) cpi->b_calculate_psnr = 1;
cpi->svc.lst_fb_idx[sl] = data->lst_fb_idx[sl];
cpi->svc.gld_fb_idx[sl] = data->gld_fb_idx[sl];
cpi->svc.alt_fb_idx[sl] = data->alt_fb_idx[sl];
+ cpi->svc.duration[sl] = data->duration[sl];
}
return VPX_CODEC_OK;
}
int reference_last[VPX_SS_MAX_LAYERS]; /**< Last as eference. */
int reference_golden[VPX_SS_MAX_LAYERS]; /**< Golden as reference. */
int reference_alt_ref[VPX_SS_MAX_LAYERS]; /**< Altref as reference. */
+ int64_t duration[VPX_SS_MAX_LAYERS]; /**< Duration per spatial layer. */
} vpx_svc_ref_frame_config_t;
/*!\brief VP9 svc frame dropping mode.