Optimize hash table for lower resolution contents
For lower resolution contents, width or height <= 480,
sb_size is set as 64x64 instead of 128x128. The hash
tables for these resolutions are allocated accordingly.
Observed memory footprint reduction with similar
encoding time.
Resolution Tile Memory reduction
Single Multi
Thread Thread
640x360 2x1 ~4% ~8% (2 threads)
832x480 2x1 ~4% ~3% (2 threads)
Memory measuring command:
$ command time -v ./aomenc ...
Change-Id: I5ce2e81276c191e4434b6b2b19fce4d4d7da757a
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index a363e1c..c146790 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5675,10 +5675,11 @@
av1_generate_block_2x2_hash_value(cpi->source, block_hash_values[0],
is_block_same[0], &cpi->td.mb);
// Hash data generated for screen contents is used for intraBC ME
- // TODO(any): Adjust max_size based on superblock size for intra frames
const int min_alloc_size = block_size_wide[mi_params->mi_alloc_bsize];
+ const int max_sb_size =
+ (1 << (cm->seq_params.mib_size_log2 + MI_SIZE_LOG2));
int src_idx = 0;
- for (int size = 4; size <= 128; size *= 2, src_idx = !src_idx) {
+ for (int size = 4; size <= max_sb_size; size *= 2, src_idx = !src_idx) {
const int dst_idx = !src_idx;
av1_generate_block_hash_value(
cpi->source, size, block_hash_values[src_idx],