[FFmpeg-cvslog] dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision
Martin Storsjö
git at videolan.org
Fri Apr 24 14:53:57 EEST 2020
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Apr 23 09:19:25 2020 +0300| [f4d8fad802b59d3099eb453dcafb08219ecfa22c] | committer: Martin Storsjö
dnn-layer-mathbinary-test: Fix tests for cases with extra intermediate precision
This fixes tests on 32 bit x86 mingw with clang, which uses x87
fpu by default.
In this setup, while the get_expected function is declared to
return float, the compiler is (especially given the optimization
flags set) free to keep the intermediate values (in this case,
the return value from the inlined function) in higher precision.
This results in the situation where 7.28 (which actually, as
a float, ends up as 7.2800002098), multiplied by 100, is
728.000000 when really forced into a 32 bit float, but 728.000021
when kept with higher intermediate precision.
For the multiplication case, a more suitable epsilon would e.g.
be 2*FLT_EPSILON*fabs(expected_output), but just increase the
current hardcoded threshold for now.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4d8fad802b59d3099eb453dcafb08219ecfa22c
---
tests/dnn/dnn-layer-mathbinary-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/dnn/dnn-layer-mathbinary-test.c b/tests/dnn/dnn-layer-mathbinary-test.c
index f82d15b14c..f67c0f213b 100644
--- a/tests/dnn/dnn-layer-mathbinary-test.c
+++ b/tests/dnn/dnn-layer-mathbinary-test.c
@@ -24,7 +24,7 @@
#include "libavfilter/dnn/dnn_backend_native_layer_mathbinary.h"
#include "libavutil/avassert.h"
-#define EPSON 0.00001
+#define EPSON 0.00005
static float get_expected(float f1, float f2, DNNMathBinaryOperation op)
{
More information about the ffmpeg-cvslog
mailing list