From: Marco Paniconi Date: Mon, 12 Mar 2018 05:09:14 +0000 (-0700) Subject: vp9-SVC: Fix to choose_partition when LAST ref is NULL. X-Git-Tag: v1.8.0~814 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3223a3f892c9372f861b7e5f7973df6fefad0885;p=libvpx vp9-SVC: Fix to choose_partition when LAST ref is NULL. This causes assert to trigger in choose_partitioning(). This can happen in some cases when enhancement layers are enabled midway during the stream. Change-Id: I69c3c8b4b1e3f1c7d8d7294d633ca5ddca148e8b --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 6517fb358..bf87a2663 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -1244,7 +1244,7 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, // For the variance computation under SVC mode, we treat the frame as key if // the reference (base layer frame) is key frame (i.e., is_key_frame == 1). - const int is_key_frame = + int is_key_frame = (cm->frame_type == KEY_FRAME || (is_one_pass_cbr_svc(cpi) && cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame)); @@ -1255,6 +1255,15 @@ static int choose_partitioning(VP9_COMP *cpi, const TileInfo *const tile, int segment_id; int sb_offset = (cm->mi_stride >> 3) * (mi_row >> 3) + (mi_col >> 3); + // For SVC: check if LAST frame is NULL and if so treat this frame as a key + // frame, for the purpose of the superblock partitioning. This can happen + // (LAST is NULL) in some cases where enhancement spatial layers are enabled + // dyanmically in the stream and the only reference is the spatial + // reference (GOLDEN). + if (cpi->use_svc) { + if (get_ref_frame_buffer(cpi, LAST_FRAME) == NULL) is_key_frame = 1; + } + set_offsets(cpi, tile, x, mi_row, mi_col, BLOCK_64X64); segment_id = xd->mi[0]->segment_id;