diff mbox series

[FFmpeg-devel] checkasm: sbrdsp: Fix a spurious test failure by calculating a better epsilon for sum_square

Message ID 20200205201912.9885-1-martin@martin.st
State Accepted
Headers show
Series [FFmpeg-devel] checkasm: sbrdsp: Fix a spurious test failure by calculating a better epsilon for sum_square | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Martin Storsjö Feb. 5, 2020, 8:19 p.m. UTC
---
 tests/checkasm/sbrdsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Martin Storsjö Feb. 7, 2020, 5:59 p.m. UTC | #1
On Wed, 5 Feb 2020, Martin Storsjö wrote:

> ---
> tests/checkasm/sbrdsp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c
> index 558f452c9b..516b9f0ec6 100644
> --- a/tests/checkasm/sbrdsp.c
> +++ b/tests/checkasm/sbrdsp.c
> @@ -17,6 +17,7 @@
>  */
> 
> #include "libavcodec/sbrdsp.h"
> +#include <float.h>
> 
> #include "checkasm.h"
> 
> @@ -51,13 +52,14 @@ static void test_sum_square(void)
>     INTFLOAT res0;
>     INTFLOAT res1;
>     LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]);
> +    double t = 4 * 256;
>
>     declare_func_float(INTFLOAT, INTFLOAT (*x)[2], int n);
>
>     randomize((INTFLOAT *)src, 256 * 2);
>     res0 = call_ref(src, 256);
>     res1 = call_new(src, 256);
> -    if (!float_near_abs_eps(res0, res1, EPS))
> +    if (!float_near_abs_eps(res0, res1, t * 2 * FLT_EPSILON))
>         fail();
>     bench_new(src, 256);
> }
> -- 
> 2.17.1

Will apply soon if there's no objections

// Martin
diff mbox series

Patch

diff --git a/tests/checkasm/sbrdsp.c b/tests/checkasm/sbrdsp.c
index 558f452c9b..516b9f0ec6 100644
--- a/tests/checkasm/sbrdsp.c
+++ b/tests/checkasm/sbrdsp.c
@@ -17,6 +17,7 @@ 
  */
 
 #include "libavcodec/sbrdsp.h"
+#include <float.h>
 
 #include "checkasm.h"
 
@@ -51,13 +52,14 @@  static void test_sum_square(void)
     INTFLOAT res0;
     INTFLOAT res1;
     LOCAL_ALIGNED_16(INTFLOAT, src, [256], [2]);
+    double t = 4 * 256;
 
     declare_func_float(INTFLOAT, INTFLOAT (*x)[2], int n);
 
     randomize((INTFLOAT *)src, 256 * 2);
     res0 = call_ref(src, 256);
     res1 = call_new(src, 256);
-    if (!float_near_abs_eps(res0, res1, EPS))
+    if (!float_near_abs_eps(res0, res1, t * 2 * FLT_EPSILON))
         fail();
     bench_new(src, 256);
 }