From b8642738c9851232c9bb1e1a22474953d3d367cf Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Sat, 11 Aug 2018 12:59:40 -0700 Subject: [PATCH] vp9-svc: Fix to updated SET_SVC_REF_FRAME_CONFIG control Add flag to separate two cases of bypass (flexible) SVC mode: usage of using the SET_SVC_REF_FRAME_CONFIG vs passing in the frame_flags in the vpx_encode (only used for temporal layers). This fixes failures in Datarate Temporal layer test, introduced in commit: a66da31 Change-Id: Ie62f933987c20792d1f963d645e98c1903bdd423 --- vp9/encoder/vp9_bitstream.c | 2 +- vp9/encoder/vp9_svc_layercontext.c | 10 ++++++---- vp9/encoder/vp9_svc_layercontext.h | 2 ++ vp9/vp9_cx_iface.c | 1 + 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 8830bfc11..0c6681c2b 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -913,7 +913,7 @@ int vp9_get_refresh_mask(VP9_COMP *cpi) { const GF_GROUP *const gf_group = &cpi->twopass.gf_group; arf_idx = gf_group->arf_update_idx[gf_group->index]; } - if (cpi->use_svc && + if (cpi->use_svc && cpi->svc.use_set_ref_frame_config && cpi->svc.temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) return cpi->svc.update_buffer_slot[cpi->svc.spatial_layer_id]; return (cpi->refresh_last_frame << cpi->lst_fb_idx) | diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 0bd4fd29a..2b3397747 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -44,6 +44,7 @@ void vp9_init_layer_context(VP9_COMP *const cpi) { svc->set_intra_only_frame = 0; svc->previous_frame_is_intra_only = 0; svc->superframe_has_layer_sync = 0; + svc->use_set_ref_frame_config = 0; for (i = 0; i < REF_FRAMES; ++i) { svc->fb_idx_spatial_layer_id[i] = -1; @@ -730,9 +731,9 @@ int vp9_one_pass_cbr_svc_start_layer(VP9_COMP *const cpi) { } else if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_0101) { set_flags_and_fb_idx_for_temporal_mode2(cpi); } else if (svc->temporal_layering_mode == - VP9E_TEMPORAL_LAYERING_MODE_BYPASS) { - if (cpi->ext_refresh_frame_flags_pending == 0) - set_flags_and_fb_idx_bypass_via_set_ref_frame_config(cpi); + VP9E_TEMPORAL_LAYERING_MODE_BYPASS && + svc->use_set_ref_frame_config) { + set_flags_and_fb_idx_bypass_via_set_ref_frame_config(cpi); } if (cpi->lst_fb_idx == svc->buffer_gf_temporal_ref[0].idx || @@ -1148,7 +1149,8 @@ void vp9_svc_update_ref_frame(VP9_COMP *const cpi) { SVC *const svc = &cpi->svc; BufferPool *const pool = cm->buffer_pool; - if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS) { + if (svc->temporal_layering_mode == VP9E_TEMPORAL_LAYERING_MODE_BYPASS && + svc->use_set_ref_frame_config) { vp9_svc_update_ref_frame_bypass_mode(cpi); } else if (cm->frame_type == KEY_FRAME) { // Keep track of frame index for each reference frame. diff --git a/vp9/encoder/vp9_svc_layercontext.h b/vp9/encoder/vp9_svc_layercontext.h index 82d5cdca6..964a04511 100644 --- a/vp9/encoder/vp9_svc_layercontext.h +++ b/vp9/encoder/vp9_svc_layercontext.h @@ -167,6 +167,8 @@ typedef struct SVC { uint8_t superframe_has_layer_sync; uint8_t fb_idx_base[REF_FRAMES]; + + int use_set_ref_frame_config; } SVC; struct VP9_COMP; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index d202e09c3..3da8758d9 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1509,6 +1509,7 @@ static vpx_codec_err_t ctrl_set_svc_ref_frame_config(vpx_codec_alg_priv_t *ctx, VP9_COMP *const cpi = ctx->cpi; vpx_svc_ref_frame_config_t *data = va_arg(args, vpx_svc_ref_frame_config_t *); int sl; + cpi->svc.use_set_ref_frame_config = 1; for (sl = 0; sl < cpi->svc.number_spatial_layers; ++sl) { cpi->svc.update_buffer_slot[sl] = data->update_buffer_slot[sl]; cpi->svc.reference_last[sl] = data->reference_last[sl]; -- 2.40.0