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

Extend IntraBC to 4x4

Change-Id: I3f30c35bcd1bc623ad0c34c4b954ff71b2fcfd00
parent 08468197
......@@ -1225,6 +1225,13 @@ static INLINE void build_inter_predictors(
const int ss_x = pd->subsampling_x;
const int ss_y = pd->subsampling_y;
int sub8x8_inter = bsize < BLOCK_8X8 && (ss_x || ss_y);
#if CONFIG_INTRABC
if (is_intrabc) {
sub8x8_inter = 0;
}
#endif
#if CONFIG_MOTION_VAR
sub8x8_inter = sub8x8_inter && !build_for_obmc;
#endif // CONFIG_MOTION_VAR
......
......@@ -71,6 +71,14 @@ static INLINE int av1_use_angle_delta(BLOCK_SIZE bsize) {
}
#endif // CONFIG_EXT_INTRA
#if CONFIG_INTRABC
static INLINE int av1_allow_intrabc(BLOCK_SIZE bsize,
const AV1_COMMON *const cm) {
return (bsize >= BLOCK_8X8 || bsize == BLOCK_4X4) &&
cm->allow_screen_content_tools;
}
#endif // CONFIG_INTRABC
#ifdef __cplusplus
} // extern "C"
#endif
......
......@@ -1163,7 +1163,7 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
mbmi->ref_frame[1] = NONE_FRAME;
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
if (av1_allow_intrabc(bsize, cm)) {
mbmi->use_intrabc = aom_read_symbol(r, ec_ctx->intrabc_cdf, 2, ACCT_STR);
if (mbmi->use_intrabc) {
mbmi->tx_size = read_tx_size(cm, xd, 1, !mbmi->skip, r);
......
......@@ -2169,7 +2169,7 @@ static void write_mb_modes_kf(AV1_COMMON *cm, MACROBLOCKD *xd,
!xd->lossless[mbmi->segment_id];
#if CONFIG_INTRABC
if (bsize >= BLOCK_8X8 && cm->allow_screen_content_tools) {
if (av1_allow_intrabc(bsize, cm)) {
int use_intrabc = is_intrabc_block(mbmi);
aom_write_symbol(w, use_intrabc, ec_ctx->intrabc_cdf, 2);
if (use_intrabc) {
......
......@@ -1984,7 +1984,7 @@ static void update_stats(const AV1_COMMON *const cm, ThreadData *td, int mi_row,
}
#if CONFIG_INTRABC
} else {
if (cm->allow_screen_content_tools && bsize >= BLOCK_8X8) {
if (av1_allow_intrabc(bsize, cm)) {
FRAME_COUNTS *const counts = td->counts;
++counts->intrabc[mbmi->use_intrabc];
} else {
......@@ -5278,6 +5278,9 @@ static void encode_frame_internal(AV1_COMP *cpi) {
av1_generate_block_hash_value(cpi->source, 4, block_hash_values[0],
block_hash_values[1], is_block_same[0],
is_block_same[1]);
av1_add_to_hash_map_by_row_with_precal_data(
&cm->cur_frame->hash_table, block_hash_values[1], is_block_same[1][2],
pic_width, pic_height, 4);
av1_generate_block_hash_value(cpi->source, 8, block_hash_values[1],
block_hash_values[0], is_block_same[1],
is_block_same[0]);
......
......@@ -4,7 +4,7 @@
#include "./av1_rtcd.h"
static const int crc_bits = 16;
static const int block_size_bits = 2;
static const int block_size_bits = 3;
static CRC_CALCULATOR crc_calculator1;
static CRC_CALCULATOR crc_calculator2;
static int g_crc_initialized = 0;
......@@ -53,15 +53,16 @@ static int is_block_2x2_col_same_value(uint8_t *p) {
return 1;
}
// the hash value (hash_value1 consists two parts, the first 2 bits relate to
// the hash value (hash_value1 consists two parts, the first 3 bits relate to
// the block size and the remaining 16 bits are the crc values. This fuction
// is used to get the first 2 bits.
// is used to get the first 3 bits.
static int hash_block_size_to_index(int block_size) {
switch (block_size) {
case 8: return 0;
case 16: return 1;
case 32: return 2;
case 64: return 3;
case 4: return 0;
case 8: return 1;
case 16: return 2;
case 32: return 3;
case 64: return 4;
default: return -1;
}
}
......@@ -220,7 +221,7 @@ void av1_generate_block_hash_value(const YV12_BUFFER_CONFIG *picture,
pos += block_size - 1;
}
if (block_size >= 8) {
if (block_size >= 4) {
const int size_minus1 = block_size - 1;
pos = 0;
for (int y_pos = 0; y_pos < y_end; y_pos++) {
......
......@@ -2573,8 +2573,8 @@ int av1_full_pixel_search(const AV1_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
const int block_height = block_size_high[bsize];
const int block_width = block_size_wide[bsize];
if (block_height == block_width && x_pos >= 0 && y_pos >= 0) {
if (block_width == 8 || block_width == 16 || block_width == 32 ||
block_width == 64) {
if (block_width == 4 || block_width == 8 || block_width == 16 ||
block_width == 32 || block_width == 64) {
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];
......
......@@ -9424,7 +9424,7 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
RD_STATS *rd_cost, BLOCK_SIZE bsize,
int64_t best_rd) {
const AV1_COMMON *const cm = &cpi->common;
if (bsize < BLOCK_8X8 || !cm->allow_screen_content_tools) return INT64_MAX;
if (!av1_allow_intrabc(bsize, cm)) return INT64_MAX;
MACROBLOCKD *const xd = &x->e_mbd;
const TileInfo *tile = &xd->tile;
......
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