summaryrefslogtreecommitdiff
path: root/apps/codecs/libatrac/atrac3.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libatrac/atrac3.c')
-rw-r--r--apps/codecs/libatrac/atrac3.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index b93b058bb2..f6085fa2fa 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -55,7 +55,11 @@
55#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) 55#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0)
56 56
57static VLC spectral_coeff_tab[7]; 57static VLC spectral_coeff_tab[7];
58#if defined(CPU_ARM) && (ARM_ARCH >= 5) /*ARMv5e+ uses 32x16 multiplication*/
59static int16_t qmf_window[48] IBSS_ATTR __attribute__ ((aligned (32)));
60#else
58static int32_t qmf_window[48] IBSS_ATTR; 61static int32_t qmf_window[48] IBSS_ATTR;
62#endif
59static int32_t atrac3_spectrum [2][1024] IBSS_ATTR __attribute__((aligned(16))); 63static int32_t atrac3_spectrum [2][1024] IBSS_ATTR __attribute__((aligned(16)));
60static int32_t atrac3_IMDCT_buf[2][ 512] IBSS_ATTR __attribute__((aligned(16))); 64static int32_t atrac3_IMDCT_buf[2][ 512] IBSS_ATTR __attribute__((aligned(16)));
61static int32_t atrac3_prevFrame[2][1024] IBSS_ATTR; 65static int32_t atrac3_prevFrame[2][1024] IBSS_ATTR;
@@ -118,12 +122,30 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
118 * } 122 * }
119 */ 123 */
120 124
121#if defined(CPU_ARM) 125#if defined(CPU_ARM) && (ARM_ARCH >= 5)
122 extern void 126 extern void
123 atrac3_iqmf_dewindowing(int32_t *out, 127 atrac3_iqmf_dewindowing_armv5e(int32_t *out,
124 int32_t *in, 128 int32_t *in,
125 int32_t *win, 129 int16_t *win,
126 unsigned int nIn); 130 unsigned int nIn);
131 static inline void
132 atrac3_iqmf_dewindowing(int32_t *out,
133 int32_t *in,
134 int16_t *win,
135 unsigned int nIn)
136 {
137 //atrac3_iqmf_dewindowing_armv5e(out, in, win, nIn);
138
139 }
140
141
142#elif defined(CPU_ARM)
143 extern void
144 atrac3_iqmf_dewindowing(int32_t *out,
145 int32_t *in,
146 int16_t *win,
147 unsigned int nIn);
148
127#elif defined (CPU_COLDFIRE) 149#elif defined (CPU_COLDFIRE)
128 #define MULTIPLY_ADD_BLOCK \ 150 #define MULTIPLY_ADD_BLOCK \
129 "movem.l (%[win]), %%d0-%%d7 \n\t" \ 151 "movem.l (%[win]), %%d0-%%d7 \n\t" \
@@ -206,7 +228,9 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
206 228
207 out[0] = s2; 229 out[0] = s2;
208 out[1] = s1; 230 out[1] = s1;
231
209 } 232 }
233
210 } 234 }
211#endif 235#endif
212 236
@@ -244,6 +268,7 @@ atrac3_imdct_windowing(int32_t *buffer,
244 268
245static void iqmf (int32_t *inlo, int32_t *inhi, unsigned int nIn, int32_t *pOut, int32_t *delayBuf, int32_t *temp) 269static void iqmf (int32_t *inlo, int32_t *inhi, unsigned int nIn, int32_t *pOut, int32_t *delayBuf, int32_t *temp)
246{ 270{
271
247 /* Restore the delay buffer */ 272 /* Restore the delay buffer */
248 memcpy(temp, delayBuf, 46*sizeof(int32_t)); 273 memcpy(temp, delayBuf, 46*sizeof(int32_t));
249 274
@@ -274,6 +299,7 @@ static void IMLT(int32_t *pInput, int32_t *pOutput)
274 299
275 /* Windowing. */ 300 /* Windowing. */
276 atrac3_imdct_windowing(pOutput, window_lookup); 301 atrac3_imdct_windowing(pOutput, window_lookup);
302
277} 303}
278 304
279 305
@@ -320,9 +346,13 @@ static void init_atrac3_transforms(void)
320 /* Generate the QMF window. */ 346 /* Generate the QMF window. */
321 for (i=0 ; i<24; i++) { 347 for (i=0 ; i<24; i++) {
322 s = qmf_48tap_half_fix[i] << 1; 348 s = qmf_48tap_half_fix[i] << 1;
323 qmf_window[i] = s; 349 #if defined(CPU_ARM) && (ARM_ARCH >= 5)
324 qmf_window[47 - i] = s; 350 qmf_window[i] = qmf_window[47-i] = (int16_t)((s+(1<<15))>>16);
351 #else
352 qmf_window[i] = qmf_window[47-i] = s;
353 #endif
325 } 354 }
355
326} 356}
327 357
328 358
@@ -1229,7 +1259,7 @@ int atrac3_decode_init(ATRAC3Context *q, struct mp3entry *id3)
1229 vlcs_initialized = 1; 1259 vlcs_initialized = 1;
1230 1260
1231 } 1261 }
1232 1262
1233 init_atrac3_transforms(); 1263 init_atrac3_transforms();
1234 1264
1235 /* init the joint-stereo decoding data */ 1265 /* init the joint-stereo decoding data */