summaryrefslogtreecommitdiff
path: root/apps/codecs/libatrac/atrac3.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2010-07-26 17:22:35 +0000
committerNils Wallménius <nils@rockbox.org>2010-07-26 17:22:35 +0000
commit6087d8960328b427f495d46d74664a4b0e32af17 (patch)
treeb0cd37c7a5df7f6df4a3a0ced9fac855e56dffdb /apps/codecs/libatrac/atrac3.c
parent767c4effc18778672df9d7ef475174bc6af95822 (diff)
downloadrockbox-6087d8960328b427f495d46d74664a4b0e32af17.tar.gz
rockbox-6087d8960328b427f495d46d74664a4b0e32af17.zip
libatrac: Coldfire asm for atrac3_iqmf_dewindowing, speeds up decoding of my atrac3 rm file by 45%. Based on preliminary patch by Andree Buschmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27578 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libatrac/atrac3.c')
-rw-r--r--apps/codecs/libatrac/atrac3.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/apps/codecs/libatrac/atrac3.c b/apps/codecs/libatrac/atrac3.c
index 4c0b7d079f..b93b058bb2 100644
--- a/apps/codecs/libatrac/atrac3.c
+++ b/apps/codecs/libatrac/atrac3.c
@@ -124,6 +124,57 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
124 int32_t *in, 124 int32_t *in,
125 int32_t *win, 125 int32_t *win,
126 unsigned int nIn); 126 unsigned int nIn);
127#elif defined (CPU_COLDFIRE)
128 #define MULTIPLY_ADD_BLOCK \
129 "movem.l (%[win]), %%d0-%%d7 \n\t" \
130 "lea.l (8*4, %[win]), %[win] \n\t" \
131 "mac.l %%d0, %%a5, (%[in])+, %%a5, %%acc0\n\t" \
132 "mac.l %%d1, %%a5, (%[in])+, %%a5, %%acc1\n\t" \
133 "mac.l %%d2, %%a5, (%[in])+, %%a5, %%acc0\n\t" \
134 "mac.l %%d3, %%a5, (%[in])+, %%a5, %%acc1\n\t" \
135 "mac.l %%d4, %%a5, (%[in])+, %%a5, %%acc0\n\t" \
136 "mac.l %%d5, %%a5, (%[in])+, %%a5, %%acc1\n\t" \
137 "mac.l %%d6, %%a5, (%[in])+, %%a5, %%acc0\n\t" \
138 "mac.l %%d7, %%a5, (%[in])+, %%a5, %%acc1\n\t" \
139
140
141 static inline void
142 atrac3_iqmf_dewindowing(int32_t *out,
143 int32_t *in,
144 int32_t *win,
145 unsigned int nIn)
146 {
147 int32_t j;
148 int32_t *_in, *_win;
149 for (j = nIn; j != 0; j--, in+=2, out+=2) {
150 _in = in;
151 _win = win;
152
153 asm volatile (
154 "move.l (%[in])+, %%a5 \n\t" /* preload frist in value */
155 MULTIPLY_ADD_BLOCK /* 0.. 7 */
156 MULTIPLY_ADD_BLOCK /* 8..15 */
157 MULTIPLY_ADD_BLOCK /* 16..23 */
158 MULTIPLY_ADD_BLOCK /* 24..31 */
159 MULTIPLY_ADD_BLOCK /* 32..39 */
160 /* 40..47 */
161 "movem.l (%[win]), %%d0-%%d7 \n\t"
162 "mac.l %%d0, %%a5, (%[in])+, %%a5, %%acc0 \n\t"
163 "mac.l %%d1, %%a5, (%[in])+, %%a5, %%acc1 \n\t"
164 "mac.l %%d2, %%a5, (%[in])+, %%a5, %%acc0 \n\t"
165 "mac.l %%d3, %%a5, (%[in])+, %%a5, %%acc1 \n\t"
166 "mac.l %%d4, %%a5, (%[in])+, %%a5, %%acc0 \n\t"
167 "mac.l %%d5, %%a5, (%[in])+, %%a5, %%acc1 \n\t"
168 "mac.l %%d6, %%a5, (%[in])+, %%a5, %%acc0 \n\t"
169 "mac.l %%d7, %%a5, %%acc1 \n\t"
170 "movclr.l %%acc0, %%d1 \n\t" /* s1 */
171 "movclr.l %%acc1, %%d0 \n\t" /* s2 */
172 "movem.l %%d0-%%d1, (%[out]) \n\t"
173 : [in] "+a" (_in), [win] "+a" (_win)
174 : [out] "a" (out)
175 : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "a5", "memory");
176 }
177 }
127#else 178#else
128 #define MULTIPLY_ADD_BLOCK(y1, y2, x, c, k) \ 179 #define MULTIPLY_ADD_BLOCK(y1, y2, x, c, k) \
129 y1 += fixmul31(c[k], x[k]); k++; \ 180 y1 += fixmul31(c[k], x[k]); k++; \
@@ -134,7 +185,7 @@ static channel_unit channel_units[2] IBSS_ATTR_LARGE_IRAM;
134 y2 += fixmul31(c[k], x[k]); k++; \ 185 y2 += fixmul31(c[k], x[k]); k++; \
135 y1 += fixmul31(c[k], x[k]); k++; \ 186 y1 += fixmul31(c[k], x[k]); k++; \
136 y2 += fixmul31(c[k], x[k]); k++; 187 y2 += fixmul31(c[k], x[k]); k++;
137 188
138 static inline void 189 static inline void
139 atrac3_iqmf_dewindowing(int32_t *out, 190 atrac3_iqmf_dewindowing(int32_t *out,
140 int32_t *in, 191 int32_t *in,