Commit 7b88ade6 authored by Cheng Chen's avatar Cheng Chen
Browse files

Add filter delay for intraBC

Because of loop filter, the bottom 8 rows and the rightmost 8 cols
of IntraBC area now is invalid. It is equal to let the valid region
add an offset of the filter delay.

Change-Id: Ia91a5b3e81279166dc97a60a7fb6fbda3f2df138
parent b8b2a0ec
......@@ -480,8 +480,8 @@ int findSamples(const AV1_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col,
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
#define USE_WAVE_FRONT 1 // Use only top left area of frame for reference.
#if CONFIG_LPF_SB
#define INTRABC_ROW_DELAY 8
#endif // CONFIG_LPF_SB
#define INTRABC_FILTER_DELAY 8 // Delay of 8 pixels
#endif // CONFIG_LPF_SB
static INLINE void av1_find_ref_dv(int_mv *ref_dv, const TileInfo *const tile,
int mib_size, int mi_row, int mi_col) {
......@@ -507,6 +507,7 @@ static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
// SUBPEL_MASK is not the correct scale
if (((dv.row & (SCALE_PX_TO_MV - 1)) || (dv.col & (SCALE_PX_TO_MV - 1))))
return 0;
// Is the source top-left inside the current tile?
const int src_top_edge = mi_row * MI_SIZE * SCALE_PX_TO_MV + dv.row;
const int tile_top_edge = tile->mi_row_start * MI_SIZE * SCALE_PX_TO_MV;
......@@ -514,11 +515,24 @@ static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
const int src_left_edge = mi_col * MI_SIZE * SCALE_PX_TO_MV + dv.col;
const int tile_left_edge = tile->mi_col_start * MI_SIZE * SCALE_PX_TO_MV;
if (src_left_edge < tile_left_edge) return 0;
// Is the bottom right inside the current tile?
// Is the bottom right inside the current tile?
#if CONFIG_LPF_SB
// Because of loop filter, the bottom 8 rows and the rightmost 8 cols of
// IntraBC area now is invalid. It is equal to let the valid region add an
// offset of the filter delay
const int src_bottom_edge =
(mi_row * MI_SIZE + bh + INTRABC_FILTER_DELAY) * SCALE_PX_TO_MV + dv.row;
#else
const int src_bottom_edge = (mi_row * MI_SIZE + bh) * SCALE_PX_TO_MV + dv.row;
#endif // CONFIG_LPF_SB
const int tile_bottom_edge = tile->mi_row_end * MI_SIZE * SCALE_PX_TO_MV;
if (src_bottom_edge > tile_bottom_edge) return 0;
#if CONFIG_LPF_SB
const int src_right_edge =
(mi_col * MI_SIZE + bw + INTRABC_FILTER_DELAY) * SCALE_PX_TO_MV + dv.col;
#else
const int src_right_edge = (mi_col * MI_SIZE + bw) * SCALE_PX_TO_MV + dv.col;
#endif // CONFIG_LPF_SB
const int tile_right_edge = tile->mi_col_end * MI_SIZE * SCALE_PX_TO_MV;
if (src_right_edge > tile_right_edge) return 0;
......@@ -536,19 +550,6 @@ static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
const int src_sb64 = src_sb_row * total_sb64_per_row + src_sb64_col;
if (src_sb64 >= active_sb64 - INTRABC_DELAY_SB64) return 0;
#if CONFIG_LPF_SB
// Because of loop filter, the last 8 rows of current superblock row can't be
// used as intrabc search area.
if ((src_bottom_edge >> 3) >=
(active_sb_row + 1) * sb_size - INTRABC_ROW_DELAY)
return 0;
// The last 8 rows of the above superblock is invalid
if ((src_bottom_edge >> 3) >= active_sb_row * sb_size - INTRABC_ROW_DELAY &&
(src_right_edge >> 3) >= (mi_col >> mib_size_log2) * sb_size)
return 0;
#endif // CONFIG_LPF_SB
#if USE_WAVE_FRONT
const int gradient = 1 + INTRABC_DELAY_SB64 + (sb_size > 64);
const int wf_offset = gradient * (active_sb_row - src_sb_row);
......
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