shithub: dav1d

Download patch

ref: ef677d6aa184c8954dc4de78919262dd18348fa0
parent: e0c3186e65aeafa2853b275dfb534b5a274fab12
author: Janne Grunau <janne-vlc@jannau.net>
date: Sun Nov 4 14:48:19 EST 2018

calculate and cache the picture dimension in 4x4 blocks

--- a/src/decode.c
+++ b/src/decode.c
@@ -1099,8 +1099,7 @@
         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->cur.p.p.w + 3) >> 2,
-                                   (f->cur.p.p.h + 3) >> 2, bs,
+                                   t->bx, t->by, f->w4, f->h4, bs,
                                    b->tx, b->uvtx, f->cur.p.p.layout,
                                    &t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
                                    has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
@@ -1749,9 +1748,7 @@
             &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->cur.p.p.w + 3) >> 2,
-                                   (f->cur.p.p.h + 3) >> 2,
-                                   b->skip, bs, b->tx_split,
+                                   f->w4, f->h4, b->skip, bs, b->tx_split,
                                    b->uvtx, f->cur.p.p.layout,
                                    &t->a->tx_lpf_y[bx4], &t->l.tx_lpf_y[by4],
                                    has_chroma ? &t->a->tx_lpf_uv[cbx4] : NULL,
@@ -2917,6 +2914,8 @@
         dav1d_thread_picture_ref(out_delayed, &f->cur);
     }
 
+    f->w4 = (f->frame_hdr.width + 3) >> 2;
+    f->h4 = (f->frame_hdr.height + 3) >> 2;
     f->bw = ((f->frame_hdr.width + 7) >> 3) << 1;
     f->bh = ((f->frame_hdr.height + 7) >> 3) << 1;
     f->sb128w = (f->bw + 31) >> 5;
--- a/src/internal.h
+++ b/src/internal.h
@@ -149,7 +149,7 @@
     int ipred_edge_sz;
     pixel *ipred_edge[3];
     ptrdiff_t b4_stride;
-    int bw, bh, sb128w, sb128h, sbh, sb_shift, sb_step;
+    int w4, h4, bw, bh, sb128w, sb128h, sbh, sb_shift, sb_step;
     uint16_t dq[NUM_SEGMENTS][3 /* plane */][2 /* dc/ac */];
     const uint8_t *qm[2 /* is_1d */][N_RECT_TX_SIZES][3 /* plane */];
     BlockContext *a;
--- a/src/lf_apply_tmpl.c
+++ b/src/lf_apply_tmpl.c
@@ -177,7 +177,6 @@
 {
     int x, have_left;
     // Don't filter outside the frame
-    const int hy4 = (f->cur.p.p.h + 3) >> 2;
     const int have_top = sby > 0;
     const int is_sb64 = !f->seq_hdr.sb128;
     const int starty4 = (sby & is_sb64) << 4;
@@ -188,7 +187,7 @@
     const int ss_hor = f->cur.p.p.layout != DAV1D_PIXEL_LAYOUT_I444;
     const int vmask = 16 >> ss_ver, hmask = 16 >> ss_hor;
     const unsigned vmax = 1U << vmask, hmax = 1U << hmask;
-    const unsigned endy4 = starty4 + imin(hy4 - sby * sbsz, sbsz);
+    const unsigned endy4 = starty4 + imin(f->h4 - sby * sbsz, sbsz);
     const unsigned uv_endy4 = (endy4 + ss_ver) >> ss_ver;
 
     // fix lpf strength at tile col boundaries