This allows using compiler attributes for aligning the local variables,
in the cases where the compiler supports such alignment for stack variables.

libavutil/internal.h needs to include mem.h, since it uses
the DECLARE_ALIGNED macro.
---
 libavcodec/dcadec.c           |  4 ++--
 libavcodec/lpc.c              |  2 +-
 libavcodec/ra288.c            |  6 +++---
 libavutil/internal.h          |  1 +
 libavutil/tests/float_dsp.c   | 46 +++++++++++++++++++++----------------------
 libavutil/tests/lls.c         |  2 +-
 tests/checkasm/audiodsp.c     | 16 +++++++--------
 tests/checkasm/fmtconvert.c   |  6 +++---
 tests/checkasm/hevc_add_res.c |  8 ++++----
 tests/checkasm/hevc_idct.c    |  8 ++++----
 tests/checkasm/synth_filter.c | 20 +++++++++----------
 tests/checkasm/vp9dsp.c       | 12 +++++------
 12 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index fa2a240..c3c88c1 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -937,7 +937,7 @@ static int dca_filter_channels(DCAContext *s, int 
block_index, int upsample)
     int k;
 
     if (upsample) {
-        LOCAL_ALIGNED(32, float, samples, [DCA_SUBBANDS_X96K], 
[SAMPLES_PER_SUBBAND]);
+        LOCAL_ALIGNED_32(float, samples, [DCA_SUBBANDS_X96K], 
[SAMPLES_PER_SUBBAND]);
 
         if (!s->qmf64_table) {
             s->qmf64_table = qmf64_precompute();
@@ -962,7 +962,7 @@ static int dca_filter_channels(DCAContext *s, int 
block_index, int upsample)
         }
     } else {
         /* 32 subbands QMF */
-        LOCAL_ALIGNED(32, float, samples, [DCA_SUBBANDS], 
[SAMPLES_PER_SUBBAND]);
+        LOCAL_ALIGNED_32(float, samples, [DCA_SUBBANDS], 
[SAMPLES_PER_SUBBAND]);
 
         for (k = 0; k < s->audio_header.prim_channels; k++) {
             int channel = s->channel_order_tab[k];
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 1482e57..7305de6 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -204,7 +204,7 @@ int ff_lpc_calc_coefs(LPCContext *s,
 
     if (lpc_type == FF_LPC_TYPE_CHOLESKY) {
         LLSModel m[2];
-        LOCAL_ALIGNED(32, double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
+        LOCAL_ALIGNED_32(double, var, [FFALIGN(MAX_LPC_ORDER+1,4)]);
         double av_uninit(weight);
         memset(var, 0, FFALIGN(MAX_LPC_ORDER+1,4)*sizeof(*var));
 
diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c
index c457d0c..d43c39c 100644
--- a/libavcodec/ra288.c
+++ b/libavcodec/ra288.c
@@ -136,9 +136,9 @@ static void do_hybrid_window(RA288Context *ractx,
     int i;
     float buffer1[MAX_BACKWARD_FILTER_ORDER + 1];
     float buffer2[MAX_BACKWARD_FILTER_ORDER + 1];
-    LOCAL_ALIGNED(32, float, work, [FFALIGN(MAX_BACKWARD_FILTER_ORDER +
-                                            MAX_BACKWARD_FILTER_LEN   +
-                                            MAX_BACKWARD_FILTER_NONREC, 16)]);
+    LOCAL_ALIGNED_32(float, work, [FFALIGN(MAX_BACKWARD_FILTER_ORDER +
+                                           MAX_BACKWARD_FILTER_LEN   +
+                                           MAX_BACKWARD_FILTER_NONREC, 16)]);
 
     ractx->fdsp.vector_fmul(work, window, hist, FFALIGN(order + n + non_rec, 
16));
 
diff --git a/libavutil/internal.h b/libavutil/internal.h
index d96762c..fcec798 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -38,6 +38,7 @@
 #include "attributes.h"
 #include "dict.h"
 #include "macros.h"
+#include "mem.h"
 #include "pixfmt.h"
 
 #if ARCH_X86
diff --git a/libavutil/tests/float_dsp.c b/libavutil/tests/float_dsp.c
index ab6bf6a..17728e0 100644
--- a/libavutil/tests/float_dsp.c
+++ b/libavutil/tests/float_dsp.c
@@ -85,8 +85,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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);
@@ -102,8 +102,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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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));
@@ -121,8 +121,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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);
@@ -137,8 +137,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, double, cdst, [LEN]);
-    LOCAL_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);
@@ -154,8 +154,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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);
@@ -171,8 +171,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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);
@@ -187,8 +187,8 @@ 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)
 {
-    LOCAL_ALIGNED(32, float, cdst, [LEN]);
-    LOCAL_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);
@@ -203,10 +203,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)
 {
-    LOCAL_ALIGNED(32, float, cv1, [LEN]);
-    LOCAL_ALIGNED(32, float, cv2, [LEN]);
-    LOCAL_ALIGNED(32, float, ov1, [LEN]);
-    LOCAL_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));
@@ -247,11 +247,11 @@ int main(int argc, char **argv)
     AVFloatDSPContext fdsp, cdsp;
     AVLFG lfg;
 
