summaryrefslogtreecommitdiff
path: root/libavutil/tests
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-04-10 12:12:55 -0300
committerJames Almer <jamrial@gmail.com>2017-04-10 12:16:30 -0300
commit128e1fbf1335d23425609cfae3fae8d63170f875 (patch)
treede120b46e0919972d0313210862a6a702d06b4fa /libavutil/tests
parent0da3c568fd4924aaac79e7ddacd11c88fb3cb090 (diff)
avutil/float_dsp: add test for vector_dmac_scalar
Diffstat (limited to 'libavutil/tests')
-rw-r--r--libavutil/tests/float_dsp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/libavutil/tests/float_dsp.c b/libavutil/tests/float_dsp.c
index 053324dd38..7dc98c548e 100644
--- a/libavutil/tests/float_dsp.c
+++ b/libavutil/tests/float_dsp.c
@@ -144,6 +144,26 @@ static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
return ret;
}
+#define ARBITRARY_DMAC_SCALAR_CONST 0.005
+static int test_vector_dmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
+ const double *v1, const double *src0, double scale)
+{
+ LOCAL_ALIGNED(32, double, cdst, [LEN]);
+ LOCAL_ALIGNED(32, double, odst, [LEN]);
+ int ret;
+
+ memcpy(cdst, v1, LEN * sizeof(*v1));
+ memcpy(odst, v1, LEN * sizeof(*v1));
+
+ cdsp->vector_dmac_scalar(cdst, src0, scale, LEN);
+ fdsp->vector_dmac_scalar(odst, src0, scale, LEN);
+
+ if (ret = compare_doubles(cdst, odst, LEN, ARBITRARY_DMAC_SCALAR_CONST))
+ av_log(NULL, AV_LOG_ERROR, "vector_dmac_scalar failed\n");
+
+ return ret;
+}
+
static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
const double *v1, double scale)
{
@@ -262,6 +282,7 @@ int main(int argc, char **argv)
LOCAL_ALIGNED(32, float, src2, [LEN]);
LOCAL_ALIGNED(32, double, dbl_src0, [LEN]);
LOCAL_ALIGNED(32, double, dbl_src1, [LEN]);
+ LOCAL_ALIGNED(32, double, dbl_src2, [LEN]);
for (;;) {
int arg = getopt(argc, argv, "s:c:");
@@ -306,6 +327,7 @@ int main(int argc, char **argv)
fill_double_array(&lfg, dbl_src0, LEN);
fill_double_array(&lfg, dbl_src1, LEN);
+ fill_double_array(&lfg, dbl_src2, LEN);
if (test_vector_fmul(fdsp, cdsp, src0, src1))
ret -= 1 << 0;
@@ -325,6 +347,8 @@ int main(int argc, char **argv)
ret -= 1 << 7;
if (test_vector_dmul_scalar(fdsp, cdsp, dbl_src0, dbl_src1[0]))
ret -= 1 << 8;
+ if (test_vector_dmac_scalar(fdsp, cdsp, dbl_src2, dbl_src0, dbl_src1[0]))
+ ret -= 1 << 9;
end:
av_freep(&fdsp);