shithub: dav1d

Download patch

ref: a194d47854ce95d794680e327790881d56a26632
parent: cfa986fe1b9fa783671ea66cf479a26b2a5aff19
author: Ronald S. Bultje <[email protected]>
date: Fri Nov 16 10:59:06 EST 2018

Slightly simplify the loop in lr_sbrow()

--- a/src/lr_apply_tmpl.c
+++ b/src/lr_apply_tmpl.c
@@ -232,7 +232,7 @@
 
     int unit_w = unit_size, bit = 0;
 
-    enum LrEdgeFlags edges = (y > 0 ? LR_HAVE_TOP : 0) |
+    enum LrEdgeFlags edges = (y > 0 ? LR_HAVE_TOP : 0) | LR_HAVE_RIGHT |
                              (row_h < h ? LR_HAVE_BOTTOM : 0);
 
     int aligned_unit_pos = row_y & ~(unit_size - 1);
@@ -242,12 +242,9 @@
     const int sb_idx = (aligned_unit_pos >> 7) * f->sr_sb128w;
     const int unit_idx = ((aligned_unit_pos >> 6) & 1) << 1;
     for (int x = 0; x < w; x += unit_w, edges |= LR_HAVE_LEFT, bit ^= 1) {
-        // TODO Clean up this if statement.
         if (x + max_unit_size > w) {
             unit_w = w - x;
             edges &= ~LR_HAVE_RIGHT;
-        } else {
-            edges |= LR_HAVE_RIGHT;
         }
 
         // Based on the position of the restoration unit, find the corresponding
@@ -257,7 +254,6 @@
             &f->lf.lr_mask[sb_idx + (x >> shift_hor)].lr[plane][u_idx];
 
         // FIXME Don't backup if the next restoration unit is RESTORE_NONE
-        // This also requires not restoring in the same conditions.
         if (edges & LR_HAVE_RIGHT) {
             backup4xU(pre_lr_border[bit], p + unit_w - 4, p_stride, row_h - y);
         }