[ibc] A bit of cleanup and skip IBC search if cost is already less than 500

This commit is contained in:
Marko Viitanen 2023-07-21 20:40:00 +03:00
parent 3cef3c0119
commit 6fe629e666
2 changed files with 9 additions and 10 deletions

View file

@ -1010,7 +1010,7 @@ static double search_cu(
} }
// Simple IBC search // 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 && state->encoder_control->cfg.ibc
&& cost > 1000 && cost > 1000
&& cu_width > 4 && cu_width > 4

View file

@ -767,6 +767,7 @@ static void search_pu_ibc(encoder_state_t * const state,
cur_pu->depth = depth; cur_pu->depth = depth;
cur_pu->tr_depth = depth; cur_pu->tr_depth = depth;
cur_pu->qp = state->qp; cur_pu->qp = state->qp;
cur_pu->inter.mv_dir = 1;
// Default to candidate 0 // Default to candidate 0
CU_SET_MV_CAND(cur_pu, 0, 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; 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 && if (amvp[0].size > 0 &&
amvp[mv_dir - 1].cost[best_key] < *inter_cost) { amvp[0].cost[best_key] < *inter_cost) {
best_inter_pu = &amvp[mv_dir - 1].unit[best_key]; best_inter_pu = &amvp[0].unit[best_key];
*inter_cost = amvp[mv_dir - 1].cost[best_key]; *inter_cost = amvp[0].cost[best_key];
*inter_bitcost = amvp[mv_dir - 1].bits[best_key]; *inter_bitcost = amvp[0].bits[best_key];
}
} }
// Compare best AMVP against best Merge mode // Compare best AMVP against best Merge mode
int best_merge_key = merge.keys[0]; int best_merge_key = merge.keys[0];