shithub: dav1d

Download patch

ref: 8d238cdd06c1e77479b0577cff80efd137b8cbfb
parent: 59c3370eacab17d16791fa9d48687b1abc85703f
author: David Michael Barr <b@rr-dav.id.au>
date: Fri Oct 12 04:50:13 EDT 2018

Remove dual-plane chroma-from-luma prediction

--- a/src/ipred.c
+++ b/src/ipred.c
@@ -650,40 +650,6 @@
 cfl_pred_1_fn(16)
 cfl_pred_1_fn(32)
 
-static NOINLINE void
-cfl_pred_c(pixel *dstU, pixel *dstV, const ptrdiff_t stride, const int16_t *ac,
-           const int8_t *const alphas, const int width, const int height)
-{
-    const pixel dcU = *dstU, dcV = *dstV;
-    for (int y = 0; y < height; y++) {
-        for (int x = 0; x < width; x++) {
-            const int diff1 = alphas[0] * ac[x];
-            dstU[x] = iclip_pixel(dcU + apply_sign((abs(diff1) + 32) >> 6, diff1));
-            const int diff2 = alphas[1] * ac[x];
-            dstV[x] = iclip_pixel(dcV + apply_sign((abs(diff2) + 32) >> 6, diff2));
-        }
-        ac += width;
-        dstU += PXSTRIDE(stride);
-        dstV += PXSTRIDE(stride);
-    }
-}
-
-#define cfl_pred_fn(width) \
-static void cfl_pred_##width##xN_c(pixel *const dstU, \
-                                   pixel *const dstV, \
-                                   const ptrdiff_t stride, \
-                                   const int16_t *const ac, \
-                                   const int8_t *const alphas, \
-                                   const int height) \
-{ \
-    cfl_pred_c(dstU, dstV, stride, ac, alphas, width, height); \
-}
-
-cfl_pred_fn( 4)
-cfl_pred_fn( 8)
-cfl_pred_fn(16)
-cfl_pred_fn(32)
-
 static void pal_pred_c(pixel *dst, const ptrdiff_t stride,
                        const uint16_t *const pal, const uint8_t *idx,
                        const int w, const int h)
@@ -751,11 +717,6 @@
     c->cfl_pred_1[1] = cfl_pred_1_8xN_c;
     c->cfl_pred_1[2] = cfl_pred_1_16xN_c;
     c->cfl_pred_1[3] = cfl_pred_1_32xN_c;
-
-    c->cfl_pred[0] = cfl_pred_4xN_c;
-    c->cfl_pred[1] = cfl_pred_8xN_c;
-    c->cfl_pred[2] = cfl_pred_16xN_c;
-    c->cfl_pred[3] = cfl_pred_32xN_c;
 
     c->pal_pred = pal_pred_c;
 
--- a/src/ipred.h
+++ b/src/ipred.h
@@ -66,16 +66,6 @@
 typedef decl_cfl_pred_1_fn(*cfl_pred_1_fn);
 
 /*
- * dst[plane][x,y] += alpha[plane] * ac[x,y]
- * - alphas contains two q3 scalars (one for each plane) in [-16,16] range;
- */
-#define decl_cfl_pred_fn(name) \
-void (name)(pixel *u_dst, pixel *v_dst, ptrdiff_t stride, \
-            const int16_t *ac, const int8_t *const alphas, \
-            const int height)
-typedef decl_cfl_pred_fn(*cfl_pred_fn);
-
-/*
  * dst[x,y] = pal[idx[x,y]]
  * - palette indices are [0-7]
  */
@@ -90,7 +80,6 @@
     // chroma-from-luma
     cfl_ac_fn cfl_ac[3 /* 420, 422, 444 */][N_RECT_TX_SIZES /* chroma tx size */];
     cfl_pred_1_fn cfl_pred_1[4];
-    cfl_pred_fn cfl_pred[4];
 
     // palette
     pal_pred_fn pal_pred;
--- a/src/recon.c
+++ b/src/recon.c
@@ -851,6 +851,14 @@
                 const TxfmInfo *const cfl_uv_t_dim =
                     &dav1d_txfm_dimensions[cfl_uvtx];
 
+                const int furthest_r =
+                    ((cw4 << ss_hor) + t_dim->w - 1) & ~(t_dim->w - 1);
+                const int furthest_b =
+                    ((ch4 << ss_ver) + t_dim->h - 1) & ~(t_dim->h - 1);
+                dsp->ipred.cfl_ac[f->cur.p.p.layout - 1]
+                                 [cfl_uvtx](ac, y_src, f->cur.p.stride[0],
+                                            cbw4 - (furthest_r >> ss_hor),
+                                            cbh4 - (furthest_b >> ss_ver));
                 for (int pl = 0; pl < 2; pl++) {
                     int angle = 0;
                     const pixel *top_sb_edge = NULL;
@@ -875,26 +883,12 @@
                     dsp->ipred.intra_pred[m](uv_dst[pl], stride, edge,
                                              cfl_uv_t_dim->w * 4,
                                              cfl_uv_t_dim->h * 4, 0);
-                }
-                const int furthest_r =
-                    ((cw4 << ss_hor) + t_dim->w - 1) & ~(t_dim->w - 1);
-                const int furthest_b =
-                    ((ch4 << ss_ver) + t_dim->h - 1) & ~(t_dim->h - 1);
-                dsp->ipred.cfl_ac[f->cur.p.p.layout - 1]
-                                 [cfl_uvtx](ac, y_src, f->cur.p.stride[0],
-                                            cbw4 - (furthest_r >> ss_hor),
-                                            cbh4 - (furthest_b >> ss_ver));
-                if (b->cfl_alpha[0] && b->cfl_alpha[1]) {
-                  dsp->ipred.cfl_pred[cfl_uv_t_dim->lw](uv_dst[0],
-                                                        uv_dst[1], stride,
-                                                        ac, b->cfl_alpha,
-                                                        cbh4 * 4);
-                } else {
-                  const int pl = !b->cfl_alpha[0];
-                  dsp->ipred.cfl_pred_1[cfl_uv_t_dim->lw](uv_dst[pl],
-                                                          stride, ac,
-                                                          b->cfl_alpha[pl],
-                                                          cbh4 * 4);
+                    if (b->cfl_alpha[pl]) {
+                        dsp->ipred.cfl_pred_1[cfl_uv_t_dim->lw](uv_dst[pl],
+                                                                stride, ac,
+                                                                b->cfl_alpha[pl],
+                                                                cbh4 * 4);
+                    }
                 }
                 if (DEBUG_BLOCK_INFO && DEBUG_B_PIXELS) {
                     ac_dump(ac, 4*cbw4, 4*cbh4, "ac");