hevcenc: Correctly update second best mv candidate in hme coarse layers

Test: poc in the bug report
Test: atest CtsMediaV2TestCases:CodecEncoderTest
Test: atest VtsHalMediaC2V1_0TargetVideoEncTest

Bug: 207502397

Change-Id: I0bc050ca4804b724bc226d6f00f798696d1b5c65
(cherry picked from commit 057f2f3aae)
Merged-In: I0bc050ca4804b724bc226d6f00f798696d1b5c65
This commit is contained in:
Neelkamal Semwal 2022-03-17 19:45:21 +05:30 committed by Cherrypicker Worker
parent ffb1b735ac
commit 2db516cc99
2 changed files with 8 additions and 21 deletions

View file

@ -1797,14 +1797,13 @@ void hme_update_results_grid_pu_bestn_no_encode(result_upd_prms_t *ps_result_prm
/*****************************************************************/
if(i4_tot_cost < ps_best_node[num_results - 1].i4_tot_cost)
{
S32 eq_cost = 0;
/*************************************************************/
/* Identify where the current result isto be placed.Basically*/
/* find the node which has cost just higher thannodeundertest*/
/*************************************************************/
for(i = 0; i < num_results - 1; i++)
{
if(i4_tot_cost < ps_best_node[i].i4_tot_cost)
if(i4_tot_cost <= ps_best_node[i].i4_tot_cost)
{
memmove(
ps_best_node + i + 1,
@ -1812,24 +1811,11 @@ void hme_update_results_grid_pu_bestn_no_encode(result_upd_prms_t *ps_result_prm
sizeof(search_node_t) * (num_results - 1 - i));
break;
}
else if(i4_tot_cost == ps_best_node[i].i4_tot_cost)
{
//if (0 == hme_cmp_nodes(ps_search_node_grid, ps_best_node+i))
// break;
/* When cost is same we comp. the nodes and if it's same skip. */
/* We don't want to add this code to intrinsic. So we are */
/* commenting it. The quality impact was minor when we did the */
/* regression. */
eq_cost = 1;
}
}
if(!eq_cost)
{
ps_best_node[i] = *ps_search_node_grid;
ps_best_node[i].i4_sad = i4_sad;
ps_best_node[i].i4_mv_cost = i4_mv_cost;
ps_best_node[i].i4_tot_cost = i4_tot_cost;
}
ps_best_node[i] = *ps_search_node_grid;
ps_best_node[i].i4_sad = i4_sad;
ps_best_node[i].i4_mv_cost = i4_mv_cost;
ps_best_node[i].i4_tot_cost = i4_tot_cost;
}
i4_count++;
}

View file

@ -2011,8 +2011,9 @@ void hme_update_mv_bank_in_l1_me(
pi1_ref_idx4 = pi1_ref_idx3 + (ps_layer_mv->i4_num_mvs_per_blk);
{
search_node_t *aps_result_nodes_sorted[2][MAX_NUM_REF * 4];
U08 au1_cost_shifts_for_sorted_node[2][MAX_NUM_REF * 4];
/* max ref frames * max results per partition * number of partitions (4x4, 8x8) */
search_node_t *aps_result_nodes_sorted[2][MAX_NUM_REF * MAX_RESULTS_PER_PART * 2];
U08 au1_cost_shifts_for_sorted_node[2][MAX_NUM_REF * MAX_RESULTS_PER_PART * 2];
S32 i;