summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2012-10-16 18:06:16 +0200
committerNils Wallménius <nils@rockbox.org>2012-10-16 18:07:52 +0200
commit091619b4a5cd3458e5f1a8f81d78f4234c461fcb (patch)
tree5e0b53b3821d5d06a46abc8d35864e3b555311ac
parentc8e7dae362517489dc803a2ac3279aacefe0c3bc (diff)
downloadrockbox-091619b4a5cd3458e5f1a8f81d78f4234c461fcb.tar.gz
rockbox-091619b4a5cd3458e5f1a8f81d78f4234c461fcb.zip
opus: use two pointers for mdct pre and post rotation
avoids complicated index calculations in the loops. saves 0.3MHz decoding a 64kbps test file on h300 (cf) and 0.2MHz on c200 (pp) Change-Id: I1918912d9a4502f89980c6bb270ec2ef10a07010 Signed-off-by: Nils Wallménius <nils@rockbox.org>
-rw-r--r--lib/rbcodec/codecs/libopus/celt/mdct.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/mdct.c b/lib/rbcodec/codecs/libopus/celt/mdct.c
index 0f9af9eac4..877366361d 100644
--- a/lib/rbcodec/codecs/libopus/celt/mdct.c
+++ b/lib/rbcodec/codecs/libopus/celt/mdct.c
@@ -249,17 +249,20 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
249 const kiss_fft_scalar * OPUS_RESTRICT xp1 = in; 249 const kiss_fft_scalar * OPUS_RESTRICT xp1 = in;
250 const kiss_fft_scalar * OPUS_RESTRICT xp2 = in+stride*(N2-1); 250 const kiss_fft_scalar * OPUS_RESTRICT xp2 = in+stride*(N2-1);
251 kiss_fft_scalar * OPUS_RESTRICT yp = f2; 251 kiss_fft_scalar * OPUS_RESTRICT yp = f2;
252 const kiss_twiddle_scalar *t = &l->trig[0]; 252 const kiss_twiddle_scalar *t0 = &l->trig[0];
253 const kiss_twiddle_scalar *t1 = &l->trig[N4<<shift];
253 for(i=0;i<N4;i++) 254 for(i=0;i<N4;i++)
254 { 255 {
255 kiss_fft_scalar yr, yi; 256 kiss_fft_scalar yr, yi;
256 yr = -S_MUL(*xp2, t[i<<shift]) + S_MUL(*xp1,t[(N4-i)<<shift]); 257 yr = -S_MUL(*xp2, *t0) + S_MUL(*xp1, *t1);
257 yi = -S_MUL(*xp2, t[(N4-i)<<shift]) - S_MUL(*xp1,t[i<<shift]); 258 yi = -S_MUL(*xp2, *t1) - S_MUL(*xp1, *t0);
258 /* works because the cos is nearly one */ 259 /* works because the cos is nearly one */
259 *yp++ = yr - S_MUL(yi,sine); 260 *yp++ = yr - S_MUL(yi,sine);
260 *yp++ = yi + S_MUL(yr,sine); 261 *yp++ = yi + S_MUL(yr,sine);
261 xp1+=2*stride; 262 xp1+=2*stride;
262 xp2-=2*stride; 263 xp2-=2*stride;
264 t0 += stride;
265 t1 -= stride;
263 } 266 }
264 } 267 }
265 268
@@ -269,19 +272,21 @@ void clt_mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scala
269 /* Post-rotate */ 272 /* Post-rotate */
270 { 273 {
271 kiss_fft_scalar * OPUS_RESTRICT fp = f; 274 kiss_fft_scalar * OPUS_RESTRICT fp = f;
272 const kiss_twiddle_scalar *t = &l->trig[0]; 275 const kiss_twiddle_scalar *t0 = &l->trig[0];
273 276 const kiss_twiddle_scalar *t1 = &l->trig[N4<<shift];
274 for(i=0;i<N4;i++) 277 for(i=0;i<N4;i++)
275 { 278 {
276 kiss_fft_scalar re, im, yr, yi; 279 kiss_fft_scalar re, im, yr, yi;
277 re = fp[0]; 280 re = fp[0];
278 im = fp[1]; 281 im = fp[1];
279 /* We'd scale up by 2 here, but instead it's done when mixing the windows */ 282 /* We'd scale up by 2 here, but instead it's done when mixing the windows */
280 yr = S_MUL(re,t[i<<shift]) - S_MUL(im,t[(N4-i)<<shift]); 283 yr = S_MUL(re, *t0) - S_MUL(im, *t1);
281 yi = S_MUL(im,t[i<<shift]) + S_MUL(re,t[(N4-i)<<shift]); 284 yi = S_MUL(im, *t0) + S_MUL(re, *t1);
282 /* works because the cos is nearly one */ 285 /* works because the cos is nearly one */
283 *fp++ = yr - S_MUL(yi,sine); 286 *fp++ = yr - S_MUL(yi,sine);
284 *fp++ = yi + S_MUL(yr,sine); 287 *fp++ = yi + S_MUL(yr,sine);
288 t0 += stride;
289 t1 -= stride;
285 } 290 }
286 } 291 }
287 /* De-shuffle the components for the middle of the window only */ 292 /* De-shuffle the components for the middle of the window only */