From 21d2273efa35bf41d6e7cb3a300792f00d281e84 Mon Sep 17 00:00:00 2001 From: hui su Date: Wed, 7 Jun 2017 15:50:36 -0700 Subject: [PATCH] vp9 level targeting: more strict constraint on min_gf_interval min_gf_interval should be no less than min_altref_distance + 1, as the encoder may produce bitstream with alt-ref distance being min_gf_interval - 1. BUG=b/38450599 Change-Id: Ifb733daa643ebc668d1b23e1ce92db94b66dabe8 --- vp9/vp9_cx_iface.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index 25fc80a9a..bb6b30bd4 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -425,10 +425,16 @@ static void config_target_level(VP9EncoderConfig *oxcf) { oxcf->worst_allowed_q = vp9_quantizer_to_qindex(63); // Adjust minimum art-ref distance. - if (oxcf->min_gf_interval < - (int)vp9_level_defs[target_level_index].min_altref_distance) + // min_gf_interval should be no less than min_altref_distance + 1, + // as the encoder may produce bitstream with alt-ref distance being + // min_gf_interval - 1. + if (oxcf->min_gf_interval <= + (int)vp9_level_defs[target_level_index].min_altref_distance) { oxcf->min_gf_interval = - (int)vp9_level_defs[target_level_index].min_altref_distance; + (int)vp9_level_defs[target_level_index].min_altref_distance + 1; + oxcf->max_gf_interval = + VPXMAX(oxcf->max_gf_interval, oxcf->min_gf_interval); + } // Adjust maximum column tiles. if (vp9_level_defs[target_level_index].max_col_tiles < -- 2.40.0