diff mbox series

[FFmpeg-devel,3/3] checkasm/vf_gblur: add a test for postscale_slice

Message ID 20210217164106.6370-3-jamrial@gmail.com
State Accepted
Commit bea7c513079a811512da378730366d80f8155f2d
Headers show
Series [FFmpeg-devel,1/3] x86/vf_gblur: fix postscale_slice prologue | expand

Checks

Context Check Description
andriy/configure warning Failed to apply patch

Commit Message

James Almer Feb. 17, 2021, 4:41 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 tests/checkasm/vf_gblur.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Comments

Paul B Mahol Feb. 17, 2021, 4:47 p.m. UTC | #1
probably ok if tested
James Almer Feb. 17, 2021, 5:03 p.m. UTC | #2
On 2/17/2021 1:47 PM, Paul B Mahol wrote:
> probably ok if tested

Set pushed. Thanks.
diff mbox series

Patch

diff --git a/tests/checkasm/vf_gblur.c b/tests/checkasm/vf_gblur.c
index 8ff47a338f..b9fe2f9a36 100644
--- a/tests/checkasm/vf_gblur.c
+++ b/tests/checkasm/vf_gblur.c
@@ -16,6 +16,7 @@ 
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <float.h>
 #include <string.h>
 #include "checkasm.h"
 #include "libavfilter/gblur.h"
@@ -48,6 +49,19 @@  static void check_horiz_slice(float *dst_ref, float *dst_new)
     bench_new(dst_new, WIDTH, HEIGHT, 1, nu, bscale);
 }
 
+static void check_postscale_slice(float *dst_ref, float *dst_new)
+{
+    float postscale = 0.0603f;
+
+    declare_func(void, float *dst, int len, float postscale, float min, float max);
+    call_ref(dst_ref, PIXELS, postscale, -FLT_MAX, FLT_MAX);
+    call_new(dst_new, PIXELS, postscale, -FLT_MAX, FLT_MAX);
+    if (!float_near_abs_eps_array(dst_ref, dst_new, FLT_EPSILON, PIXELS)) {
+        fail();
+    }
+    bench_new(dst_new, PIXELS, postscale, -FLT_MAX, FLT_MAX);
+}
+
 void checkasm_check_vf_gblur(void)
 {
     float *dst_ref = av_malloc(BUF_SIZE);
@@ -63,6 +77,14 @@  void checkasm_check_vf_gblur(void)
         check_horiz_slice(dst_ref, dst_new);
     }
     report("horiz_slice");
+
+    randomize_buffers(dst_ref, PIXELS);
+    memcpy(dst_new, dst_ref, BUF_SIZE);
+    if (check_func(s.postscale_slice, "postscale_slice")) {
+        check_postscale_slice(dst_ref, dst_new);
+    }
+    report("postscale_slice");
+
     av_freep(&dst_ref);
     av_freep(&dst_new);
 }