Fix conditional jump based on uninitialised value Update an if condition added in commit 4265e4aa4b4ee9de380f3f8a82c74438cd5f2acf, which causes the valgrind error "Conditional jump or move depends on uninitialised value(s)" in some tests. Note that the struct that rd_stats_y points to is still uninitialized, but we won't be using its uninitialized members in an if condition. Bug: 494653438 Change-Id: I7f8aa8687417e9f179a2ec16552cc3323d493c47
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index 60d088c..74a25df 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -1880,7 +1880,9 @@ adjust_cost(cpi, x, &this_yrd, /*is_inter_pred=*/true); } adjust_rdcost(cpi, x, rd_stats, /*is_inter_pred=*/true); - if (rd_stats_y->rdcost < INT64_MAX) { + // Bug 494653438: If do_tx_search is 0, rd_stats_y is uninitialized, so + // valgrind will warn if we use rd_stats_y->rdcost in a conditional. + if (!do_tx_search || rd_stats_y->rdcost < INT64_MAX) { adjust_rdcost(cpi, x, rd_stats_y, /*is_inter_pred=*/true); }