| OLD | NEW |
| 1 /* Copyright (c) 2007-2008 CSIRO | 1 /* Copyright (c) 2007-2008 CSIRO |
| 2 Copyright (c) 2007-2008 Xiph.Org Foundation | 2 Copyright (c) 2007-2008 Xiph.Org Foundation |
| 3 Written by Jean-Marc Valin */ | 3 Written by Jean-Marc Valin */ |
| 4 /* | 4 /* |
| 5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
| 6 modification, are permitted provided that the following conditions | 6 modification, are permitted provided that the following conditions |
| 7 are met: | 7 are met: |
| 8 | 8 |
| 9 - Redistributions of source code must retain the above copyright | 9 - Redistributions of source code must retain the above copyright |
| 10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 const kiss_fft_scalar * OPUS_RESTRICT xp1 = in; | 263 const kiss_fft_scalar * OPUS_RESTRICT xp1 = in; |
| 264 const kiss_fft_scalar * OPUS_RESTRICT xp2 = in+stride*(N2-1); | 264 const kiss_fft_scalar * OPUS_RESTRICT xp2 = in+stride*(N2-1); |
| 265 kiss_fft_scalar * OPUS_RESTRICT yp = out+(overlap>>1); | 265 kiss_fft_scalar * OPUS_RESTRICT yp = out+(overlap>>1); |
| 266 const kiss_twiddle_scalar * OPUS_RESTRICT t = &trig[0]; | 266 const kiss_twiddle_scalar * OPUS_RESTRICT t = &trig[0]; |
| 267 const opus_int16 * OPUS_RESTRICT bitrev = l->kfft[shift]->bitrev; | 267 const opus_int16 * OPUS_RESTRICT bitrev = l->kfft[shift]->bitrev; |
| 268 for(i=0;i<N4;i++) | 268 for(i=0;i<N4;i++) |
| 269 { | 269 { |
| 270 int rev; | 270 int rev; |
| 271 kiss_fft_scalar yr, yi; | 271 kiss_fft_scalar yr, yi; |
| 272 rev = *bitrev++; | 272 rev = *bitrev++; |
| 273 yr = S_MUL(*xp2, t[i]) + S_MUL(*xp1, t[N4+i]); | 273 yr = ADD32_ovflw(S_MUL(*xp2, t[i]), S_MUL(*xp1, t[N4+i])); |
| 274 yi = S_MUL(*xp1, t[i]) - S_MUL(*xp2, t[N4+i]); | 274 yi = SUB32_ovflw(S_MUL(*xp1, t[i]), S_MUL(*xp2, t[N4+i])); |
| 275 /* We swap real and imag because we use an FFT instead of an IFFT. */ | 275 /* We swap real and imag because we use an FFT instead of an IFFT. */ |
| 276 yp[2*rev+1] = yr; | 276 yp[2*rev+1] = yr; |
| 277 yp[2*rev] = yi; | 277 yp[2*rev] = yi; |
| 278 /* Storing the pre-rotation directly in the bitrev order. */ | 278 /* Storing the pre-rotation directly in the bitrev order. */ |
| 279 xp1+=2*stride; | 279 xp1+=2*stride; |
| 280 xp2-=2*stride; | 280 xp2-=2*stride; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 opus_fft_impl(l->kfft[shift], (kiss_fft_cpx*)(out+(overlap>>1))); | 284 opus_fft_impl(l->kfft[shift], (kiss_fft_cpx*)(out+(overlap>>1))); |
| 285 | 285 |
| 286 /* Post-rotate and de-shuffle from both ends of the buffer at once to make | 286 /* Post-rotate and de-shuffle from both ends of the buffer at once to make |
| 287 it in-place. */ | 287 it in-place. */ |
| 288 { | 288 { |
| 289 kiss_fft_scalar * yp0 = out+(overlap>>1); | 289 kiss_fft_scalar * yp0 = out+(overlap>>1); |
| 290 kiss_fft_scalar * yp1 = out+(overlap>>1)+N2-2; | 290 kiss_fft_scalar * yp1 = out+(overlap>>1)+N2-2; |
| 291 const kiss_twiddle_scalar *t = &trig[0]; | 291 const kiss_twiddle_scalar *t = &trig[0]; |
| 292 /* Loop to (N4+1)>>1 to handle odd N4. When N4 is odd, the | 292 /* Loop to (N4+1)>>1 to handle odd N4. When N4 is odd, the |
| 293 middle pair will be computed twice. */ | 293 middle pair will be computed twice. */ |
| 294 for(i=0;i<(N4+1)>>1;i++) | 294 for(i=0;i<(N4+1)>>1;i++) |
| 295 { | 295 { |
| 296 kiss_fft_scalar re, im, yr, yi; | 296 kiss_fft_scalar re, im, yr, yi; |
| 297 kiss_twiddle_scalar t0, t1; | 297 kiss_twiddle_scalar t0, t1; |
| 298 /* We swap real and imag because we're using an FFT instead of an IFFT.
*/ | 298 /* We swap real and imag because we're using an FFT instead of an IFFT.
*/ |
| 299 re = yp0[1]; | 299 re = yp0[1]; |
| 300 im = yp0[0]; | 300 im = yp0[0]; |
| 301 t0 = t[i]; | 301 t0 = t[i]; |
| 302 t1 = t[N4+i]; | 302 t1 = t[N4+i]; |
| 303 /* We'd scale up by 2 here, but instead it's done when mixing the windo
ws */ | 303 /* We'd scale up by 2 here, but instead it's done when mixing the windo
ws */ |
| 304 yr = S_MUL(re,t0) + S_MUL(im,t1); | 304 yr = ADD32_ovflw(S_MUL(re,t0), S_MUL(im,t1)); |
| 305 yi = S_MUL(re,t1) - S_MUL(im,t0); | 305 yi = SUB32_ovflw(S_MUL(re,t1), S_MUL(im,t0)); |
| 306 /* We swap real and imag because we're using an FFT instead of an IFFT.
*/ | 306 /* We swap real and imag because we're using an FFT instead of an IFFT.
*/ |
| 307 re = yp1[1]; | 307 re = yp1[1]; |
| 308 im = yp1[0]; | 308 im = yp1[0]; |
| 309 yp0[0] = yr; | 309 yp0[0] = yr; |
| 310 yp1[1] = yi; | 310 yp1[1] = yi; |
| 311 | 311 |
| 312 t0 = t[(N4-i-1)]; | 312 t0 = t[(N4-i-1)]; |
| 313 t1 = t[(N2-i-1)]; | 313 t1 = t[(N2-i-1)]; |
| 314 /* We'd scale up by 2 here, but instead it's done when mixing the windo
ws */ | 314 /* We'd scale up by 2 here, but instead it's done when mixing the windo
ws */ |
| 315 yr = S_MUL(re,t0) + S_MUL(im,t1); | 315 yr = ADD32_ovflw(S_MUL(re,t0), S_MUL(im,t1)); |
| 316 yi = S_MUL(re,t1) - S_MUL(im,t0); | 316 yi = SUB32_ovflw(S_MUL(re,t1), S_MUL(im,t0)); |
| 317 yp1[0] = yr; | 317 yp1[0] = yr; |
| 318 yp0[1] = yi; | 318 yp0[1] = yi; |
| 319 yp0 += 2; | 319 yp0 += 2; |
| 320 yp1 -= 2; | 320 yp1 -= 2; |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 /* Mirror on both sides for TDAC */ | 324 /* Mirror on both sides for TDAC */ |
| 325 { | 325 { |
| 326 kiss_fft_scalar * OPUS_RESTRICT xp1 = out+overlap-1; | 326 kiss_fft_scalar * OPUS_RESTRICT xp1 = out+overlap-1; |
| 327 kiss_fft_scalar * OPUS_RESTRICT yp1 = out; | 327 kiss_fft_scalar * OPUS_RESTRICT yp1 = out; |
| 328 const opus_val16 * OPUS_RESTRICT wp1 = window; | 328 const opus_val16 * OPUS_RESTRICT wp1 = window; |
| 329 const opus_val16 * OPUS_RESTRICT wp2 = window+overlap-1; | 329 const opus_val16 * OPUS_RESTRICT wp2 = window+overlap-1; |
| 330 | 330 |
| 331 for(i = 0; i < overlap/2; i++) | 331 for(i = 0; i < overlap/2; i++) |
| 332 { | 332 { |
| 333 kiss_fft_scalar x1, x2; | 333 kiss_fft_scalar x1, x2; |
| 334 x1 = *xp1; | 334 x1 = *xp1; |
| 335 x2 = *yp1; | 335 x2 = *yp1; |
| 336 *yp1++ = MULT16_32_Q15(*wp2, x2) - MULT16_32_Q15(*wp1, x1); | 336 *yp1++ = SUB32_ovflw(MULT16_32_Q15(*wp2, x2), MULT16_32_Q15(*wp1, x1)); |
| 337 *xp1-- = MULT16_32_Q15(*wp1, x2) + MULT16_32_Q15(*wp2, x1); | 337 *xp1-- = ADD32_ovflw(MULT16_32_Q15(*wp1, x2), MULT16_32_Q15(*wp2, x1)); |
| 338 wp1++; | 338 wp1++; |
| 339 wp2--; | 339 wp2--; |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 #endif /* OVERRIDE_clt_mdct_backward */ | 343 #endif /* OVERRIDE_clt_mdct_backward */ |
| OLD | NEW |