From 6fe629e66608d9230942f0afd30105b83f7fae0b Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Fri, 21 Jul 2023 20:40:00 +0300 Subject: [PATCH] [ibc] A bit of cleanup and skip IBC search if cost is already less than 500 --- src/search.c | 2 +- src/search_ibc.c | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/search.c b/src/search.c index ec803c1b..e7b9b737 100644 --- a/src/search.c +++ b/src/search.c @@ -1010,7 +1010,7 @@ static double search_cu( } // Simple IBC search - if (can_use_intra //&& state->frame->slicetype == UVG_SLICE_I + if (cost > 500 && can_use_intra //&& state->frame->slicetype == UVG_SLICE_I && state->encoder_control->cfg.ibc && cost > 1000 && cu_width > 4 diff --git a/src/search_ibc.c b/src/search_ibc.c index c6bef680..6f8ff41b 100644 --- a/src/search_ibc.c +++ b/src/search_ibc.c @@ -767,6 +767,7 @@ static void search_pu_ibc(encoder_state_t * const state, cur_pu->depth = depth; cur_pu->tr_depth = depth; cur_pu->qp = state->qp; + cur_pu->inter.mv_dir = 1; // Default to candidate 0 CU_SET_MV_CAND(cur_pu, 0, 0); @@ -1295,20 +1296,18 @@ void uvg_search_cu_ibc(encoder_state_t * const state, cu_info_t *best_inter_pu = NULL; - // Find best AMVP PU - for (int mv_dir = 1; mv_dir < 4; ++mv_dir) { - int best_key = amvp[mv_dir - 1].keys[0]; + int best_key = amvp[0].keys[0]; - if (amvp[mv_dir - 1].size > 0 && - amvp[mv_dir - 1].cost[best_key] < *inter_cost) { + if (amvp[0].size > 0 && + amvp[0].cost[best_key] < *inter_cost) { - best_inter_pu = &amvp[mv_dir - 1].unit[best_key]; - *inter_cost = amvp[mv_dir - 1].cost[best_key]; - *inter_bitcost = amvp[mv_dir - 1].bits[best_key]; - } + best_inter_pu = &amvp[0].unit[best_key]; + *inter_cost = amvp[0].cost[best_key]; + *inter_bitcost = amvp[0].bits[best_key]; } + // Compare best AMVP against best Merge mode int best_merge_key = merge.keys[0];