Release previous hash-me memory when encoding new frame
The hash-table from hash-me has two usages:
- intrablock copy for keyframe
- prune subpel search in interframe
The current usages only require the hash-table for the current and
previous coded frame be kept. But currently in the codebase, the
memory is only released when the frame buffers are refreshed.
This commit changes so that the hash-tables for frames other than
the current and previously coded frames are released, which allows
significant memory saving.
Performance when encoding 4k videos over 33 frames:
Baseline: 7.2 GB
Commit : 3.1 GB
Saving : 4.1 GB, or ~57% memory reduction
BUG=aomedia:2453
Change-Id: I659dbe5eb2d7badea7239a841fc5ba06987f75f7
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 9a7e25a..2f9264d 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -798,6 +798,7 @@
int rate_size;
int rate_index;
hash_table *previous_hash_table;
+ int need_to_clear_prev_hash_table;
int previous_index;
unsigned int row_mt;