Commit b7d7c8ce authored by Luc Trudeau's avatar Luc Trudeau
Browse files

Check loopfilter levels prior to calling lf_mask

parent 57dd0aae
......@@ -1176,14 +1176,18 @@ static int decode_b(Dav1dTileContext *const t,
f->bd_fn.recon_b_intra(t, bs, intra_edge_flags, b);
}
dav1d_create_lf_mask_intra(t->lf_mask, f->lf.level, f->b4_stride,
f->frame_hdr, (const uint8_t (*)[8][2])
&ts->lflvl[b->seg_id][0][0][0],
t->bx, t->by, f->w4, f->h4, bs,
b->tx, b->uvtx, f->cur.p.layout,
&t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
if (f->frame_hdr->loopfilter.level_y[0] ||
f->frame_hdr->loopfilter.level_y[1])
{
dav1d_create_lf_mask_intra(t->lf_mask, f->lf.level, f->b4_stride,
(const uint8_t (*)[8][2])
&ts->lflvl[b->seg_id][0][0][0],
t->bx, t->by, f->w4, f->h4, bs,
b->tx, b->uvtx, f->cur.p.layout,
&t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
}
// update contexts
#define set_ctx(type, dir, diridx, off, mul, rep_macro) \
......@@ -1859,17 +1863,21 @@ static int decode_b(Dav1dTileContext *const t,
if (f->bd_fn.recon_b_inter(t, bs, b)) return -1;
}
const int is_globalmv =
b->inter_mode == (is_comp ? GLOBALMV_GLOBALMV : GLOBALMV);
const uint8_t (*const lf_lvls)[8][2] = (const uint8_t (*)[8][2])
&ts->lflvl[b->seg_id][0][b->ref[0] + 1][!is_globalmv];
dav1d_create_lf_mask_inter(t->lf_mask, f->lf.level, f->b4_stride,
f->frame_hdr, lf_lvls, t->bx, t->by,
f->w4, f->h4, b->skip, bs, b->tx_split,
b->uvtx, f->cur.p.layout,
&t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
if (f->frame_hdr->loopfilter.level_y[0] ||
f->frame_hdr->loopfilter.level_y[1])
{
const int is_globalmv =
b->inter_mode == (is_comp ? GLOBALMV_GLOBALMV : GLOBALMV);
const uint8_t (*const lf_lvls)[8][2] = (const uint8_t (*)[8][2])
&ts->lflvl[b->seg_id][0][b->ref[0] + 1][!is_globalmv];
dav1d_create_lf_mask_inter(t->lf_mask, f->lf.level, f->b4_stride,
lf_lvls, t->bx, t->by, f->w4, f->h4,
b->skip, bs, b->tx_split, b->uvtx,
f->cur.p.layout,
&t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
has_chroma ? &t->l.tx_lpf_uv[cby4] : NULL);
}
// context updates
if (is_comp) {
......
......@@ -286,7 +286,6 @@ static inline void mask_edges_chroma(uint16_t (*const masks)[32][2][2],
void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
uint8_t (*const level_cache)[4],
const ptrdiff_t b4_stride,
const Dav1dFrameHeader *const hdr,
const uint8_t (*filter_level)[8][2],
const int bx, const int by,
const int iw, const int ih,
......@@ -297,9 +296,6 @@ void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
uint8_t *const ay, uint8_t *const ly,
uint8_t *const auv, uint8_t *const luv)
{
if (!hdr->loopfilter.level_y[0] && !hdr->loopfilter.level_y[1])
return;
const uint8_t *const b_dim = dav1d_block_dimensions[bs];
const int bw4 = imin(iw - bx, b_dim[0]);
const int bh4 = imin(ih - by, b_dim[1]);
......@@ -350,7 +346,6 @@ void dav1d_create_lf_mask_intra(Av1Filter *const lflvl,
void dav1d_create_lf_mask_inter(Av1Filter *const lflvl,
uint8_t (*const level_cache)[4],
const ptrdiff_t b4_stride,
const Dav1dFrameHeader *const hdr,
const uint8_t (*filter_level)[8][2],
const int bx, const int by,
const int iw, const int ih,
......@@ -361,9 +356,6 @@ void dav1d_create_lf_mask_inter(Av1Filter *const lflvl,
uint8_t *const ay, uint8_t *const ly,
uint8_t *const auv, uint8_t *const luv)
{
if (!hdr->loopfilter.level_y[0] && !hdr->loopfilter.level_y[1])
return;
const uint8_t *const b_dim = dav1d_block_dimensions[bs];
const int bw4 = imin(iw - bx, b_dim[0]);
const int bh4 = imin(ih - by, b_dim[1]);
......
......@@ -63,7 +63,6 @@ typedef struct Av1Restoration {
void dav1d_create_lf_mask_intra(Av1Filter *lflvl, uint8_t (*level_cache)[4],
const ptrdiff_t b4_stride,
const Dav1dFrameHeader *hdr,
const uint8_t (*level)[8][2], int bx, int by,
int iw, int ih, enum BlockSize bs,
enum RectTxfmSize ytx, enum RectTxfmSize uvtx,
......@@ -71,7 +70,6 @@ void dav1d_create_lf_mask_intra(Av1Filter *lflvl, uint8_t (*level_cache)[4],
uint8_t *ly, uint8_t *auv, uint8_t *luv);
void dav1d_create_lf_mask_inter(Av1Filter *lflvl, uint8_t (*level_cache)[4],
const ptrdiff_t b4_stride,
const Dav1dFrameHeader *hdr,
const uint8_t (*level)[8][2], int bx, int by,
int iw, int ih, int skip_inter,
enum BlockSize bs, const uint16_t *tx_mask,
......
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