vp9-svc: Fix to resetting pattern/flags on key frame.

Chane only affects 1 pass cbr svc mode.

Change-Id: Ie28557409eb87673ed0b66c6dfe1bf3509a18c4d
This commit is contained in:
Marco 2016-03-07 13:43:11 -08:00
parent 2b5ab8095e
commit a304d26bf1
3 changed files with 28 additions and 15 deletions

View File

@ -1574,20 +1574,6 @@ static int calc_iframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
return vp9_rc_clamp_iframe_target_size(cpi, target);
}
// Reset information needed to set proper reference frames and buffer updates
// for temporal layering. This is called when a key frame is encoded.
static void reset_temporal_layer_to_zero(VP9_COMP *cpi) {
int sl;
LAYER_CONTEXT *lc = NULL;
cpi->svc.temporal_layer_id = 0;
for (sl = 0; sl < cpi->svc.number_spatial_layers; ++sl) {
lc = &cpi->svc.layer_context[sl * cpi->svc.number_temporal_layers];
lc->current_video_frame_in_layer = 0;
lc->frames_from_key_frame = 0;
}
}
void vp9_rc_get_svc_params(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
@ -1608,7 +1594,8 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) {
cpi->ref_frame_flags &=
(~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
} else if (is_one_pass_cbr_svc(cpi)) {
reset_temporal_layer_to_zero(cpi);
if (cm->current_video_frame > 0)
vp9_svc_reset_key_frame(cpi);
layer = LAYER_IDS_TO_IDX(cpi->svc.spatial_layer_id,
cpi->svc.temporal_layer_id, cpi->svc.number_temporal_layers);
cpi->svc.layer_context[layer].is_key_frame = 1;

View File

@ -816,3 +816,27 @@ void vp9_free_svc_cyclic_refresh(VP9_COMP *const cpi) {
}
}
}
// Reset on key frame: reset counters, references and buffer updates.
void vp9_svc_reset_key_frame(VP9_COMP *cpi) {
int sl, tl;
SVC *const svc = &cpi->svc;
LAYER_CONTEXT *lc = NULL;
for (sl = 0; sl < svc->number_spatial_layers; ++sl) {
for (tl = 0; tl < svc->number_temporal_layers; ++tl) {
lc = &cpi->svc.layer_context[sl * svc->number_temporal_layers + tl];
lc->current_video_frame_in_layer = 0;
lc->frames_from_key_frame = 0;
}
}
if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0212) {
set_flags_and_fb_idx_for_temporal_mode3(cpi);
} else if (svc->temporal_layering_mode ==
VP9E_TEMPORAL_LAYERING_MODE_NOLAYERING) {
set_flags_and_fb_idx_for_temporal_mode_noLayering(cpi);
} else if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0101) {
set_flags_and_fb_idx_for_temporal_mode2(cpi);
}
vp9_update_temporal_layer_framerate(cpi);
vp9_restore_layer_context(cpi);
}

View File

@ -136,6 +136,8 @@ int vp9_one_pass_cbr_svc_start_layer(struct VP9_COMP *const cpi);
void vp9_free_svc_cyclic_refresh(struct VP9_COMP *const cpi);
void vp9_svc_reset_key_frame(struct VP9_COMP *const cpi);
#ifdef __cplusplus
} // extern "C"
#endif