Allocate winner_mode_stats based on speed features
The buffer winner_mode_stats is used to store the details of the
winner modes from mode decision. Transform search is performed
conservatively on these winner modes.
This buffer is not required in the following cases:
1) When use_nonrd_pick_mode sf is set to 1 and
hybrid_intra_pickmode sf is set to 0.
2) When multi_winner_mode_type sf is set to MULTI_WINNER_MODE_OFF.
3) During the stats generation stage.
This CL avoids the allocation of winner_mode_stats for these cases.
This CL also calculates the winner_mode_count based on the speed
feature multi_winner_mode_type, which is used for allocating
winner_mode_stats dynamically.
For AVIF image encode with speed = 9,
HEAP Memory reduction(%)
Resolution threads=1 threads=4
640x360 0.35 2.01
768x512 0.41 1.28
832x480 0.26 1.40
1280x720 0.21 0.70
HEAP memory reduction was measured using the following command.
$valgrind --tool=massif ./avifenc ...
Change-Id: I1453b58091122e0372e90eeaddbac8feb47dce4f
diff --git a/av1/encoder/ethread.c b/av1/encoder/ethread.c
index b95457a..98d3c45 100644
--- a/av1/encoder/ethread.c
+++ b/av1/encoder/ethread.c
@@ -1305,9 +1305,7 @@
sizeof(IntraBCMVCosts));
}
}
- av1_alloc_mb_data(cm, &thread_data->td->mb,
- cpi->sf.rt_sf.use_nonrd_pick_mode,
- cpi->sf.rd_sf.use_mb_rd_hash);
+ av1_alloc_mb_data(cpi, &thread_data->td->mb);
// Reset cyclic refresh counters.
av1_init_cyclic_refresh_counters(&thread_data->td->mb);
@@ -1378,9 +1376,7 @@
}
}
- av1_alloc_mb_data(cm, &thread_data->td->mb,
- cpi->sf.rt_sf.use_nonrd_pick_mode,
- cpi->sf.rd_sf.use_mb_rd_hash);
+ av1_alloc_mb_data(cpi, &thread_data->td->mb);
}
}
#endif