shithub: dav1d

Download patch

ref: 9824c5d9c75816aefdb0c122c31159a405c35d64
parent: 9a550985a5749cdf0d8022d8f1b6e6361438531b
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Thu Jan 24 05:29:22 EST 2019

Don't filter top/left intra edge if intra_edge_filter=0

Fixes #236.

--- a/src/ipred_prepare.h
+++ b/src/ipred_prepare.h
@@ -81,8 +81,8 @@
                                       const pixel *dst, ptrdiff_t stride,
                                       const pixel *prefilter_toplevel_sb_edge,
                                       enum IntraPredMode mode, int *angle,
-                                      int tw, int th, pixel *topleft_out
-                                      HIGHBD_DECL_SUFFIX);
+                                      int tw, int th, int filter_edge,
+                                      pixel *topleft_out HIGHBD_DECL_SUFFIX);
 
 // These flags are OR'd with the angle argument into intra predictors.
 // ANGLE_USE_EDGE_FILTER_FLAG signals that edges should be convolved
--- a/src/ipred_prepare_tmpl.c
+++ b/src/ipred_prepare_tmpl.c
@@ -82,7 +82,7 @@
                                   const ptrdiff_t stride,
                                   const pixel *prefilter_toplevel_sb_edge,
                                   enum IntraPredMode mode, int *const angle,
-                                  const int tw, const int th,
+                                  const int tw, const int th, const int filter_edge,
                                   pixel *const topleft_out HIGHBD_DECL_SUFFIX)
 {
     const int bitdepth = bitdepth_from_max(bitdepth_max);
@@ -201,7 +201,7 @@
         } else {
             *topleft_out = have_top ? *dst_top : (1 << bitdepth) >> 1;
         }
-        if (mode == Z2_PRED && tw + th >= 6)
+        if (mode == Z2_PRED && tw + th >= 6 && filter_edge)
             *topleft_out = (topleft_out[-1] * 5 + topleft_out[0] * 6 +
                             topleft_out[1] * 5 + 8) >> 4;
     }
--- a/src/recon_tmpl.c
+++ b/src/recon_tmpl.c
@@ -833,8 +833,9 @@
                                                           edge_flags, dst,
                                                           f->cur.stride[0], top_sb_edge,
                                                           b->y_mode, &angle,
-                                                          t_dim->w, t_dim->h, edge
-                                                          HIGHBD_CALL_SUFFIX);
+                                                          t_dim->w, t_dim->h,
+                                                          f->seq_hdr->intra_edge_filter,
+                                                          edge HIGHBD_CALL_SUFFIX);
                     dsp->ipred.intra_pred[m](dst, f->cur.stride[0], edge,
                                              t_dim->w * 4, t_dim->h * 4,
                                              angle | intra_flags,
@@ -951,9 +952,8 @@
                                                           ts->tiling.row_end >> ss_ver,
                                                           0, uv_dst[pl], stride,
                                                           top_sb_edge, DC_PRED, &angle,
-                                                          uv_t_dim->w,
-                                                          uv_t_dim->h, edge
-                                                          HIGHBD_CALL_SUFFIX);
+                                                          uv_t_dim->w, uv_t_dim->h, 0,
+                                                          edge HIGHBD_CALL_SUFFIX);
                     dsp->ipred.cfl_pred[m](uv_dst[pl], stride, edge,
                                            uv_t_dim->w * 4,
                                            uv_t_dim->h * 4,
@@ -1053,8 +1053,9 @@
                                                               edge_flags, dst, stride,
                                                               top_sb_edge, uv_mode,
                                                               &angle, uv_t_dim->w,
-                                                              uv_t_dim->h, edge
-                                                              HIGHBD_CALL_SUFFIX);
+                                                              uv_t_dim->h,
+                                                              f->seq_hdr->intra_edge_filter,
+                                                              edge HIGHBD_CALL_SUFFIX);
                         angle |= intra_edge_filter_flag;
                         dsp->ipred.intra_pred[m](dst, stride, edge,
                                                  uv_t_dim->w * 4,
@@ -1216,7 +1217,7 @@
                                                   t->by, t->by > ts->tiling.row_start,
                                                   ts->tiling.col_end, ts->tiling.row_end,
                                                   0, dst, f->cur.stride[0], top_sb_edge,
-                                                  m, &angle, bw4, bh4, tl_edge
+                                                  m, &angle, bw4, bh4, 0, tl_edge
                                                   HIGHBD_CALL_SUFFIX);
             dsp->ipred.intra_pred[m](tmp, 4 * bw4 * sizeof(pixel),
                                      tl_edge, bw4 * 4, bh4 * 4, 0, 0, 0
@@ -1358,7 +1359,7 @@
                                                           ts->tiling.row_end >> ss_ver,
                                                           0, uvdst, f->cur.stride[1],
                                                           top_sb_edge, m,
-                                                          &angle, cbw4, cbh4, tl_edge
+                                                          &angle, cbw4, cbh4, 0, tl_edge
                                                           HIGHBD_CALL_SUFFIX);
                     dsp->ipred.intra_pred[m](tmp, cbw4 * 4 * sizeof(pixel),
                                              tl_edge, cbw4 * 4, cbh4 * 4, 0, 0, 0