shithub: dav1d

Download patch

ref: efbdf7a0dc4c17bb393e9a67289760cf19c07405
parent: 296d1dc006419546f342606ff7d47564bd9798a8
author: Henrik Gramner <gramner@twoorioles.com>
date: Wed Feb 19 15:49:05 EST 2020

checkasm: Improve the cdef input randomization algorithm

Change the input buffer randomization algorithm to more readily
trigger issues with both under- and overflows in cdef_filter.

--- a/tests/checkasm/cdef.c
+++ b/tests/checkasm/cdef.c
@@ -40,8 +40,16 @@
 }
 
 static void init_tmp(pixel *buf, int n, const int bitdepth_max) {
-    while (n--)
-        *buf++ = rnd() & bitdepth_max;
+    const int fill_type = rnd() & 7;
+    if (fill_type == 0)
+        while (n--) /* check for cdef_filter underflows */
+            *buf++ = rnd() & 1;
+    else if (fill_type == 1)
+        while (n--) /* check for cdef_filter overflows */
+            *buf++ = bitdepth_max - (rnd() & 1);
+    else
+        while (n--)
+            *buf++ = rnd() & bitdepth_max;
 }
 
 static void check_cdef_filter(const cdef_fn fn, const int w, const int h) {