Commit 15652767 authored by RogerZhou's avatar RogerZhou Committed by Roger Zhou

Added 128x128 hash ME

Change-Id: I40bac595b1ecf56fada6980774b46bbf16426ce3
parent 927fe825
......@@ -4053,6 +4053,13 @@ static void encode_frame_internal(AV1_COMP *cpi) {
&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]);
......
......@@ -63,6 +63,7 @@ static int hash_block_size_to_index(int block_size) {
case 16: return 2;
case 32: return 3;
case 64: return 4;
case 128: return 5;
default: return -1;
}
}
......@@ -306,9 +307,11 @@ int av1_hash_is_vertical_perfect(const YV12_BUFFER_CONFIG *picture,
// 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 @@ void av1_get_block_hash_value(uint8_t *y_src, int stride, int block_size,
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 @@ void av1_get_block_hash_value(uint8_t *y_src, int stride, int block_size,
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 @@ void av1_get_block_hash_value(uint8_t *y_src, int stride, int block_size,
*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
......@@ -2673,7 +2673,7 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment