From e93571601ac181376bb84b0b926c5e3ae8b9f496 Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Wed, 9 May 2018 20:37:48 -0700 Subject: [PATCH] vp9-svc: Fix inter-layer early exit threshold. If the scale factors are 1 (no scaling), set the threshold for skipping the inter-layer prediction to 0, so we will more often test this mode. Improves quality for upper layers for quality layers in svc mode. Change-Id: Iaf848d44f6cc153780db861b76517a4cf9672c45 --- vp9/encoder/vp9_pickmode.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 97615a06b..1ba518af8 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -1502,8 +1502,17 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, int flag_svc_subpel = 0; int svc_mv_col = 0; int svc_mv_row = 0; + int no_scaling = 0; unsigned int thresh_svc_skip_golden = 500; - if (cpi->svc.spatial_layer_id > 0 && cpi->svc.high_source_sad_superframe) + if (cpi->use_svc && cpi->svc.spatial_layer_id > 0) { + int layer = LAYER_IDS_TO_IDX(cpi->svc.spatial_layer_id - 1, + cpi->svc.temporal_layer_id, + cpi->svc.number_temporal_layers); + LAYER_CONTEXT *lc = &cpi->svc.layer_context[layer]; + if (lc->scaling_factor_num == lc->scaling_factor_den) no_scaling = 1; + } + if (cpi->svc.spatial_layer_id > 0 && + (cpi->svc.high_source_sad_superframe || no_scaling)) thresh_svc_skip_golden = 0; // Lower the skip threshold if lower spatial layer is better quality relative // to current layer. @@ -1517,7 +1526,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, TileDataEnc *tile_data, thresh_svc_skip_golden = 1000; init_ref_frame_cost(cm, xd, ref_frame_cost); - memset(&mode_checked[0][0], 0, MB_MODE_COUNT * MAX_REF_FRAMES); if (reuse_inter_pred) { -- 2.40.0