-    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]);
+    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);
diff --git a/libavutil/tests/lls.c b/libavutil/tests/lls.c
index 7866b38..d2bb465 100644
--- a/libavutil/tests/lls.c
+++ b/libavutil/tests/lls.c
@@ -33,7 +33,7 @@ int main(void)
     avpriv_init_lls(&m, 3);
 
     for (i = 0; i < 100; i++) {
-        LOCAL_ALIGNED(32, double, var, [4]);
+        LOCAL_ALIGNED_32(double, var, [4]);
         double eval;
 
         var[0] =         (av_lfg_get(&lfg) / (double) UINT_MAX - 0.5) * 2;
diff --git a/tests/checkasm/audiodsp.c b/tests/checkasm/audiodsp.c
index 40fa384..9187769 100644
--- a/tests/checkasm/audiodsp.c
+++ b/tests/checkasm/audiodsp.c
@@ -55,8 +55,8 @@ void checkasm_check_audiodsp(void)
     ff_audiodsp_init(&adsp);
 
     if (check_func(adsp.scalarproduct_int16, "audiodsp.scalarproduct_int16")) {
-        LOCAL_ALIGNED(32, int16_t, v1, [MAX_SIZE]);
-        LOCAL_ALIGNED(32, int16_t, v2, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(int16_t, v1, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(int16_t, v2, [MAX_SIZE]);
         unsigned int len_bits_minus4, v1_bits, v2_bits, len;
         int32_t res0, res1;
 
@@ -83,9 +83,9 @@ void checkasm_check_audiodsp(void)
     }
 
     if (check_func(adsp.vector_clip_int32, "audiodsp.vector_clip_int32")) {
-        LOCAL_ALIGNED(32, int32_t, src,  [MAX_SIZE]);
-        LOCAL_ALIGNED(32, int32_t, dst0, [MAX_SIZE]);
-        LOCAL_ALIGNED(32, int32_t, dst1, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(int32_t, src,  [MAX_SIZE]);
+        LOCAL_ALIGNED_32(int32_t, dst0, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(int32_t, dst1, [MAX_SIZE]);
         int32_t val1, val2, min, max;
         int len;
 
@@ -113,9 +113,9 @@ void checkasm_check_audiodsp(void)
     }
 
     if (check_func(adsp.vector_clipf, "audiodsp.vector_clipf")) {
-        LOCAL_ALIGNED(32, float, src, [MAX_SIZE]);
-        LOCAL_ALIGNED(32, float, dst0, [MAX_SIZE]);
-        LOCAL_ALIGNED(32, float, dst1, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(float, src, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(float, dst0, [MAX_SIZE]);
+        LOCAL_ALIGNED_32(float, dst1, [MAX_SIZE]);
         float val1, val2, min, max;
         int i, len;
 
diff --git a/tests/checkasm/fmtconvert.c b/tests/checkasm/fmtconvert.c
index 1a843b0..c4baa47 100644
--- a/tests/checkasm/fmtconvert.c
+++ b/tests/checkasm/fmtconvert.c
@@ -44,9 +44,9 @@
 void checkasm_check_fmtconvert(void)
 {
     FmtConvertContext c;
-    LOCAL_ALIGNED(32, float,   dst0, [BUF_SIZE]);
-    LOCAL_ALIGNED(32, float,   dst1, [BUF_SIZE]);
-    LOCAL_ALIGNED(32, int32_t, in,   [BUF_SIZE]);
+    LOCAL_ALIGNED_32(float,   dst0, [BUF_SIZE]);
+    LOCAL_ALIGNED_32(float,   dst1, [BUF_SIZE]);
+    LOCAL_ALIGNED_32(int32_t, in,   [BUF_SIZE]);
     float scale_arr[128];
     int length[] = {8, 16, 24, 56, 72, 128, 512, 520, 656, 768, 992};
     int i, j;
diff --git a/tests/checkasm/hevc_add_res.c b/tests/checkasm/hevc_add_res.c
index 2cd97ea..b25f2f5 100644
--- a/tests/checkasm/hevc_add_res.c
+++ b/tests/checkasm/hevc_add_res.c
@@ -45,10 +45,10 @@
 static void check_add_res(HEVCDSPContext h, int bit_depth)
 {
     int i;
-    LOCAL_ALIGNED(32, int16_t, res0, [32 * 32]);
-    LOCAL_ALIGNED(32, int16_t, res1, [32 * 32]);
-    LOCAL_ALIGNED(32, uint8_t, dst0, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, uint8_t, dst1, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(int16_t, res0, [32 * 32]);
+    LOCAL_ALIGNED_32(int16_t, res1, [32 * 32]);
+    LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]);
 
     for (i = 2; i <= 5; i++) {
         int block_size = 1 << i;
diff --git a/tests/checkasm/hevc_idct.c b/tests/checkasm/hevc_idct.c
index dd4dc0d..939c5d8 100644
--- a/tests/checkasm/hevc_idct.c
+++ b/tests/checkasm/hevc_idct.c
@@ -38,8 +38,8 @@
 static void check_idct(HEVCDSPContext h, int bit_depth)
 {
     int i;
-    LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]);
-    LOCAL_ALIGNED(32, int16_t, coeffs1, [32 * 32]);
+    LOCAL_ALIGNED_32(int16_t, coeffs0, [32 * 32]);
+    LOCAL_ALIGNED_32(int16_t, coeffs1, [32 * 32]);
 
     for (i = 2; i <= 5; i++) {
         int block_size = 1 << i;
@@ -62,8 +62,8 @@ static void check_idct(HEVCDSPContext h, int bit_depth)
 static void check_idct_dc(HEVCDSPContext h, int bit_depth)
 {
     int i;
-    LOCAL_ALIGNED(32, int16_t, coeffs0, [32 * 32]);
-    LOCAL_ALIGNED(32, int16_t, coeffs1, [32 * 32]);
+    LOCAL_ALIGNED_32(int16_t, coeffs0, [32 * 32]);
+    LOCAL_ALIGNED_32(int16_t, coeffs1, [32 * 32]);
 
     for (i = 2; i <= 5; i++) {
         int block_size = 1 << i;
diff --git a/tests/checkasm/synth_filter.c b/tests/checkasm/synth_filter.c
index 157400b..5a2a920 100644
--- a/tests/checkasm/synth_filter.c
+++ b/tests/checkasm/synth_filter.c
@@ -50,16 +50,16 @@ void checkasm_check_synth_filter(void)
     ff_synth_filter_init(&synth);
 
     if (check_func(synth.synth_filter_float, "synth_filter_float")) {
-        LOCAL_ALIGNED(32, float,   out0,   [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   out1,   [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   out_b,  [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   in,     [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   buf2_0, [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   buf2_1, [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   buf2_b, [BUF_SIZE]);
-        LOCAL_ALIGNED(32, float,   buf0,   [512]);
-        LOCAL_ALIGNED(32, float,   buf1,   [512]);
-        LOCAL_ALIGNED(32, float,   buf_b,  [512]);
+        LOCAL_ALIGNED_32(float,   out0,   [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   out1,   [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   out_b,  [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   in,     [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   buf2_0, [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   buf2_1, [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   buf2_b, [BUF_SIZE]);
+        LOCAL_ALIGNED_32(float,   buf0,   [512]);
+        LOCAL_ALIGNED_32(float,   buf1,   [512]);
+        LOCAL_ALIGNED_32(float,   buf_b,  [512]);
         float scale = 1.0f;
         int i, offset0 = 0, offset1 = 0, offset_b = 0;
 
diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c
index 39b82e1..4289055 100644
--- a/tests/checkasm/vp9dsp.c
+++ b/tests/checkasm/vp9dsp.c
@@ -248,12 +248,12 @@ static int iszero(const int16_t *c, int sz)
 static void check_itxfm(void)
 {
     LOCAL_ALIGNED_32(uint8_t, src, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, uint8_t, dst, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, uint8_t, dst0, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, uint8_t, dst1, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, int16_t, coef, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, int16_t, subcoef0, [32 * 32 * 2]);
-    LOCAL_ALIGNED(32, int16_t, subcoef1, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst0, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(uint8_t, dst1, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(int16_t, coef, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(int16_t, subcoef0, [32 * 32 * 2]);
+    LOCAL_ALIGNED_32(int16_t, subcoef1, [32 * 32 * 2]);
     declare_func(void, uint8_t *dst, ptrdiff_t stride, int16_t *block, int 
eob);
     VP9DSPContext dsp;
     int y, x, tx, txtp, sub;
-- 
2.7.4

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to