diff options
author | James Almer <jamrial@gmail.com> | 2017-04-11 17:16:56 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-06-14 19:20:10 -0300 |
commit | 5b10f484e2b35e06825973970423744d81f91df2 (patch) | |
tree | c8c15e986cc106d240d6e09c8ab757ecd7ac0a50 /tests/checkasm/checkasm.c | |
parent | 37388b119cf814c2af349e7acba32e33ea30c343 (diff) | |
download | ffmpeg-5b10f484e2b35e06825973970423744d81f91df2.tar.gz |
checkasm: add float_dsp tests
Ported from libavutil/tests/float_dsp.c
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'tests/checkasm/checkasm.c')
-rw-r--r-- | tests/checkasm/checkasm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index 0cb4ed199a..0b86627cc9 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -131,6 +131,7 @@ static const struct { #endif #if CONFIG_AVUTIL { "fixed_dsp", checkasm_check_fixed_dsp }, + { "float_dsp", checkasm_check_float_dsp }, #endif { NULL } }; @@ -285,6 +286,25 @@ int float_near_abs_eps_array_ulp(const float *a, const float *b, float eps, return 1; } +int double_near_abs_eps(double a, double b, double eps) +{ + double abs_diff = fabs(a - b); + + return abs_diff < eps; +} + +int double_near_abs_eps_array(const double *a, const double *b, double eps, + unsigned len) +{ + unsigned i; + + for (i = 0; i < len; i++) { + if (!double_near_abs_eps(a[i], b[i], eps)) + return 0; + } + return 1; +} + /* Print colored text to stderr if the terminal supports it */ static void color_printf(int color, const char *fmt, ...) { |