From bb505879d66bc311f8662f8642eca6a325a0ad05 Mon Sep 17 00:00:00 2001 From: Minghai Shang Date: Thu, 1 May 2014 12:00:39 -0700 Subject: [PATCH] [spatial svc] No need to code full width and height for non key frame Change-Id: I62ab0f4346b4157a90dc5b5f73ab5e597d69c1bd --- vp9/encoder/vp9_bitstream.c | 7 ++++--- vp9/encoder/vp9_ratectrl.c | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index c5a85c9..35d2ecf 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -1006,9 +1006,10 @@ static void write_frame_size_with_refs(VP9_COMP *cpi, found = cm->width == cfg->y_crop_width && cm->height == cfg->y_crop_height; - // TODO(ivan): This prevents a bug while more than 3 buffers are used. Do it - // in a better way. - if (cpi->use_svc) { + // Set "found" to 0 for temporal svc and for spatial svc key frame + if (cpi->use_svc && + (cpi->svc.number_spatial_layers == 1 || + cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame)) { found = 0; } vp9_wb_write_bit(wb, found); diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index b123bfd..8a22f81 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -1306,11 +1306,26 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) { cpi->oxcf.key_freq == 0))) { cm->frame_type = KEY_FRAME; rc->source_alt_ref_active = 0; + + if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) { + cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1; + } + if (cpi->pass == 0 && cpi->oxcf.rc_mode == RC_MODE_CBR) { target = calc_iframe_target_size_one_pass_cbr(cpi); } } else { cm->frame_type = INTER_FRAME; + + if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) { + LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id]; + if (cpi->svc.spatial_layer_id == 0) { + lc->is_key_frame = 0; + } else { + lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame; + } + } + if (cpi->pass == 0 && cpi->oxcf.rc_mode == RC_MODE_CBR) { target = calc_pframe_target_size_one_pass_cbr(cpi); } -- 2.7.4