From d6b2ec58147c76c9f8ee0f9e65b17ce336bde25e Mon Sep 17 00:00:00 2001 From: Ari Lemmetti Date: Fri, 26 Nov 2021 18:47:14 +0200 Subject: [PATCH] Only check used reference picture lists when validating merge candidates. Merge candidate struct should be initialized to zero, so this should not have any effect. The conditions are added in case someone decides to copy the code as an example. --- src/search_inter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/search_inter.c b/src/search_inter.c index f246e48b..216bbb49 100644 --- a/src/search_inter.c +++ b/src/search_inter.c @@ -1709,8 +1709,10 @@ static void search_pu_inter(encoder_state_t * const state, // Don't try merge candidates that don't satisfy mv constraints. // Don't add duplicates to list - if (!fracmv_within_tile(&info, cur_cu->inter.mv[0][0], cur_cu->inter.mv[0][1]) || - !fracmv_within_tile(&info, cur_cu->inter.mv[1][0], cur_cu->inter.mv[1][1]) || + bool active_L0 = cur_cu->inter.mv_dir & 1; + bool active_L1 = cur_cu->inter.mv_dir & 2; + if (active_L0 && !fracmv_within_tile(&info, cur_cu->inter.mv[0][0], cur_cu->inter.mv[0][1]) || + active_L1 && !fracmv_within_tile(&info, cur_cu->inter.mv[1][0], cur_cu->inter.mv[1][1]) || is_duplicate) { continue;