Commit f18ba021 authored by Cheng Chen's avatar Cheng Chen
Browse files

LPF_SB: set row delay to work with intrabc

Intrabc search area can't use pixels of the last 8 rows in the current
superblock row. Add a delay so that lpf_sb can work with intrabc.

Let lpf_sb on with intrabc while other loop filtering off (cdef, loop
restoration).

Change-Id: I98ab093a17096387b6233182da2656f90dfa09eb
parent cdb8983f
...@@ -103,10 +103,10 @@ extern "C" { ...@@ -103,10 +103,10 @@ extern "C" {
#define LPF_SIGN_CONTEXT 2 #define LPF_SIGN_CONTEXT 2
// Half of maximum loop filter length (15-tap) // Half of maximum loop filter length (15-tap)
#define FILT_BOUNDARY_OFFSET 8 #define FILT_BOUNDARY_OFFSET 0
#define FILT_BOUNDARY_MI_OFFSET (FILT_BOUNDARY_OFFSET >> MI_SIZE_LOG2) #define FILT_BOUNDARY_MI_OFFSET (FILT_BOUNDARY_OFFSET >> MI_SIZE_LOG2)
#define USE_GUESS_LEVEL 1 #define USE_GUESS_LEVEL 0
#define USE_LOOP_FILTER_SUPERBLOCK 1 #define USE_LOOP_FILTER_SUPERBLOCK 1
#endif // CONFIG_LPF_SB #endif // CONFIG_LPF_SB
......
...@@ -476,6 +476,7 @@ static INLINE void av1_find_ref_dv(int_mv *ref_dv, int mi_row, int mi_col) { ...@@ -476,6 +476,7 @@ static INLINE void av1_find_ref_dv(int_mv *ref_dv, int mi_row, int mi_col) {
#define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels #define INTRABC_DELAY_PIXELS 256 // Delay of 256 pixels
#define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64) #define INTRABC_DELAY_SB64 (INTRABC_DELAY_PIXELS / 64)
#define USE_WAVE_FRONT 1 // Use only top left area of frame for reference. #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, static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize, int mi_row, int mi_col, BLOCK_SIZE bsize,
int mib_size_log2) { int mib_size_log2) {
...@@ -514,6 +515,20 @@ static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile, ...@@ -514,6 +515,20 @@ static INLINE int av1_is_dv_valid(const MV dv, const TileInfo *const tile,
const int active_sb64 = active_sb_row * total_sb64_per_row + active_sb64_col; const int active_sb64 = active_sb_row * total_sb64_per_row + active_sb64_col;
const int src_sb64 = src_sb_row * total_sb64_per_row + src_sb64_col; 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 (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 #if USE_WAVE_FRONT
const int gradient = 1 + INTRABC_DELAY_SB64 + (sb_size > 64); const int gradient = 1 + INTRABC_DELAY_SB64 + (sb_size > 64);
const int wf_offset = gradient * (active_sb_row - src_sb_row); const int wf_offset = gradient * (active_sb_row - src_sb_row);
......
...@@ -1109,9 +1109,9 @@ static void loop_restoration_read_sb_coeffs(const AV1_COMMON *const cm, ...@@ -1109,9 +1109,9 @@ static void loop_restoration_read_sb_coeffs(const AV1_COMMON *const cm,
#endif // CONFIG_LOOP_RESTORATION #endif // CONFIG_LOOP_RESTORATION
static void setup_loopfilter(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) { static void setup_loopfilter(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
#if CONFIG_INTRABC #if CONFIG_INTRABC && !CONFIG_LPF_SB
if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return; if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return;
#endif // CONFIG_INTRABC #endif // CONFIG_INTRABC && !CONFIG_LPF_SB
struct loopfilter *lf = &cm->lf; struct loopfilter *lf = &cm->lf;
#if CONFIG_LOOPFILTER_LEVEL #if CONFIG_LOOPFILTER_LEVEL
lf->filter_level[0] = aom_rb_read_literal(rb, 6); lf->filter_level[0] = aom_rb_read_literal(rb, 6);
...@@ -2241,9 +2241,9 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data, ...@@ -2241,9 +2241,9 @@ static const uint8_t *decode_tiles(AV1Decoder *pbi, const uint8_t *data,
av1_frameworker_broadcast(pbi->cur_buf, mi_row << cm->mib_size_log2); av1_frameworker_broadcast(pbi->cur_buf, mi_row << cm->mib_size_log2);
} }
#if CONFIG_INTRABC #if CONFIG_INTRABC && !CONFIG_LPF_SB
if (!(cm->allow_intrabc && NO_FILTER_FOR_IBC)) if (!(cm->allow_intrabc && NO_FILTER_FOR_IBC))
#endif // CONFIG_INTRABC #endif // CONFIG_INTRABC && !CONFIG_LPF_SB
{ {
// Loopfilter the whole frame. // Loopfilter the whole frame.
#if CONFIG_LPF_SB #if CONFIG_LPF_SB
......
...@@ -2578,9 +2578,9 @@ static void loop_restoration_write_sb_coeffs(const AV1_COMMON *const cm, ...@@ -2578,9 +2578,9 @@ static void loop_restoration_write_sb_coeffs(const AV1_COMMON *const cm,
#endif // CONFIG_LOOP_RESTORATION #endif // CONFIG_LOOP_RESTORATION
static void encode_loopfilter(AV1_COMMON *cm, struct aom_write_bit_buffer *wb) { static void encode_loopfilter(AV1_COMMON *cm, struct aom_write_bit_buffer *wb) {
#if CONFIG_INTRABC #if CONFIG_INTRABC && !CONFIG_LPF_SB
if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return; if (cm->allow_intrabc && NO_FILTER_FOR_IBC) return;
#endif // CONFIG_INTRABC #endif // CONFIG_INTRABC && !CONFIG_LPF_SB
int i; int i;
struct loopfilter *lf = &cm->lf; struct loopfilter *lf = &cm->lf;
......
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