Skip unnecessary single ref frame motion vector search Change the reference motion vector search order to do the compound mode first. Only proceed to do the single reference frame motion vector search, when the compound frame type has less than 2 motion vectors found. Tested on night_720p 800 kbps 50 frames, the decoding process for ref mv system is sped up by 2X. This is a non-normative change under opt-ref-mv flag. Change-Id: I579f81b156a506aa4481cf8ed85d8b1e54d9e481
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index 56e6abd7..c841955 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -1725,6 +1725,31 @@ read_ref_frames(cm, xd, r, mbmi->segment_id, mbmi->ref_frame); const int is_compound = has_second_ref(mbmi); +#if CONFIG_OPT_REF_MV + if (is_compound) { + MV_REFERENCE_FRAME ref_frame = av1_ref_frame_type(mbmi->ref_frame); + av1_find_mv_refs(cm, xd, mi, ref_frame, &xd->ref_mv_count[ref_frame], + xd->ref_mv_stack[ref_frame], compound_inter_mode_ctx, + ref_mvs[ref_frame], mi_row, mi_col, fpm_sync, (void *)pbi, + inter_mode_ctx); + if (xd->ref_mv_count[ref_frame] <= 1) { + for (int ref = 0; ref < 1 + is_compound; ++ref) { + MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; + + av1_find_mv_refs(cm, xd, mi, frame, &xd->ref_mv_count[frame], + xd->ref_mv_stack[frame], compound_inter_mode_ctx, + ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi, + inter_mode_ctx); + } + } + } else { + MV_REFERENCE_FRAME frame = mbmi->ref_frame[0]; + av1_find_mv_refs(cm, xd, mi, frame, &xd->ref_mv_count[frame], + xd->ref_mv_stack[frame], compound_inter_mode_ctx, + ref_mvs[frame], mi_row, mi_col, fpm_sync, (void *)pbi, + inter_mode_ctx); + } +#else for (int ref = 0; ref < 1 + is_compound; ++ref) { MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; @@ -1741,6 +1766,7 @@ ref_mvs[ref_frame], mi_row, mi_col, fpm_sync, (void *)pbi, inter_mode_ctx); } +#endif int mode_ctx = 0;