1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Index: apps/codecs/libfaad/sbr_qmf_c.h
===================================================================
--- apps/codecs/libfaad/sbr_qmf_c.h  (revision 28718)
+++ apps/codecs/libfaad/sbr_qmf_c.h  (working copy)
@@ -38,7 +38,7 @@
 #pragma warning(disable:4244)
 #endif

-ALIGN static const real_t qmf_c[640] ICONST_ATTR_FAAD_LARGE_IRAM = {
+ALIGN static const real_t qmf_c[640] ICONST_ATTR_FAAD_LARGE_IRAM MEM_ALIGN_ATTR = {
     FRAC_CONST( 0.00000000000000), FRAC_CONST( 0.00262017586902), FRAC_CONST( 0.01327182200351), FRAC_CONST( 0.07035330735093), FRAC_CONST( 0.36115899031355),
     FRAC_CONST( 0.85373856005937), FRAC_CONST(-0.36115899031355), FRAC_CONST( 0.07035330735093), FRAC_CONST(-0.01327182200351), FRAC_CONST( 0.00262017586902),
     FRAC_CONST(-0.00055252865047), FRAC_CONST( 0.00278704643465), FRAC_CONST( 0.01439046660792), FRAC_CONST( 0.06896640131951), FRAC_CONST( 0.37237955463061),
Index: apps/codecs/libfaad/sbr_dct.c
===================================================================
--- apps/codecs/libfaad/sbr_dct.c  (revision 28718)
+++ apps/codecs/libfaad/sbr_dct.c  (working copy)
@@ -1529,6 +1529,9 @@
   0, 24, 12, 22, 6, 30, 11, 19, 3, 27, 15, 21, 5, 29, 9, 17,
   1, 25, 13, 23, 7, 31, 10, 18, 2, 26, 14, 20, 4, 28, 8, 16};

+// Move to IRAM and align
+FFTComplex sbr_dct_xc[32] IBSS_ATTR MEM_ALIGN_ATTR;
+
 // Bufferfly used in dct4_kernel()'s pre- and post-processing
 #define BUTTERFLY_DCT4(out1, out2, real_part, imag_part, tab, tabidx) \
     x_re = real_part; \
@@ -1542,7 +1545,7 @@
 {
     uint32_t i, idx, tabidx;
     real_t x_re, x_im, tmp;
-    FFTComplex xc[32]; /* used for calling codeclib's fft implementation */
+    FFTComplex *xc = sbr_dct_xc; /* used for codeclib's fft implementation */

     /* Step 2: modulate and pre-rotate for codeclib's fft implementation */
     // 3*32=96 multiplications
Index: apps/codecs/liba52/imdct.c
===================================================================
--- apps/codecs/liba52/imdct.c  (revision 28718)
+++ apps/codecs/liba52/imdct.c  (working copy)
@@ -57,6 +57,9 @@
       6,134, 70,198, 38,166,230,102,246,118, 54,182, 22,150,214, 86
 };

+/* Move this biffer to IRAM and align it. */
+FFTComplex a52_fft_buf[128] IBSS_ATTR MEM_ALIGN_ATTR;
+
 /* Root values for IFFT */
 //static sample_t roots16[3];
 //static sample_t roots32[7];
@@ -263,7 +266,7 @@
     int i, k;
     sample_t t_r, t_i, a_r, a_i, b_r, b_i, w_1, w_2;
     const sample_t * window = a52_imdct_window;
-    FFTComplex buf[128];
+    FFTComplex *buf = a52_fft_buf;

     for (i = 0; i < 128; i++) {
         k = fftorder[i];
@@ -273,7 +276,7 @@
     }

     //ifft128 (buf);
-    ff_fft_calc_c(7, (FFTComplex *)&buf);
+    ff_fft_calc_c(7, buf);

     /* Post IFFT complex multiply plus IFFT complex conjugate*/
     /* Window and convert to real valued signal */
@@ -301,7 +304,8 @@
     int i, k;
     sample_t t_r, t_i, a_r, a_i, b_r, b_i, c_r, c_i, d_r, d_i, w_1, w_2;
     const sample_t * window = a52_imdct_window;
-    FFTComplex buf1[64], buf2[64];
+    FFTComplex *buf1 = a52_fft_buf;      /* Use 1st half of a52_fft_buf[128] */
+    FFTComplex *buf2 = a52_fft_buf + 64; /* Use 2nd half of a52_fft_buf[128] */

     /* Pre IFFT complex multiply plus IFFT cmplx conjugate */
     for (i = 0; i < 64; i++) {
@@ -314,8 +318,8 @@

     //ifft64 (buf1);
     //ifft64 (buf2);
-    ff_fft_calc_c(6, (FFTComplex *)&buf1);
-    ff_fft_calc_c(6, (FFTComplex *)&buf2);
+    ff_fft_calc_c(6, buf1);
+    ff_fft_calc_c(6, buf2);

     /* Post IFFT complex multiply */
     /* Window and convert to real valued signal */
Index: apps/codecs/libwmapro/wmaprodec.c
===================================================================
--- apps/codecs/libwmapro/wmaprodec.c  (revision 28718)
+++ apps/codecs/libwmapro/wmaprodec.c  (working copy)
@@ -164,9 +164,9 @@
 //static float            sin64[33];        ///< sinus table for decorrelation

 /* Global defined arrays to allow IRAM usage for some models. */
-static int32_t g_tmp[WMAPRO_BLOCK_MAX_SIZE] IBSS_ATTR_WMAPRO_LARGE_IRAM;
-static int32_t g_out_ch0[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR;
-static int32_t g_out_ch1[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR_WMAPRO_LARGE_IRAM;
+static int32_t g_tmp[WMAPRO_BLOCK_MAX_SIZE]   IBSS_ATTR_WMAPRO_LARGE_IRAM MEM_ALIGN_ATTR;
+static int32_t g_out_ch0[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR                   MEM_ALIGN_ATTR;
+static int32_t g_out_ch1[WMAPRO_OUT_BUF_SIZE] IBSS_ATTR_WMAPRO_LARGE_IRAM MEM_ALIGN_ATTR;
 #if (WMAPRO_MAX_CHANNELS > 2)
     static int32_t g_out_multichannel[WMAPRO_MAX_CHANNELS-2][WMAPRO_OUT_BUF_SIZE];
 #endif