checkasm/vf_threshold : add test for threshold16

This commit is contained in:
Martin Vignali 2017-12-07 22:03:44 +01:00
parent 869efbf971
commit 179a2f04eb
1 changed files with 11 additions and 5 deletions

View File

@ -32,7 +32,7 @@
tmp_buf[j] = rnd() & 0xFF; \ tmp_buf[j] = rnd() & 0xFF; \
} while (0) } 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, in , [WIDTH_PADDED]);
LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, threshold, [WIDTH_PADDED]);
LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]); LOCAL_ALIGNED_32(uint8_t, min , [WIDTH_PADDED]);
@ -49,7 +49,7 @@ static void check_threshold_8(void){
ptrdiff_t olinesize, int w, int h); ptrdiff_t olinesize, int w, int h);
ThresholdContext s; ThresholdContext s;
s.depth = 8; s.depth = depth;
ff_threshold_init(&s); ff_threshold_init(&s);
memset(in, 0, WIDTH_PADDED); memset(in, 0, WIDTH_PADDED);
@ -63,10 +63,13 @@ static void check_threshold_8(void){
randomize_buffers(min, WIDTH); randomize_buffers(min, WIDTH);
randomize_buffers(max, 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_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); 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(); fail();
bench_new(in, threshold, min, max, out_new, line_size, line_size, line_size, line_size, line_size, w, 1); 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) void checkasm_check_vf_threshold(void)
{ {
check_threshold_8(); check_threshold(8);
report("threshold8"); report("threshold8");
check_threshold(16);
report("threshold16");
} }