Added 128x128 hash ME
Change-Id: I40bac595b1ecf56fada6980774b46bbf16426ce3
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 377c1e6..e03e22e 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4053,6 +4053,13 @@
&cm->cur_frame->hash_table, block_hash_values[1], is_block_same[1][2],
pic_width, pic_height, 64);
+ av1_generate_block_hash_value(cpi->source, 128, block_hash_values[1],
+ block_hash_values[0], is_block_same[1],
+ is_block_same[0]);
+ av1_add_to_hash_map_by_row_with_precal_data(
+ &cm->cur_frame->hash_table, block_hash_values[0], is_block_same[0][2],
+ pic_width, pic_height, 128);
+
for (k = 0; k < 2; k++) {
for (j = 0; j < 2; j++) {
aom_free(block_hash_values[k][j]);
diff --git a/av1/encoder/hash_motion.c b/av1/encoder/hash_motion.c
index 2378597..497689f 100644
--- a/av1/encoder/hash_motion.c
+++ b/av1/encoder/hash_motion.c
@@ -63,6 +63,7 @@
case 16: return 2;
case 32: return 3;
case 64: return 4;
+ case 128: return 5;
default: return -1;
}
}
@@ -306,9 +307,11 @@
// global buffer for hash value calculation of a block
// used only in av1_get_block_hash_value()
-static uint32_t hash_value_buffer[2][2][1024]; // [first hash/second hash]
- // [two buffers used ping-pong]
- // [num of 2x2 blocks in 64x64]
+#define AOM_BUFFER_SIZE_FOR_BLOCK_HASH (4096)
+// [first hash/second hash]
+// [two buffers used ping-pong]
+// [num of 2x2 blocks in 128x128]
+static uint32_t hash_value_buffer[2][2][AOM_BUFFER_SIZE_FOR_BLOCK_HASH];
void av1_get_block_hash_value(uint8_t *y_src, int stride, int block_size,
uint32_t *hash_value1, uint32_t *hash_value2) {
@@ -325,7 +328,7 @@
int pos = (y_pos >> 1) * sub_block_in_width + (x_pos >> 1);
get_pixels_in_1D_char_array_by_block_2x2(y_src + y_pos * stride + x_pos,
stride, pixel_to_hash);
-
+ assert(pos < AOM_BUFFER_SIZE_FOR_BLOCK_HASH);
hash_value_buffer[0][0][pos] = av1_get_crc_value(
&crc_calculator1, pixel_to_hash, sizeof(pixel_to_hash));
hash_value_buffer[1][0][pos] = av1_get_crc_value(
@@ -349,6 +352,10 @@
for (int x_pos = 0; x_pos < sub_block_in_width; x_pos++) {
int srcPos = (y_pos << 1) * src_sub_block_in_width + (x_pos << 1);
+ assert(srcPos + 1 < AOM_BUFFER_SIZE_FOR_BLOCK_HASH);
+ assert(srcPos + src_sub_block_in_width + 1 <
+ AOM_BUFFER_SIZE_FOR_BLOCK_HASH);
+ assert(dst_pos < AOM_BUFFER_SIZE_FOR_BLOCK_HASH);
to_hash[0] = hash_value_buffer[0][src_idx][srcPos];
to_hash[1] = hash_value_buffer[0][src_idx][srcPos + 1];
to_hash[2] =
@@ -378,3 +385,4 @@
*hash_value1 = (hash_value_buffer[0][dst_idx][0] & crc_mask) + add_value;
*hash_value2 = hash_value_buffer[1][dst_idx][0];
}
+#undef AOM_BUFFER_SIZE_FOR_BLOCK_HASH
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index 66b6c72..463252e 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -2673,7 +2673,7 @@
const int block_width = block_size_wide[bsize];
if (block_height == block_width && x_pos >= 0 && y_pos >= 0) {
if (block_width == 4 || block_width == 8 || block_width == 16 ||
- block_width == 32 || block_width == 64) {
+ block_width == 32 || block_width == 64 || block_width == 128) {
uint8_t *what = x->plane[0].src.buf;
const int what_stride = x->plane[0].src.stride;
block_hash block_hashes[MAX_HASH_MV_TABLE_SIZE];