[FFmpeg-cvslog] checkasm/jpeg2000dsp: add test for ict_float
James Almer
git at videolan.org
Mon Nov 20 23:34:42 EET 2017
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sun Nov 19 00:32:24 2017 -0300| [501435e5e6459643f37596f7ab849242d0227c23] | committer: James Almer
checkasm/jpeg2000dsp: add test for ict_float
Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=501435e5e6459643f37596f7ab849242d0227c23
---
tests/checkasm/jpeg2000dsp.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tests/checkasm/jpeg2000dsp.c b/tests/checkasm/jpeg2000dsp.c
index 4251f8982a..bce534dbaf 100644
--- a/tests/checkasm/jpeg2000dsp.c
+++ b/tests/checkasm/jpeg2000dsp.c
@@ -33,6 +33,13 @@
src[i] = rnd(); \
} while (0)
+#define randomize_buffers_float() \
+ do { \
+ int i; \
+ for (i = 0; i < BUF_SIZE*3; i++) \
+ src[i] = (float)rnd() / (UINT_MAX >> 5); \
+ } while (0)
+
static void check_rct_int(void)
{
LOCAL_ALIGNED_32(int32_t, src, [BUF_SIZE*3]);
@@ -57,6 +64,30 @@ static void check_rct_int(void)
bench_new(new0, new1, new2, BUF_SIZE);
}
+static void check_ict_float(void)
+{
+ LOCAL_ALIGNED_32(float, src, [BUF_SIZE*3]);
+ LOCAL_ALIGNED_32(float, ref, [BUF_SIZE*3]);
+ LOCAL_ALIGNED_32(float, new, [BUF_SIZE*3]);
+ float *ref0 = &ref[BUF_SIZE*0], *new0 = &new[BUF_SIZE*0];
+ float *ref1 = &ref[BUF_SIZE*1], *new1 = &new[BUF_SIZE*1];
+ float *ref2 = &ref[BUF_SIZE*2], *new2 = &new[BUF_SIZE*2];
+
+ declare_func(void, void *src0, void *src1, void *src2, int csize);
+
+ randomize_buffers_float();
+ memcpy(ref, src, BUF_SIZE * 3 * sizeof(*src));
+ memcpy(new, src, BUF_SIZE * 3 * sizeof(*src));
+ call_ref(ref0, ref1, ref2, BUF_SIZE);
+ call_new(new0, new1, new2, BUF_SIZE);
+ if (!float_near_abs_eps_array(ref0, new0, 1.0e-5, BUF_SIZE) ||
+ !float_near_abs_eps_array(ref1, new1, 1.0e-5, BUF_SIZE) ||
+ !float_near_abs_eps_array(ref2, new2, 1.0e-5, BUF_SIZE))
+ fail();
+ memcpy(new, src, BUF_SIZE * 3 * sizeof(*src));
+ bench_new(new0, new1, new2, BUF_SIZE);
+}
+
void checkasm_check_jpeg2000dsp(void)
{
Jpeg2000DSPContext h;
@@ -65,6 +96,8 @@ void checkasm_check_jpeg2000dsp(void)
if (check_func(h.mct_decode[FF_DWT53], "jpeg2000_rct_int"))
check_rct_int();
+ if (check_func(h.mct_decode[FF_DWT97], "jpeg2000_ict_float"))
+ check_ict_float();
report("mct_decode");
}
More information about the ffmpeg-cvslog
mailing list