shithub: dav1d

Download patch

ref: a02ed9c64cf7c69cc53739357e3ca0c981125c0e
parent: 6b85daf042d3c7d88c6e3be8a273a6ed1fcbf1a2
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Wed Mar 25 09:42:40 EDT 2020

checkasm: add proper restrictions for h/w_pad in ipred.cfl_ac[444/422]

h_pad and w_pad can only be even if ss_ver=0 or ss_hor=0, respectively.
This means certain special cases don't need to be implemented in SIMD
while still guaranteeing correct decoding, and thus we don't want to
test for these special cases in the checkasm test either.

--- a/tests/checkasm/ipred.c
+++ b/tests/checkasm/ipred.c
@@ -142,14 +142,21 @@
     for (int layout = 1; layout <= DAV1D_PIXEL_LAYOUT_I444; layout++) {
         const int ss_ver = layout == DAV1D_PIXEL_LAYOUT_I420;
         const int ss_hor = layout != DAV1D_PIXEL_LAYOUT_I444;
+        const int h_step = 2 >> ss_hor, v_step = 2 >> ss_ver;
         for (int w = 4; w <= (32 >> ss_hor); w <<= 1)
             if (check_func(c->cfl_ac[layout - 1], "cfl_ac_%s_w%d_%dbpc",
                 cfl_ac_names[layout - 1], w, BITDEPTH))
             {
-                for (int h = imax(w / 4, 4); h <= imin(w * 4, (32 >> ss_ver)); h <<= 1) {
+                for (int h = imax(w / 4, 4);
+                     h <= imin(w * 4, (32 >> ss_ver)); h <<= 1)
+                {
                     const ptrdiff_t stride = 32 * sizeof(pixel);
-                    for (int w_pad = (w >> 2) - 1; w_pad >= 0; w_pad--) {
-                        for (int h_pad = (h >> 2) - 1; h_pad >= 0; h_pad--) {
+                    for (int w_pad = imax((w >> 2) - h_step, 0);
+                         w_pad >= 0; w_pad -= h_step)
+                    {
+                        for (int h_pad = imax((h >> 2) - v_step, 0);
+                             h_pad >= 0; h_pad -= v_step)
+                        {
 #if BITDEPTH == 16
                             const int bitdepth_max = rnd() & 1 ? 0x3ff : 0xfff;
 #else