Fix indexing. Get rid of warning about jump depending on uninitialized value.

This commit is contained in:
Ari Lemmetti 2021-12-08 23:03:18 +02:00
parent bb1f2a0895
commit a1a7036445

View file

@ -1536,12 +1536,12 @@ static void search_pu_inter_bipred(inter_search_info_t *info,
*/ */
static bool merge_candidate_in_list(inter_merge_cand_t *all_cands, static bool merge_candidate_in_list(inter_merge_cand_t *all_cands,
inter_merge_cand_t *cand_to_add, inter_merge_cand_t *cand_to_add,
int8_t * added_idx_list, unit_stats_map_t *merge)
int list_size)
{ {
bool found = false; bool found = false;
for (int i = 0; i < list_size && !found; ++i) { for (int i = 0; i < merge->size && !found; ++i) {
inter_merge_cand_t * list_cand = &all_cands[added_idx_list[i]]; int key = merge->keys[i];
inter_merge_cand_t * list_cand = &all_cands[merge->unit[key].merge_idx];
found = cand_to_add->dir == list_cand->dir && found = cand_to_add->dir == list_cand->dir &&
cand_to_add->ref[0] == list_cand->ref[0] && cand_to_add->ref[0] == list_cand->ref[0] &&
@ -1606,6 +1606,8 @@ static void search_pu_inter(encoder_state_t * const state,
CU_SET_MV_CAND(cur_pu, 0, 0); CU_SET_MV_CAND(cur_pu, 0, 0);
CU_SET_MV_CAND(cur_pu, 1, 0); CU_SET_MV_CAND(cur_pu, 1, 0);
FILL(*info, 0);
info->state = state; info->state = state;
info->pic = frame->source; info->pic = frame->source;
info->origin.x = x; info->origin.x = x;
@ -1649,9 +1651,7 @@ static void search_pu_inter(encoder_state_t * const state,
if (cur_pu->inter.mv_dir == 3 && !state->encoder_control->cfg.bipred) continue; if (cur_pu->inter.mv_dir == 3 && !state->encoder_control->cfg.bipred) continue;
if (cur_pu->inter.mv_dir == 3 && !(width + height > 12)) continue; if (cur_pu->inter.mv_dir == 3 && !(width + height > 12)) continue;
bool is_duplicate = merge_candidate_in_list(info->merge_cand, cur_cand, bool is_duplicate = merge_candidate_in_list(info->merge_cand, cur_cand, merge);
merge->keys,
merge->size);
// Don't try merge candidates that don't satisfy mv constraints. // Don't try merge candidates that don't satisfy mv constraints.
// Don't add duplicates to list // Don't add duplicates to list