From 57ff7b2032c648565710ef299848810a4c3682db Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vignali@gmail.com>
Date: Sun, 3 Dec 2017 19:23:54 +0100
Subject: [PATCH 2/2] checkasm/vf_threshold : add test for threshold16

---
 tests/checkasm/vf_threshold.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/checkasm/vf_threshold.c b/tests/checkasm/vf_threshold.c
index 770f00ed3b..1630a40116 100644
--- a/tests/checkasm/vf_threshold.c
+++ b/tests/checkasm/vf_threshold.c
@@ -32,7 +32,7 @@
            tmp_buf[j] = rnd() & 0xFF;    \
     } while (0)
 
-static void check_threshold_8(void){
+static void check_threshold(int depth){
     LOCAL_ALIGNED_32(uint8_t, in       , [WIDTH_PADDED]);
     LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]);
     LOCAL_ALIGNED_32(uint8_t, min      , [WIDTH_PADDED]);
@@ -43,7 +43,7 @@ static void check_threshold_8(void){
     int w = WIDTH;
 
     ThresholdContext s;
-    s.depth = 8;
+    s.depth = depth;
     ff_threshold_init(&s);
 
     declare_func(void, const uint8_t *in, const uint8_t *threshold,
@@ -63,10 +63,13 @@ static void check_threshold_8(void){
     randomize_buffers(min, WIDTH);
     randomize_buffers(max, WIDTH);
 
-    if (check_func(s.threshold, "threshold8")) {
+    if (depth == 16)
+        w /= 2;
+
+    if (check_func(s.threshold, "threshold%d", depth)) {
         call_ref(in, threshold, min, max, out_ref, line_size, line_size, line_size, line_size, line_size, w, 1);
         call_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1);
-        if (memcmp(out_ref, out_new, w))
+        if (memcmp(out_ref, out_new, WIDTH))
             fail();
         bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1);
     }
@@ -74,6 +77,9 @@ static void check_threshold_8(void){
 
 void checkasm_check_vf_threshold(void)
 {
-    check_threshold_8();
+    check_threshold(8);
     report("threshold8");
+
+    check_threshold(16);
+    report("threshold16");
 }
-- 
2.11.0 (Apple Git-81)

