[svc rc] RC improvement for key frames in upper layers for spatial svc.

Change-Id: Id6ab59e505be28cd4eb9f1fe114feb47debe0539
This commit is contained in:
Minghai Shang
2014-04-24 13:31:46 -07:00
parent b906fe6528
commit f916a3e256
5 changed files with 36 additions and 10 deletions

View File

@@ -1727,8 +1727,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
twopass->gf_bits = gf_bits;
}
if (i == 1 ||
(!rc->source_alt_ref_pending &&
cpi->common.frame_type != KEY_FRAME)) {
(!rc->source_alt_ref_pending && cpi->common.frame_type != KEY_FRAME &&
!vp9_is_upper_layer_key_frame(cpi))) {
// Calculate the per frame bit target for this frame.
vp9_rc_set_frame_target(cpi, gf_bits);
}
@@ -2290,11 +2290,16 @@ void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
this_frame_copy = this_frame;
find_next_key_frame(cpi, &this_frame_copy);
// Don't place key frame in any enhancement layers in spatial svc
if (cpi->use_svc && cpi->svc.number_temporal_layers == 1 &&
cpi->svc.spatial_layer_id > 0) {
cm->frame_type = INTER_FRAME;
if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
lc->is_key_frame = 1;
if (cpi->svc.spatial_layer_id > 0) {
cm->frame_type = INTER_FRAME;
}
}
} else {
if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
lc->is_key_frame = 0;
}
cm->frame_type = INTER_FRAME;
}
@@ -2392,9 +2397,11 @@ void vp9_twopass_postencode_update(VP9_COMP *cpi) {
cpi->twopass.bits_left = MAX(cpi->twopass.bits_left, 0);
#ifdef LONG_TERM_VBR_CORRECTION
if (cpi->common.frame_type != KEY_FRAME) {
if (cpi->common.frame_type != KEY_FRAME &&
!vp9_is_upper_layer_key_frame(cpi)) {
#else
if (cpi->common.frame_type == KEY_FRAME) {
if (cpi->common.frame_type == KEY_FRAME ||
vp9_is_upper_layer_key_frame(cpi)) {
// For key frames kf_group_bits already had the target bits subtracted out.
// So now update to the correct value based on the actual bits used.
cpi->twopass.kf_group_bits += cpi->rc.this_frame_target - bits_used;