Do not use hash me if intrabc is not used
This saves memory of creating hash tables.
Peak memory usage down by ~25% (e.g. 701 MB to 532 MB).
Change-Id: Icaaea9c3894b4ef1bdf43d748408d5cc4ffbf28f
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 533b851..21f2a87 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5655,6 +5655,7 @@
features->allow_warped_motion = 0;
}
+ int hash_table_created = 0;
if (!is_stat_generation_stage(cpi) && av1_use_hash_me(cpi) &&
!cpi->sf.rt_sf.use_nonrd_pick_mode) {
// TODO(any): move this outside of the recoding loop to avoid recalculating
@@ -5680,6 +5681,7 @@
av1_hash_table_init(&x->intrabc_hash_table, x);
av1_hash_table_create(&x->intrabc_hash_table);
+ hash_table_created = 1;
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
@@ -6006,8 +6008,9 @@
}
}
- if (!is_stat_generation_stage(cpi) && av1_use_hash_me(cpi) &&
- !cpi->sf.rt_sf.use_nonrd_pick_mode) {
+ if ((!is_stat_generation_stage(cpi) && av1_use_hash_me(cpi) &&
+ !cpi->sf.rt_sf.use_nonrd_pick_mode) ||
+ hash_table_created) {
av1_hash_table_destroy(&x->intrabc_hash_table);
}
}
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 4e053a8..c6aef6e 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -1481,6 +1481,7 @@
// TODO(huisu@google.com, youzhou@microsoft.com): enable hash-me for HBD.
static INLINE int av1_use_hash_me(const AV1_COMP *const cpi) {
return (cpi->common.features.allow_screen_content_tools &&
+ cpi->common.features.allow_intrabc &&
frame_is_intra_only(&cpi->common));
}