shithub: dav1d

Download patch

ref: acadacfad972b58227faf52595cd236119c2a840
parent: de6e31701969c7ab1bbf292d14b22d65324a07c3
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Tue Dec 31 14:46:06 EST 2019

Take lossless into account when assigning loopfilter strength

Fixes #327.

--- a/src/decode.c
+++ b/src/decode.c
@@ -1876,10 +1876,11 @@
                 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,
+            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,
+                                       f->frame_hdr->segmentation.lossless[b->seg_id] ?
+                                           (enum RectTxfmSize) TX_4X4 : b->max_ytx,
+                                       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);
--- a/src/lf_mask.c
+++ b/src/lf_mask.c
@@ -350,6 +350,7 @@
                                 const int bx, const int by,
                                 const int iw, const int ih,
                                 const int skip, const enum BlockSize bs,
+                                const enum RectTxfmSize max_ytx,
                                 const uint16_t *const tx_masks,
                                 const enum RectTxfmSize uvtx,
                                 const enum Dav1dPixelLayout layout,
@@ -373,7 +374,7 @@
         }
 
         mask_edges_inter(lflvl->filter_y, by4, bx4, bw4, bh4, skip,
-                         dav1d_max_txfm_size_for_bs[bs][0], tx_masks, ay, ly);
+                         max_ytx, tx_masks, ay, ly);
     }
 
     if (!auv) return;
--- a/src/lf_mask.h
+++ b/src/lf_mask.h
@@ -72,8 +72,8 @@
                                 const ptrdiff_t b4_stride,
                                 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,
-                                enum RectTxfmSize uvtx,
+                                enum BlockSize bs, enum RectTxfmSize max_ytx,
+                                const uint16_t *tx_mask, enum RectTxfmSize uvtx,
                                 enum Dav1dPixelLayout layout, uint8_t *ay,
                                 uint8_t *ly, uint8_t *auv, uint8_t *luv);
 void dav1d_calc_eih(Av1FilterLUT *lim_lut, int filter_sharpness);