Commit 2d46afcd authored by Hui Su's avatar Hui Su

intrabc: modify default ref dv

Make sure the ref dv is a valid dv.

Improves compression by about 0.3% on screen_content keyframes.

Change-Id: I3a20c1a04b0ebcad610276f21b410dcfc8ba4c4d
parent 5f22715c
......@@ -461,22 +461,25 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
#endif // CONFIG_EXT_WARPED_MOTION
#if CONFIG_INTRABC
static INLINE void av1_find_ref_dv(int_mv *ref_dv, int mi_row, int mi_col) {
// TODO(aconverse@google.com): Handle tiles and such
#define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
#define USE_WAVE_FRONT 1 // Use only top left area of frame for reference.
#define INTRABC_ROW_DELAY 8
static INLINE void av1_find_ref_dv(int_mv *ref_dv, const TileInfo *const tile,
int mib_size, int mi_row, int mi_col) {
(void)mi_col;
if (mi_row < MAX_MIB_SIZE) {
if (mi_row - mib_size < tile->mi_row_start) {
ref_dv->as_mv.row = 0;
ref_dv->as_mv.col = -MI_SIZE * MAX_MIB_SIZE;
ref_dv->as_mv.col = -MI_SIZE * mib_size - INTRABC_DELAY_PIXELS;
} else {
ref_dv->as_mv.row = -MI_SIZE * MAX_MIB_SIZE;
ref_dv->as_mv.row = -MI_SIZE * mib_size;
ref_dv->as_mv.col = 0;
}
ref_dv->as_mv.row *= 8;
ref_dv->as_mv.col *= 8;
}
#define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
#define USE_WAVE_FRONT 1 // Use only top left area of frame for reference.
#define INTRABC_ROW_DELAY 8
static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize,
int mib_size_log2) {
......
......@@ -1090,7 +1090,8 @@ static void read_intrabc_info(AV1_COMMON *const cm, MACROBLOCKD *const xd,
av1_find_best_ref_mvs(0, ref_mvs, &nearestmv, &nearmv);
#endif
int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
if (dv_ref.as_int == 0)
av1_find_ref_dv(&dv_ref, &xd->tile, cm->mib_size, mi_row, mi_col);
// Ref DV should not have sub-pel.
assert((dv_ref.as_mv.col & 7) == 0);
assert((dv_ref.as_mv.row & 7) == 0);
......
......@@ -8690,7 +8690,8 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
#endif
int_mv dv_ref = nearestmv.as_int == 0 ? nearmv : nearestmv;
if (dv_ref.as_int == 0) av1_find_ref_dv(&dv_ref, mi_row, mi_col);
if (dv_ref.as_int == 0)
av1_find_ref_dv(&dv_ref, tile, cm->mib_size, mi_row, mi_col);
// Ref DV should not have sub-pel.
assert((dv_ref.as_mv.col & 7) == 0);
assert((dv_ref.as_mv.row & 7) == 0);
......
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