Commit 5b10f484 authored by James Almer's avatar James Almer

checkasm: add float_dsp tests

Ported from libavutil/tests/float_dsp.c
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 37388b11
......@@ -30,6 +30,7 @@ AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o
CHECKASMOBJS-$(CONFIG_AVFILTER) += $(AVFILTEROBJS-yes)
AVUTILOBJS += fixed_dsp.o
AVUTILOBJS += float_dsp.o
CHECKASMOBJS-$(CONFIG_AVUTIL) += $(AVUTILOBJS)
......
......@@ -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, ...)
{
......
......@@ -39,6 +39,7 @@ void checkasm_check_bswapdsp(void);
void checkasm_check_colorspace(void);
void checkasm_check_fixed_dsp(void);
void checkasm_check_flacdsp(void);
void checkasm_check_float_dsp(void);
void checkasm_check_fmtconvert(void);
void checkasm_check_h264dsp(void);
void checkasm_check_h264pred(void);
......@@ -70,6 +71,9 @@ int float_near_abs_eps_array(const float *a, const float *b, float eps,
unsigned len);
int float_near_abs_eps_array_ulp(const float *a, const float *b, float eps,
unsigned max_ulp, unsigned len);
int double_near_abs_eps(double a, double b, double eps);
int double_near_abs_eps_array(const double *a, const double *b, double eps,
unsigned len);
extern AVLFG checkasm_lfg;
#define rnd() av_lfg_get(&checkasm_lfg)
......
This diff is collapsed.
......@@ -4,6 +4,7 @@ FATE_CHECKASM = fate-checkasm-alacdsp \
fate-checkasm-bswapdsp \
fate-checkasm-fixed_dsp \
fate-checkasm-flacdsp \
fate-checkasm-float_dsp \
fate-checkasm-fmtconvert \
fate-checkasm-h264dsp \
fate-checkasm-h264pred \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment