]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/float_dsp.c
lavc: Update version and APIchanges
[ffmpeg] / libavutil / float_dsp.c
index 23468ad0b9831ad7bcf6629d4484de433680c9fc..aabc800db642931a51b40e0615b3b333a3df1a3b 100644 (file)
@@ -124,15 +124,14 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
     fdsp->butterflies_float = butterflies_float_c;
     fdsp->scalarproduct_float = avpriv_scalarproduct_float_c;
 
-#if   ARCH_AARCH64
-    ff_float_dsp_init_aarch64(fdsp);
-#elif ARCH_ARM
-    ff_float_dsp_init_arm(fdsp);
-#elif ARCH_PPC
-    ff_float_dsp_init_ppc(fdsp, bit_exact);
-#elif ARCH_X86
-    ff_float_dsp_init_x86(fdsp);
-#endif
+    if (ARCH_AARCH64)
+        ff_float_dsp_init_aarch64(fdsp);
+    if (ARCH_ARM)
+        ff_float_dsp_init_arm(fdsp);
+    if (ARCH_PPC)
+        ff_float_dsp_init_ppc(fdsp, bit_exact);
+    if (ARCH_X86)
+        ff_float_dsp_init_x86(fdsp);
 }
 
 #ifdef TEST
@@ -143,7 +142,9 @@ av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact)
 #include <stdlib.h>
 #include <string.h>
 
+#include "common.h"
 #include "cpu.h"
+#include "internal.h"
 #include "lfg.h"
 #include "log.h"
 #include "mem.h"
@@ -206,15 +207,15 @@ static int compare_doubles(const double *a, const double *b, int len,
 static int test_vector_fmul(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                             const float *v1, const float *v2)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     cdsp->vector_fmul(cdst, v1, v2, LEN);
     fdsp->vector_fmul(odst, v1, v2, LEN);
 
     if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmul failed\n");
 
     return ret;
 }
@@ -223,8 +224,8 @@ static int test_vector_fmul(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
 static int test_vector_fmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                    const float *v1, const float *src0, float scale)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     memcpy(cdst, v1, LEN * sizeof(*v1));
@@ -234,7 +235,7 @@ static int test_vector_fmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
     fdsp->vector_fmac_scalar(odst, src0, scale, LEN);
 
     if (ret = compare_floats(cdst, odst, LEN, ARBITRARY_FMAC_SCALAR_CONST))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmac_scalar failed\n");
 
     return ret;
 }
@@ -242,15 +243,15 @@ static int test_vector_fmac_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
 static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                    const float *v1, float scale)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     cdsp->vector_fmul_scalar(cdst, v1, scale, LEN);
     fdsp->vector_fmul_scalar(odst, v1, scale, LEN);
 
     if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_scalar failed\n");
 
     return ret;
 }
@@ -258,15 +259,15 @@ static int test_vector_fmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
 static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                    const double *v1, double scale)
 {
-    DECLARE_ALIGNED(32, double, cdst)[LEN];
-    DECLARE_ALIGNED(32, double, odst)[LEN];
+    LOCAL_ALIGNED(32, double, cdst, [LEN]);
+    LOCAL_ALIGNED(32, double, odst, [LEN]);
     int ret;
 
     cdsp->vector_dmul_scalar(cdst, v1, scale, LEN);
     fdsp->vector_dmul_scalar(odst, v1, scale, LEN);
 
     if (ret = compare_doubles(cdst, odst, LEN, DBL_EPSILON))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_dmul_scalar failed\n");
 
     return ret;
 }
@@ -275,15 +276,15 @@ static int test_vector_dmul_scalar(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
 static int test_vector_fmul_window(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                    const float *v1, const float *v2, const float *v3)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     cdsp->vector_fmul_window(cdst, v1, v2, v3, LEN / 2);
     fdsp->vector_fmul_window(odst, v1, v2, v3, LEN / 2);
 
     if (ret = compare_floats(cdst, odst, LEN, ARBITRARY_FMUL_WINDOW_CONST))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_window failed\n");
 
     return ret;
 }
@@ -292,15 +293,15 @@ static int test_vector_fmul_window(AVFloatDSPContext *fdsp, AVFloatDSPContext *c
 static int test_vector_fmul_add(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                 const float *v1, const float *v2, const float *v3)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     cdsp->vector_fmul_add(cdst, v1, v2, v3, LEN);
     fdsp->vector_fmul_add(odst, v1, v2, v3, LEN);
 
     if (ret = compare_floats(cdst, odst, LEN, ARBITRARY_FMUL_ADD_CONST))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_add failed\n");
 
     return ret;
 }
@@ -308,15 +309,15 @@ static int test_vector_fmul_add(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp
 static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                     const float *v1, const float *v2)
 {
-    DECLARE_ALIGNED(32, float, cdst)[LEN];
-    DECLARE_ALIGNED(32, float, odst)[LEN];
+    LOCAL_ALIGNED(32, float, cdst, [LEN]);
+    LOCAL_ALIGNED(32, float, odst, [LEN]);
     int ret;
 
     cdsp->vector_fmul_reverse(cdst, v1, v2, LEN);
     fdsp->vector_fmul_reverse(odst, v1, v2, LEN);
 
     if (ret = compare_floats(cdst, odst, LEN, FLT_EPSILON))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "vector_fmul_reverse failed\n");
 
     return ret;
 }
@@ -324,10 +325,10 @@ static int test_vector_fmul_reverse(AVFloatDSPContext *fdsp, AVFloatDSPContext *
 static int test_butterflies_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cdsp,
                                   const float *v1, const float *v2)
 {
-    DECLARE_ALIGNED(32, float, cv1)[LEN];
-    DECLARE_ALIGNED(32, float, cv2)[LEN];
-    DECLARE_ALIGNED(32, float, ov1)[LEN];
-    DECLARE_ALIGNED(32, float, ov2)[LEN];
+    LOCAL_ALIGNED(32, float, cv1, [LEN]);
+    LOCAL_ALIGNED(32, float, cv2, [LEN]);
+    LOCAL_ALIGNED(32, float, ov1, [LEN]);
+    LOCAL_ALIGNED(32, float, ov2, [LEN]);
     int ret;
 
     memcpy(cv1, v1, LEN * sizeof(*v1));
@@ -340,7 +341,7 @@ static int test_butterflies_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *cd
 
     if ((ret = compare_floats(cv1, ov1, LEN, FLT_EPSILON)) ||
         (ret = compare_floats(cv2, ov2, LEN, FLT_EPSILON)))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "butterflies_float failed\n");
 
     return ret;
 }
@@ -356,7 +357,7 @@ static int test_scalarproduct_float(AVFloatDSPContext *fdsp, AVFloatDSPContext *
     oprod = fdsp->scalarproduct_float(v1, v2, LEN);
 
     if (ret = compare_floats(&cprod, &oprod, 1, ARBITRARY_SCALARPRODUCT_CONST))
-        av_log(NULL, AV_LOG_ERROR, "%s failed\n", __func__);
+        av_log(NULL, AV_LOG_ERROR, "scalarproduct_float failed\n");
 
     return ret;
 }
@@ -368,11 +369,11 @@ int main(int argc, char **argv)
     AVFloatDSPContext fdsp, cdsp;
     AVLFG lfg;
 
-    DECLARE_ALIGNED(32, float, src0)[LEN];
-    DECLARE_ALIGNED(32, float, src1)[LEN];
-    DECLARE_ALIGNED(32, float, src2)[LEN];
-    DECLARE_ALIGNED(32, double, dbl_src0)[LEN];
-    DECLARE_ALIGNED(32, double, dbl_src1)[LEN];
+    LOCAL_ALIGNED(32, float, src0, [LEN]);
+    LOCAL_ALIGNED(32, float, src1, [LEN]);
+    LOCAL_ALIGNED(32, float, src2, [LEN]);
+    LOCAL_ALIGNED(32, double, dbl_src0, [LEN]);
+    LOCAL_ALIGNED(32, double, dbl_src1, [LEN]);
 
     if (argc > 2 && !strcmp(argv[1], "-s"))
         seed = strtoul(argv[2], NULL, 10);