ref: b7d7c8ce18693d64c52956944c39777d047cfd4d
parent: 57dd0aae90c6b6c8bf370553507dae568671a4e4
author: Luc Trudeau <ltrudeau@twoorioles.com>
date: Thu Oct 10 19:07:55 EDT 2019
Check loopfilter levels prior to calling lf_mask
--- a/src/decode.c
+++ b/src/decode.c
@@ -1176,14 +1176,18 @@
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 @@
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) {
--- a/src/lf_mask.c
+++ b/src/lf_mask.c
@@ -286,7 +286,6 @@
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 @@
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_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 @@
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]);
--- a/src/lf_mask.h
+++ b/src/lf_mask.h
@@ -63,7 +63,6 @@
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 @@
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,