From 0aaf170c13e408a8c2be2e0275538744dde30249 Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Mon, 26 Nov 2018 15:52:21 -0800 Subject: [PATCH] vp9-svc: Put check on usage of long term temporal ref. If the scale factor of the golden long term reference is different from the last reference then disable usage of long term reference. This should not happen, but add this as a check against some possibly incorrect update of the svc configuration. Change-Id: Ic1062d4384e005007d8c922813fa8ad188d8fa98 --- vp9/encoder/vp9_pickmode.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 8dce4cf7b..1324b5bc8 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -1732,11 +1732,21 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, if (!cpi->use_svc || (svc->use_gf_temporal_ref_current_layer && !svc->layer_context[svc->temporal_layer_id].is_key_frame)) { + struct scale_factors *const sf_last = &cm->frame_refs[LAST_FRAME - 1].sf; + struct scale_factors *const sf_golden = + &cm->frame_refs[GOLDEN_FRAME - 1].sf; gf_temporal_ref = 1; - if (cpi->rc.avg_frame_low_motion > 70) - thresh_svc_skip_golden = 500; - else - thresh_svc_skip_golden = 0; + // For temporal long term prediction, check that the golden reference + // is same scale as last reference, otherwise disable. + if ((sf_last->x_scale_fp != sf_golden->x_scale_fp) || + (sf_last->y_scale_fp != sf_golden->y_scale_fp)) { + gf_temporal_ref = 0; + } else { + if (cpi->rc.avg_frame_low_motion > 70) + thresh_svc_skip_golden = 500; + else + thresh_svc_skip_golden = 0; + } } init_ref_frame_cost(cm, xd, ref_frame_cost); -- 2.40.0