2 /* Library of in-place fast fourier transforms */
3 /* Forward and inverse complex transforms */
4 /* and real forward transform */
5 /* Optimized for RISC processors with many registers */
6 /* Version 1.1 John Green NUWC New London CT January 96 */
7 /* Version 1.1 renamed as fftlib from fftbig */
8 /* Version 1.1 removed (float *)((char *) ptr) optimization */
9 /* Version 1.0 John Green NUWC New London CT December 95 */
10 /* (John Green) green_jt@vsdec.nl.nuwc.navy.mil */
11 /* green_jt@vsdec.nl.nuwc.navy.mil */
16 #define MAXMROOT 9 /* 2^(MAXMROOT-1) = # of elements in BRcnt */
18 /* Bit reversed counter */
19 static const unsigned char BRcnt
[256] = {
20 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208,
21 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232,
22 24, 152, 88, 216, 56, 184, 120, 248, 4, 132, 68, 196,
23 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
24 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220,
25 60, 188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226,
26 18, 146, 82, 210, 50, 178, 114, 242, 10, 138, 74, 202,
27 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
28 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214,
29 54, 182, 118, 246, 14, 142, 78, 206, 46, 174, 110, 238,
30 30, 158, 94, 222, 62, 190, 126, 254, 1, 129, 65, 193,
31 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
32 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217,
33 57, 185, 121, 249, 5, 133, 69, 197, 37, 165, 101, 229,
34 21, 149, 85, 213, 53, 181, 117, 245, 13, 141, 77, 205,
35 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
36 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211,
37 51, 179, 115, 243, 11, 139, 75, 203, 43, 171, 107, 235,
38 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199,
39 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
40 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223,
43 /* Table of powers of 2 */
44 static const long Ntbl
[21] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048,
45 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576};
47 long FFTInit(long *fftMptr
, long fftN
, float *Utbl
){
48 /* Compute cosine table and check size for complex ffts */
50 /* fftN = size of fft */
52 /* *fftMptr = log2 of fft size */
53 /* *Utbl = cosine table with fftN/4 + 1 entries (angles = 0 to pi/2 inclusive) */
55 /* 1 if fftN is invalid, 0 otherwise */
58 *fftMptr
= (long)(log(fftN
)/log(2.0) + 0.5);
59 if ((*fftMptr
>= 3) & (*fftMptr
<= 19) & (int)(pow(2,*fftMptr
)+.5) == fftN
)
60 for (i1
= 0; i1
<= fftN
/4; i1
++)
61 Utbl
[i1
] = cos( ( 3.1415926535897932384626433832795 * 2.0 * i1
) / fftN
);
67 long rFFTInit(long *fftMptr
, long fftN
, float *Utbl
){
68 /* Compute cosine table and check size for a real input fft */
70 /* fftN = size of fft */
72 /* *fftMptr = log2 of fft size */
73 /* *Utbl = cosine table with fftN/4 + 1 entries (angles = 0 to pi/2 inclusive) */
75 /* 1 if fftN is invalid, 0 otherwise */
78 *fftMptr
= (long)(log(fftN
)/log(2.0) + 0.5);
79 if ((*fftMptr
>= 4) & (*fftMptr
<= 20) & (int)(pow(2,*fftMptr
)+.5) == fftN
)
81 for (i1
= 0; i1
<= fftN
/4; i1
++)
82 Utbl
[i1
] = cos( ( 3.1415926535897932384626433832795 * 2.0 * i1
) / fftN
);
88 void ffts(float *ioptr
, long M
, long Rows
, float *Utbl
){
89 /* Compute in-place complex fft on the rows of the input array */
91 /* M = log2 of fft size */
92 /* *ioptr = input data array */
93 /* *Utbl = cosine table */
94 /* Rows = number of rows in ioptr array (use Rows of 1 if ioptr is a 1 dimensional array) */
96 /* *ioptr = output data array */
157 const long BRshift
= MAXMROOT
- (M
>>1);
158 const long Nrems2
= Ntbl
[M
-(M
>>1)+1];
159 const long Nroot_1_ColInc
= (Ntbl
[M
-1]-Ntbl
[M
-(M
>>1)])*2;
162 for (;Rows
>0;Rows
--){
164 FlyOffsetA
= Ntbl
[M
] * (2/2);
165 FlyOffsetAIm
= FlyOffsetA
+ 1;
166 FlyOffsetB
= FlyOffsetA
+ 2;
167 FlyOffsetBIm
= FlyOffsetB
+ 1;
169 /* BitrevR2 ** bit reverse and first radix 2 stage ******/
171 for (stage
= 0; stage
< Ntbl
[M
-(M
>>1)]*2; stage
+= Ntbl
[M
>>1]*2){
172 for (LoopN
= (Ntbl
[(M
>>1)-1]-1); LoopN
>= 0; LoopN
--){
173 LoopCnt
= (Ntbl
[(M
>>1)-1]-1);
174 fly0P
= ioptr
+ Nroot_1_ColInc
+ ((int)BRcnt
[LoopN
] >> BRshift
)*(2*2) + stage
;
175 IOP
= ioptr
+ (LoopN
<<(M
+1)/2) * 2 + stage
;
176 fly1P
= IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2);
179 fly1r
= *(fly0P
+FlyOffsetA
);
180 fly1i
= *(fly0P
+FlyOffsetAIm
);
181 for (; LoopCnt
> LoopN
;){
183 fly2i
= *(fly0P
+(2+1));
184 fly3r
= *(fly0P
+FlyOffsetB
);
185 fly3i
= *(fly0P
+FlyOffsetBIm
);
188 fly5r
= *(fly1P
+FlyOffsetA
);
189 fly5i
= *(fly1P
+FlyOffsetAIm
);
191 fly6i
= *(fly1P
+(2+1));
192 fly7r
= *(fly1P
+FlyOffsetB
);
193 fly7i
= *(fly1P
+FlyOffsetBIm
);
197 fly1r
= fly0r
- fly1r
;
198 fly1i
= fly0i
- fly1i
;
201 fly3r
= fly2r
- fly3r
;
202 fly3i
= fly2i
- fly3i
;
203 fly0r
= fly4r
+ fly5r
;
204 fly0i
= fly4i
+ fly5i
;
205 fly5r
= fly4r
- fly5r
;
206 fly5i
= fly4i
- fly5i
;
207 fly2r
= fly6r
+ fly7r
;
208 fly2i
= fly6i
+ fly7i
;
209 fly7r
= fly6r
- fly7r
;
210 fly7i
= fly6i
- fly7i
;
215 *(fly1P
+(2+1)) = fly1i
;
216 *(fly1P
+FlyOffsetA
) = t1r
;
217 *(fly1P
+FlyOffsetAIm
) = t1i
;
218 *(fly1P
+FlyOffsetB
) = fly3r
;
219 *(fly1P
+FlyOffsetBIm
) = fly3i
;
223 *(fly0P
+(2+1)) = fly5i
;
224 *(fly0P
+FlyOffsetA
) = fly2r
;
225 *(fly0P
+FlyOffsetAIm
) = fly2i
;
226 *(fly0P
+FlyOffsetB
) = fly7r
;
227 *(fly0P
+FlyOffsetBIm
) = fly7i
;
232 fly1r
= *(fly0P
+FlyOffsetA
);
233 fly1i
= *(fly0P
+FlyOffsetAIm
);
235 fly1P
= (IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2));
238 fly2i
= *(fly0P
+(2+1));
239 fly3r
= *(fly0P
+FlyOffsetB
);
240 fly3i
= *(fly0P
+FlyOffsetBIm
);
244 fly1r
= fly0r
- fly1r
;
245 fly1i
= fly0i
- fly1i
;
248 fly3r
= fly2r
- fly3r
;
249 fly3i
= fly2i
- fly3i
;
254 *(fly0P
+(2+1)) = fly1i
;
255 *(fly0P
+FlyOffsetA
) = t1r
;
256 *(fly0P
+FlyOffsetAIm
) = t1i
;
257 *(fly0P
+FlyOffsetB
) = fly3r
;
258 *(fly0P
+FlyOffsetBIm
) = fly3i
;
265 /**** FFTC **************/
274 if ( (M
-1-(stage
* 3)) != 0 ){
275 FlyOffsetA
= Flyinc
<< 2;
276 FlyOffsetB
= FlyOffsetA
<< 1;
277 FlyOffsetAIm
= FlyOffsetA
+ 1;
278 FlyOffsetBIm
= FlyOffsetB
+ 1;
279 if ( (M
-1-(stage
* 3)) == 1 ){
280 /* 1 radix 2 stage */
284 fly1P
= (IOP
+Flyinc
);
285 fly2P
= (fly1P
+Flyinc
);
286 fly3P
= (fly2P
+Flyinc
);
300 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
306 fly2i
= *(fly2P
+ 1);
308 fly1i
= *(fly3P
+ 1);
309 fly4r
= *(fly0P
+ FlyOffsetA
);
310 fly4i
= *(fly0P
+ FlyOffsetAIm
);
311 fly0r
= *(fly1P
+ FlyOffsetA
);
312 fly0i
= *(fly1P
+ FlyOffsetAIm
);
313 fly6r
= *(fly2P
+ FlyOffsetA
);
314 fly6i
= *(fly2P
+ FlyOffsetAIm
);
315 fly3r
= *(fly3P
+ FlyOffsetA
);
316 fly3i
= *(fly3P
+ FlyOffsetAIm
);
328 fly2r
= fly4r
- fly6r
;
329 fly2i
= fly4i
- fly6i
;
330 fly4r
= fly4r
+ fly6r
;
331 fly4i
= fly4i
+ fly6i
;
333 fly1r
= fly0r
- fly3i
;
334 fly1i
= fly0i
+ fly3r
;
335 fly0r
= fly0r
+ fly3i
;
336 fly0i
= fly0i
- fly3r
;
339 *(fly2P
+ 1) = fly5i
;
343 *(fly3P
+ 1) = fly7i
;
346 *(fly2P
+ FlyOffsetA
) = fly2r
;
347 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
348 *(fly0P
+ FlyOffsetA
) = fly4r
;
349 *(fly0P
+ FlyOffsetAIm
) = fly4i
;
350 *(fly3P
+ FlyOffsetA
) = fly1r
;
351 *(fly3P
+ FlyOffsetAIm
) = fly1i
;
352 *(fly1P
+ FlyOffsetA
) = fly0r
;
353 *(fly1P
+ FlyOffsetAIm
) = fly0i
;
355 fly0P
= (fly0P
+ FlyOffsetB
);
356 fly1P
= (fly1P
+ FlyOffsetB
);
357 fly2P
= (fly2P
+ FlyOffsetB
);
358 fly3P
= (fly3P
+ FlyOffsetB
);
364 Flyinc
= Flyinc
<< 1;
367 /* 1 radix 4 stage */
370 U3r
= 0.7071067811865475244008443621; /* sqrt(0.5); */
373 fly1P
= (IOP
+Flyinc
);
374 fly2P
= (fly1P
+Flyinc
);
375 fly3P
= (fly2P
+Flyinc
);
389 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
395 fly2i
= *(fly2P
+ 1);
397 fly1i
= *(fly3P
+ 1);
398 fly4r
= *(fly0P
+ FlyOffsetA
);
399 fly4i
= *(fly0P
+ FlyOffsetAIm
);
400 fly0r
= *(fly1P
+ FlyOffsetA
);
401 fly0i
= *(fly1P
+ FlyOffsetAIm
);
402 fly6r
= *(fly2P
+ FlyOffsetA
);
403 fly6i
= *(fly2P
+ FlyOffsetAIm
);
404 fly3r
= *(fly3P
+ FlyOffsetA
);
405 fly3i
= *(fly3P
+ FlyOffsetAIm
);
417 fly2r
= fly4r
- fly6r
;
418 fly2i
= fly4i
- fly6i
;
419 fly4r
= fly4r
+ fly6r
;
420 fly4i
= fly4i
+ fly6i
;
422 fly1r
= fly0r
- fly3i
;
423 fly1i
= fly0i
+ fly3r
;
424 fly0r
= fly0r
+ fly3i
;
425 fly0i
= fly0i
- fly3r
;
433 fly3r
= fly5r
- fly2i
;
434 fly3i
= fly5i
+ fly2r
;
435 fly5r
= fly5r
+ fly2i
;
436 fly5i
= fly5i
- fly2r
;
438 fly4r
= t1r
- U3r
* fly0r
;
439 fly4r
= fly4r
- U3i
* fly0i
;
440 fly4i
= t1i
+ U3i
* fly0r
;
441 fly4i
= fly4i
- U3r
* fly0i
;
442 t1r
= scale
* t1r
- fly4r
;
443 t1i
= scale
* t1i
- fly4i
;
445 fly2r
= fly7r
+ U3i
* fly1r
;
446 fly2r
= fly2r
- U3r
* fly1i
;
447 fly2i
= fly7i
+ U3r
* fly1r
;
448 fly2i
= fly2i
+ U3i
* fly1i
;
449 fly7r
= scale
* fly7r
- fly2r
;
450 fly7i
= scale
* fly7i
- fly2i
;
452 *(fly0P
+ FlyOffsetA
) = fly6r
;
453 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
456 *(fly2P
+ FlyOffsetA
) = fly3r
;
457 *(fly2P
+ FlyOffsetAIm
) = fly3i
;
459 *(fly2P
+ 1) = fly5i
;
460 *(fly1P
+ FlyOffsetA
) = fly4r
;
461 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
464 *(fly3P
+ FlyOffsetA
) = fly2r
;
465 *(fly3P
+ FlyOffsetAIm
) = fly2i
;
467 *(fly3P
+ 1) = fly7i
;
469 fly0P
= (fly0P
+ FlyOffsetB
);
470 fly1P
= (fly1P
+ FlyOffsetB
);
471 fly2P
= (fly2P
+ FlyOffsetB
);
472 fly3P
= (fly3P
+ FlyOffsetB
);
479 Flyinc
= Flyinc
<< 2;
483 NsameU2
= NsameU4
>> 1;
484 NsameU1
= NsameU2
>> 1;
486 FlyOffsetA
= Flyinc
<< 2;
487 FlyOffsetB
= FlyOffsetA
<< 1;
488 FlyOffsetAIm
= FlyOffsetA
+ 1;
489 FlyOffsetBIm
= FlyOffsetB
+ 1;
491 /* ****** RADIX 8 Stages */
492 for (stage
= stage
<<1; stage
> 0 ; stage
--){
494 /* an fft stage is done in two parts to ease use of the single quadrant cos table */
496 /* fftcalc1(iobuf, Utbl, N, NdiffU, LoopN); */
499 U0iP
= &Utbl
[Ntbl
[M
-2]];
504 U3offset
= (Ntbl
[M
]) / 8;
514 U3r
= *( U2rP
+ U3offset
);
515 U3i
= *( U2iP
- U3offset
);
519 fly1P
= (IOP
+Flyinc
);
520 fly2P
= (fly1P
+Flyinc
);
521 fly3P
= (fly2P
+Flyinc
);
523 for (diffUcnt
= (NdiffU
)>>1; diffUcnt
!= 0; diffUcnt
--){
527 f0 - - t0 - - t0 - - t0
528 f1 -U0 - t1 - - t1 - - t1
529 f2 - - f2 -U1 - f5 - - f3
530 f3 -U0 - f1 -U1a- f7 - - f7
531 f4 - - f4 - - f4 -U2 - f6
532 f5 -U0 - f0 - - f0 -U3 - f4
533 f6 - - f6 -U1 - f2 -U2a- f2
534 f7 -U0 - f3 -U1a- f1 -U3a- f5
542 for (LoopCnt
= LoopN
-1; LoopCnt
> 0 ; LoopCnt
--){
545 fly2i
= *(fly2P
+ 1);
547 fly3i
= *(fly3P
+ 1);
548 fly4r
= *(fly0P
+ FlyOffsetA
);
549 fly4i
= *(fly0P
+ FlyOffsetAIm
);
550 fly5r
= *(fly1P
+ FlyOffsetA
);
551 fly5i
= *(fly1P
+ FlyOffsetAIm
);
552 fly6r
= *(fly2P
+ FlyOffsetA
);
553 fly6i
= *(fly2P
+ FlyOffsetAIm
);
554 fly7r
= *(fly3P
+ FlyOffsetA
);
555 fly7i
= *(fly3P
+ FlyOffsetAIm
);
557 t1r
= fly0r
- U0r
* fly1r
;
558 t1r
= t1r
- U0i
* fly1i
;
559 t1i
= fly0i
+ U0i
* fly1r
;
560 t1i
= t1i
- U0r
* fly1i
;
561 t0r
= scale
* fly0r
- t1r
;
562 t0i
= scale
* fly0i
- t1i
;
564 fly1r
= fly2r
- U0r
* fly3r
;
565 fly1r
= fly1r
- U0i
* fly3i
;
566 fly1i
= fly2i
+ U0i
* fly3r
;
567 fly1i
= fly1i
- U0r
* fly3i
;
568 fly2r
= scale
* fly2r
- fly1r
;
569 fly2i
= scale
* fly2i
- fly1i
;
571 fly0r
= fly4r
- U0r
* fly5r
;
572 fly0r
= fly0r
- U0i
* fly5i
;
573 fly0i
= fly4i
+ U0i
* fly5r
;
574 fly0i
= fly0i
- U0r
* fly5i
;
575 fly4r
= scale
* fly4r
- fly0r
;
576 fly4i
= scale
* fly4i
- fly0i
;
578 fly3r
= fly6r
- U0r
* fly7r
;
579 fly3r
= fly3r
- U0i
* fly7i
;
580 fly3i
= fly6i
+ U0i
* fly7r
;
581 fly3i
= fly3i
- U0r
* fly7i
;
582 fly6r
= scale
* fly6r
- fly3r
;
583 fly6i
= scale
* fly6i
- fly3i
;
586 fly5r
= t0r
- U1r
* fly2r
;
587 fly5r
= fly5r
- U1i
* fly2i
;
588 fly5i
= t0i
+ U1i
* fly2r
;
589 fly5i
= fly5i
- U1r
* fly2i
;
590 t0r
= scale
* t0r
- fly5r
;
591 t0i
= scale
* t0i
- fly5i
;
593 fly7r
= t1r
+ U1i
* fly1r
;
594 fly7r
= fly7r
- U1r
* fly1i
;
595 fly7i
= t1i
+ U1r
* fly1r
;
596 fly7i
= fly7i
+ U1i
* fly1i
;
597 t1r
= scale
* t1r
- fly7r
;
598 t1i
= scale
* t1i
- fly7i
;
600 fly2r
= fly4r
- U1r
* fly6r
;
601 fly2r
= fly2r
- U1i
* fly6i
;
602 fly2i
= fly4i
+ U1i
* fly6r
;
603 fly2i
= fly2i
- U1r
* fly6i
;
604 fly4r
= scale
* fly4r
- fly2r
;
605 fly4i
= scale
* fly4i
- fly2i
;
607 fly1r
= fly0r
+ U1i
* fly3r
;
608 fly1r
= fly1r
- U1r
* fly3i
;
609 fly1i
= fly0i
+ U1r
* fly3r
;
610 fly1i
= fly1i
+ U1i
* fly3i
;
611 fly0r
= scale
* fly0r
- fly1r
;
612 fly0i
= scale
* fly0i
- fly1i
;
614 fly6r
= t0r
- U2r
* fly4r
;
615 fly6r
= fly6r
- U2i
* fly4i
;
616 fly6i
= t0i
+ U2i
* fly4r
;
617 fly6i
= fly6i
- U2r
* fly4i
;
618 t0r
= scale
* t0r
- fly6r
;
619 t0i
= scale
* t0i
- fly6i
;
621 fly3r
= fly5r
- U2i
* fly2r
;
622 fly3r
= fly3r
+ U2r
* fly2i
;
623 fly3i
= fly5i
- U2r
* fly2r
;
624 fly3i
= fly3i
- U2i
* fly2i
;
625 fly2r
= scale
* fly5r
- fly3r
;
626 fly2i
= scale
* fly5i
- fly3i
;
628 fly4r
= t1r
- U3r
* fly0r
;
629 fly4r
= fly4r
- U3i
* fly0i
;
630 fly4i
= t1i
+ U3i
* fly0r
;
631 fly4i
= fly4i
- U3r
* fly0i
;
632 t1r
= scale
* t1r
- fly4r
;
633 t1i
= scale
* t1i
- fly4i
;
635 fly5r
= fly7r
+ U3i
* fly1r
;
636 fly5r
= fly5r
- U3r
* fly1i
;
637 fly5i
= fly7i
+ U3r
* fly1r
;
638 fly5i
= fly5i
+ U3i
* fly1i
;
639 fly7r
= scale
* fly7r
- fly5r
;
640 fly7i
= scale
* fly7i
- fly5i
;
642 *(fly0P
+ FlyOffsetA
) = fly6r
;
643 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
647 *(fly2P
+ 1) = fly3i
;
648 *(fly2P
+ FlyOffsetA
) = fly2r
;
649 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
651 fly0r
= *(fly0P
+ FlyOffsetB
);
652 fly0i
= *(fly0P
+ FlyOffsetBIm
);
654 *(fly1P
+ FlyOffsetA
) = fly4r
;
655 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
659 fly1r
= *(fly1P
+ FlyOffsetB
);
660 fly1i
= *(fly1P
+ FlyOffsetBIm
);
662 *(fly3P
+ FlyOffsetA
) = fly5r
;
663 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
665 *(fly3P
+ 1) = fly7i
;
667 fly0P
= (fly0P
+ FlyOffsetB
);
668 fly1P
= (fly1P
+ FlyOffsetB
);
669 fly2P
= (fly2P
+ FlyOffsetB
);
670 fly3P
= (fly3P
+ FlyOffsetB
);
673 fly2i
= *(fly2P
+ 1);
675 fly3i
= *(fly3P
+ 1);
676 fly4r
= *(fly0P
+ FlyOffsetA
);
677 fly4i
= *(fly0P
+ FlyOffsetAIm
);
678 fly5r
= *(fly1P
+ FlyOffsetA
);
679 fly5i
= *(fly1P
+ FlyOffsetAIm
);
680 fly6r
= *(fly2P
+ FlyOffsetA
);
681 fly6i
= *(fly2P
+ FlyOffsetAIm
);
682 fly7r
= *(fly3P
+ FlyOffsetA
);
683 fly7i
= *(fly3P
+ FlyOffsetAIm
);
685 t1r
= fly0r
- U0r
* fly1r
;
686 t1r
= t1r
- U0i
* fly1i
;
687 t1i
= fly0i
+ U0i
* fly1r
;
688 t1i
= t1i
- U0r
* fly1i
;
689 t0r
= scale
* fly0r
- t1r
;
690 t0i
= scale
* fly0i
- t1i
;
692 fly1r
= fly2r
- U0r
* fly3r
;
693 fly1r
= fly1r
- U0i
* fly3i
;
694 fly1i
= fly2i
+ U0i
* fly3r
;
695 fly1i
= fly1i
- U0r
* fly3i
;
696 fly2r
= scale
* fly2r
- fly1r
;
697 fly2i
= scale
* fly2i
- fly1i
;
699 fly0r
= fly4r
- U0r
* fly5r
;
700 fly0r
= fly0r
- U0i
* fly5i
;
701 fly0i
= fly4i
+ U0i
* fly5r
;
702 fly0i
= fly0i
- U0r
* fly5i
;
703 fly4r
= scale
* fly4r
- fly0r
;
704 fly4i
= scale
* fly4i
- fly0i
;
706 fly3r
= fly6r
- U0r
* fly7r
;
707 fly3r
= fly3r
- U0i
* fly7i
;
708 fly3i
= fly6i
+ U0i
* fly7r
;
709 fly3i
= fly3i
- U0r
* fly7i
;
710 fly6r
= scale
* fly6r
- fly3r
;
711 fly6i
= scale
* fly6i
- fly3i
;
713 fly5r
= t0r
- U1r
* fly2r
;
714 fly5r
= fly5r
- U1i
* fly2i
;
715 fly5i
= t0i
+ U1i
* fly2r
;
716 fly5i
= fly5i
- U1r
* fly2i
;
717 t0r
= scale
* t0r
- fly5r
;
718 t0i
= scale
* t0i
- fly5i
;
720 fly7r
= t1r
+ U1i
* fly1r
;
721 fly7r
= fly7r
- U1r
* fly1i
;
722 fly7i
= t1i
+ U1r
* fly1r
;
723 fly7i
= fly7i
+ U1i
* fly1i
;
724 t1r
= scale
* t1r
- fly7r
;
725 t1i
= scale
* t1i
- fly7i
;
727 fly2r
= fly4r
- U1r
* fly6r
;
728 fly2r
= fly2r
- U1i
* fly6i
;
729 fly2i
= fly4i
+ U1i
* fly6r
;
730 fly2i
= fly2i
- U1r
* fly6i
;
731 fly4r
= scale
* fly4r
- fly2r
;
732 fly4i
= scale
* fly4i
- fly2i
;
734 fly1r
= fly0r
+ U1i
* fly3r
;
735 fly1r
= fly1r
- U1r
* fly3i
;
736 fly1i
= fly0i
+ U1r
* fly3r
;
737 fly1i
= fly1i
+ U1i
* fly3i
;
738 fly0r
= scale
* fly0r
- fly1r
;
739 fly0i
= scale
* fly0i
- fly1i
;
741 U0i
= *(U0iP
= (U0iP
- NsameU4
));
742 U0r
= *(U0rP
= (U0rP
+ NsameU4
));
743 U1r
= *(U1rP
= (U1rP
+ NsameU2
));
744 U1i
= *(U1iP
= (U1iP
- NsameU2
));
748 fly6r
= t0r
- U2r
* fly4r
;
749 fly6r
= fly6r
- U2i
* fly4i
;
750 fly6i
= t0i
+ U2i
* fly4r
;
751 fly6i
= fly6i
- U2r
* fly4i
;
752 t0r
= scale
* t0r
- fly6r
;
753 t0i
= scale
* t0i
- fly6i
;
755 fly3r
= fly5r
- U2i
* fly2r
;
756 fly3r
= fly3r
+ U2r
* fly2i
;
757 fly3i
= fly5i
- U2r
* fly2r
;
758 fly3i
= fly3i
- U2i
* fly2i
;
759 fly2r
= scale
* fly5r
- fly3r
;
760 fly2i
= scale
* fly5i
- fly3i
;
762 fly4r
= t1r
- U3r
* fly0r
;
763 fly4r
= fly4r
- U3i
* fly0i
;
764 fly4i
= t1i
+ U3i
* fly0r
;
765 fly4i
= fly4i
- U3r
* fly0i
;
766 t1r
= scale
* t1r
- fly4r
;
767 t1i
= scale
* t1i
- fly4i
;
769 fly5r
= fly7r
+ U3i
* fly1r
;
770 fly5r
= fly5r
- U3r
* fly1i
;
771 fly5i
= fly7i
+ U3r
* fly1r
;
772 fly5i
= fly5i
+ U3i
* fly1i
;
773 fly7r
= scale
* fly7r
- fly5r
;
774 fly7i
= scale
* fly7i
- fly5i
;
776 *(fly0P
+ FlyOffsetA
) = fly6r
;
777 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
781 U2r
= *(U2rP
= (U2rP
+ NsameU1
));
782 U2i
= *(U2iP
= (U2iP
- NsameU1
));
785 *(fly2P
+ 1) = fly3i
;
786 *(fly2P
+ FlyOffsetA
) = fly2r
;
787 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
788 *(fly1P
+ FlyOffsetA
) = fly4r
;
789 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
793 U3r
= *( U2rP
+ U3offset
);
794 U3i
= *( U2iP
- U3offset
);
796 *(fly3P
+ FlyOffsetA
) = fly5r
;
797 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
799 *(fly3P
+ 1) = fly7i
;
803 fly1P
= (IOP
+Flyinc
);
804 fly2P
= (fly1P
+Flyinc
);
805 fly3P
= (fly2P
+Flyinc
);
818 FlyOffsetAIm
= FlyOffsetA
+ 1;
819 FlyOffsetBIm
= FlyOffsetB
+ 1;
826 void iffts(float *ioptr
, long M
, long Rows
, float *Utbl
){
827 /* Compute in-place inverse complex fft on the rows of the input array */
829 /* M = log2 of fft size */
830 /* *ioptr = input data array */
831 /* *Utbl = cosine table */
832 /* Rows = number of rows in ioptr array (use Rows of 1 if ioptr is a 1 dimensional array) */
834 /* *ioptr = output data array */
894 const long BRshift
= MAXMROOT
- (M
>>1);
895 const long Nrems2
= Ntbl
[M
-(M
>>1)+1];
896 const long Nroot_1_ColInc
= (Ntbl
[M
-1]-Ntbl
[M
-(M
>>1)])*2;
898 for (;Rows
>0;Rows
--){
900 FlyOffsetA
= Ntbl
[M
] * 2/2;
901 FlyOffsetAIm
= FlyOffsetA
+ 1;
902 FlyOffsetB
= FlyOffsetA
+ 2;
903 FlyOffsetBIm
= FlyOffsetB
+ 1;
905 /* BitrevR2 ** bit reverse and first radix 2 stage ******/
908 for (stage
= 0; stage
< Ntbl
[M
-(M
>>1)]*2; stage
+= Ntbl
[M
>>1]*2){
909 for (LoopN
= (Ntbl
[(M
>>1)-1]-1); LoopN
>= 0; LoopN
--){
910 LoopCnt
= (Ntbl
[(M
>>1)-1]-1);
911 fly0P
= ioptr
+ Nroot_1_ColInc
+ ((int)BRcnt
[LoopN
] >> BRshift
)*(2*2) + stage
;
912 IOP
= ioptr
+ (LoopN
<<(M
+1)/2) * 2 + stage
;
913 fly1P
= IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2);
916 fly1r
= *(fly0P
+FlyOffsetA
);
917 fly1i
= *(fly0P
+FlyOffsetAIm
);
918 for (; LoopCnt
> LoopN
;){
920 fly2i
= *(fly0P
+(2+1));
921 fly3r
= *(fly0P
+FlyOffsetB
);
922 fly3i
= *(fly0P
+FlyOffsetBIm
);
925 fly5r
= *(fly1P
+FlyOffsetA
);
926 fly5i
= *(fly1P
+FlyOffsetAIm
);
928 fly6i
= *(fly1P
+(2+1));
929 fly7r
= *(fly1P
+FlyOffsetB
);
930 fly7i
= *(fly1P
+FlyOffsetBIm
);
934 fly1r
= fly0r
- fly1r
;
935 fly1i
= fly0i
- fly1i
;
938 fly3r
= fly2r
- fly3r
;
939 fly3i
= fly2i
- fly3i
;
940 fly0r
= fly4r
+ fly5r
;
941 fly0i
= fly4i
+ fly5i
;
942 fly5r
= fly4r
- fly5r
;
943 fly5i
= fly4i
- fly5i
;
944 fly2r
= fly6r
+ fly7r
;
945 fly2i
= fly6i
+ fly7i
;
946 fly7r
= fly6r
- fly7r
;
947 fly7i
= fly6i
- fly7i
;
949 *(fly1P
) = scale
*t0r
;
950 *(fly1P
+1) = scale
*t0i
;
951 *(fly1P
+2) = scale
*fly1r
;
952 *(fly1P
+(2+1)) = scale
*fly1i
;
953 *(fly1P
+FlyOffsetA
) = scale
*t1r
;
954 *(fly1P
+FlyOffsetAIm
) = scale
*t1i
;
955 *(fly1P
+FlyOffsetB
) = scale
*fly3r
;
956 *(fly1P
+FlyOffsetBIm
) = scale
*fly3i
;
957 *(fly0P
) = scale
*fly0r
;
958 *(fly0P
+1) = scale
*fly0i
;
959 *(fly0P
+2) = scale
*fly5r
;
960 *(fly0P
+(2+1)) = scale
*fly5i
;
961 *(fly0P
+FlyOffsetA
) = scale
*fly2r
;
962 *(fly0P
+FlyOffsetAIm
) = scale
*fly2i
;
963 *(fly0P
+FlyOffsetB
) = scale
*fly7r
;
964 *(fly0P
+FlyOffsetBIm
) = scale
*fly7i
;
969 fly1r
= *(fly0P
+FlyOffsetA
);
970 fly1i
= *(fly0P
+FlyOffsetAIm
);
972 fly1P
= (IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2));
975 fly2i
= *(fly0P
+(2+1));
976 fly3r
= *(fly0P
+FlyOffsetB
);
977 fly3i
= *(fly0P
+FlyOffsetBIm
);
981 fly1r
= fly0r
- fly1r
;
982 fly1i
= fly0i
- fly1i
;
985 fly3r
= fly2r
- fly3r
;
986 fly3i
= fly2i
- fly3i
;
988 *(fly0P
) = scale
*t0r
;
989 *(fly0P
+1) = scale
*t0i
;
990 *(fly0P
+2) = scale
*fly1r
;
991 *(fly0P
+(2+1)) = scale
*fly1i
;
992 *(fly0P
+FlyOffsetA
) = scale
*t1r
;
993 *(fly0P
+FlyOffsetAIm
) = scale
*t1i
;
994 *(fly0P
+FlyOffsetB
) = scale
*fly3r
;
995 *(fly0P
+FlyOffsetBIm
) = scale
*fly3i
;
1000 /**** FFTC **************/
1007 NsameU4
= Ntbl
[M
]/4;
1011 if ( (M
-1-(stage
* 3)) != 0 ){
1012 FlyOffsetA
= Flyinc
<< 2;
1013 FlyOffsetB
= FlyOffsetA
<< 1;
1014 FlyOffsetAIm
= FlyOffsetA
+ 1;
1015 FlyOffsetBIm
= FlyOffsetB
+ 1;
1016 if ( (M
-1-(stage
* 3)) == 1 ){
1017 /* 1 radix 2 stage */
1021 fly1P
= (IOP
+Flyinc
);
1022 fly2P
= (fly1P
+Flyinc
);
1023 fly3P
= (fly2P
+Flyinc
);
1037 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
1043 fly2i
= *(fly2P
+ 1);
1045 fly1i
= *(fly3P
+ 1);
1046 fly4r
= *(fly0P
+ FlyOffsetA
);
1047 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1048 fly0r
= *(fly1P
+ FlyOffsetA
);
1049 fly0i
= *(fly1P
+ FlyOffsetAIm
);
1050 fly6r
= *(fly2P
+ FlyOffsetA
);
1051 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1052 fly3r
= *(fly3P
+ FlyOffsetA
);
1053 fly3i
= *(fly3P
+ FlyOffsetAIm
);
1055 fly5r
= t0r
- fly2r
;
1056 fly5i
= t0i
- fly2i
;
1060 fly7r
= t1r
+ fly1i
;
1061 fly7i
= t1i
- fly1r
;
1065 fly2r
= fly4r
- fly6r
;
1066 fly2i
= fly4i
- fly6i
;
1067 fly4r
= fly4r
+ fly6r
;
1068 fly4i
= fly4i
+ fly6i
;
1070 fly1r
= fly0r
+ fly3i
;
1071 fly1i
= fly0i
- fly3r
;
1072 fly0r
= fly0r
- fly3i
;
1073 fly0i
= fly0i
+ fly3r
;
1076 *(fly2P
+ 1) = fly5i
;
1080 *(fly3P
+ 1) = fly7i
;
1083 *(fly2P
+ FlyOffsetA
) = fly2r
;
1084 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
1085 *(fly0P
+ FlyOffsetA
) = fly4r
;
1086 *(fly0P
+ FlyOffsetAIm
) = fly4i
;
1087 *(fly3P
+ FlyOffsetA
) = fly1r
;
1088 *(fly3P
+ FlyOffsetAIm
) = fly1i
;
1089 *(fly1P
+ FlyOffsetA
) = fly0r
;
1090 *(fly1P
+ FlyOffsetAIm
) = fly0i
;
1092 fly0P
= (fly0P
+ FlyOffsetB
);
1093 fly1P
= (fly1P
+ FlyOffsetB
);
1094 fly2P
= (fly2P
+ FlyOffsetB
);
1095 fly3P
= (fly3P
+ FlyOffsetB
);
1101 Flyinc
= Flyinc
<< 1;
1104 /* 1 radix 4 stage */
1107 U3r
= 0.7071067811865475244008443621; /* sqrt(0.5); */
1110 fly1P
= (IOP
+Flyinc
);
1111 fly2P
= (fly1P
+Flyinc
);
1112 fly3P
= (fly2P
+Flyinc
);
1123 f3 - -i- f1 -U3a- f2
1126 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
1132 fly2i
= *(fly2P
+ 1);
1134 fly1i
= *(fly3P
+ 1);
1135 fly4r
= *(fly0P
+ FlyOffsetA
);
1136 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1137 fly0r
= *(fly1P
+ FlyOffsetA
);
1138 fly0i
= *(fly1P
+ FlyOffsetAIm
);
1139 fly6r
= *(fly2P
+ FlyOffsetA
);
1140 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1141 fly3r
= *(fly3P
+ FlyOffsetA
);
1142 fly3i
= *(fly3P
+ FlyOffsetAIm
);
1144 fly5r
= t0r
- fly2r
;
1145 fly5i
= t0i
- fly2i
;
1149 fly7r
= t1r
+ fly1i
;
1150 fly7i
= t1i
- fly1r
;
1154 fly2r
= fly4r
- fly6r
;
1155 fly2i
= fly4i
- fly6i
;
1156 fly4r
= fly4r
+ fly6r
;
1157 fly4i
= fly4i
+ fly6i
;
1159 fly1r
= fly0r
+ fly3i
;
1160 fly1i
= fly0i
- fly3r
;
1161 fly0r
= fly0r
- fly3i
;
1162 fly0i
= fly0i
+ fly3r
;
1164 fly6r
= t0r
- fly4r
;
1165 fly6i
= t0i
- fly4i
;
1169 fly3r
= fly5r
+ fly2i
;
1170 fly3i
= fly5i
- fly2r
;
1171 fly5r
= fly5r
- fly2i
;
1172 fly5i
= fly5i
+ fly2r
;
1174 fly4r
= t1r
- U3r
* fly0r
;
1175 fly4r
= fly4r
+ U3i
* fly0i
;
1176 fly4i
= t1i
- U3i
* fly0r
;
1177 fly4i
= fly4i
- U3r
* fly0i
;
1178 t1r
= scale
* t1r
- fly4r
;
1179 t1i
= scale
* t1i
- fly4i
;
1181 fly2r
= fly7r
+ U3i
* fly1r
;
1182 fly2r
= fly2r
+ U3r
* fly1i
;
1183 fly2i
= fly7i
- U3r
* fly1r
;
1184 fly2i
= fly2i
+ U3i
* fly1i
;
1185 fly7r
= scale
* fly7r
- fly2r
;
1186 fly7i
= scale
* fly7i
- fly2i
;
1188 *(fly0P
+ FlyOffsetA
) = fly6r
;
1189 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
1192 *(fly2P
+ FlyOffsetA
) = fly3r
;
1193 *(fly2P
+ FlyOffsetAIm
) = fly3i
;
1195 *(fly2P
+ 1) = fly5i
;
1196 *(fly1P
+ FlyOffsetA
) = fly4r
;
1197 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
1200 *(fly3P
+ FlyOffsetA
) = fly2r
;
1201 *(fly3P
+ FlyOffsetAIm
) = fly2i
;
1203 *(fly3P
+ 1) = fly7i
;
1205 fly0P
= (fly0P
+ FlyOffsetB
);
1206 fly1P
= (fly1P
+ FlyOffsetB
);
1207 fly2P
= (fly2P
+ FlyOffsetB
);
1208 fly3P
= (fly3P
+ FlyOffsetB
);
1215 Flyinc
= Flyinc
<< 2;
1219 NsameU2
= NsameU4
>> 1;
1220 NsameU1
= NsameU2
>> 1;
1222 FlyOffsetA
= Flyinc
<< 2;
1223 FlyOffsetB
= FlyOffsetA
<< 1;
1224 FlyOffsetAIm
= FlyOffsetA
+ 1;
1225 FlyOffsetBIm
= FlyOffsetB
+ 1;
1228 /* ****** RADIX 8 Stages */
1229 for (stage
= stage
<<1; stage
> 0 ; stage
--){
1231 /* an fft stage is done in two parts to ease use of the single quadrant cos table */
1233 /* fftcalc1(iobuf, Utbl, N, NdiffU, LoopN); */
1236 U0iP
= &Utbl
[Ntbl
[M
-2]];
1241 U3offset
= (Ntbl
[M
]) / 8;
1251 U3r
= *( U2rP
+ U3offset
);
1252 U3i
= *( U2iP
- U3offset
);
1256 fly1P
= (IOP
+Flyinc
);
1257 fly2P
= (fly1P
+Flyinc
);
1258 fly3P
= (fly2P
+Flyinc
);
1260 for (diffUcnt
= (NdiffU
)>>1; diffUcnt
> 0; diffUcnt
--){
1264 f0 - - t0 - - t0 - - t0
1265 f1 -U0 - t1 - - t1 - - t1
1266 f2 - - f2 -U1 - f5 - - f3
1267 f3 -U0 - f1 -U1a- f7 - - f7
1268 f4 - - f4 - - f4 -U2 - f6
1269 f5 -U0 - f0 - - f0 -U3 - f4
1270 f6 - - f6 -U1 - f2 -U2a- f2
1271 f7 -U0 - f3 -U1a- f1 -U3a- f5
1279 for (LoopCnt
= LoopN
-1; LoopCnt
> 0 ; LoopCnt
--){
1282 fly2i
= *(fly2P
+ 1);
1284 fly3i
= *(fly3P
+ 1);
1285 fly4r
= *(fly0P
+ FlyOffsetA
);
1286 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1287 fly5r
= *(fly1P
+ FlyOffsetA
);
1288 fly5i
= *(fly1P
+ FlyOffsetAIm
);
1289 fly6r
= *(fly2P
+ FlyOffsetA
);
1290 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1291 fly7r
= *(fly3P
+ FlyOffsetA
);
1292 fly7i
= *(fly3P
+ FlyOffsetAIm
);
1294 t1r
= fly0r
- U0r
* fly1r
;
1295 t1r
= t1r
+ U0i
* fly1i
;
1296 t1i
= fly0i
- U0i
* fly1r
;
1297 t1i
= t1i
- U0r
* fly1i
;
1298 t0r
= scale
* fly0r
- t1r
;
1299 t0i
= scale
* fly0i
- t1i
;
1301 fly1r
= fly2r
- U0r
* fly3r
;
1302 fly1r
= fly1r
+ U0i
* fly3i
;
1303 fly1i
= fly2i
- U0i
* fly3r
;
1304 fly1i
= fly1i
- U0r
* fly3i
;
1305 fly2r
= scale
* fly2r
- fly1r
;
1306 fly2i
= scale
* fly2i
- fly1i
;
1308 fly0r
= fly4r
- U0r
* fly5r
;
1309 fly0r
= fly0r
+ U0i
* fly5i
;
1310 fly0i
= fly4i
- U0i
* fly5r
;
1311 fly0i
= fly0i
- U0r
* fly5i
;
1312 fly4r
= scale
* fly4r
- fly0r
;
1313 fly4i
= scale
* fly4i
- fly0i
;
1315 fly3r
= fly6r
- U0r
* fly7r
;
1316 fly3r
= fly3r
+ U0i
* fly7i
;
1317 fly3i
= fly6i
- U0i
* fly7r
;
1318 fly3i
= fly3i
- U0r
* fly7i
;
1319 fly6r
= scale
* fly6r
- fly3r
;
1320 fly6i
= scale
* fly6i
- fly3i
;
1323 fly5r
= t0r
- U1r
* fly2r
;
1324 fly5r
= fly5r
+ U1i
* fly2i
;
1325 fly5i
= t0i
- U1i
* fly2r
;
1326 fly5i
= fly5i
- U1r
* fly2i
;
1327 t0r
= scale
* t0r
- fly5r
;
1328 t0i
= scale
* t0i
- fly5i
;
1330 fly7r
= t1r
+ U1i
* fly1r
;
1331 fly7r
= fly7r
+ U1r
* fly1i
;
1332 fly7i
= t1i
- U1r
* fly1r
;
1333 fly7i
= fly7i
+ U1i
* fly1i
;
1334 t1r
= scale
* t1r
- fly7r
;
1335 t1i
= scale
* t1i
- fly7i
;
1337 fly2r
= fly4r
- U1r
* fly6r
;
1338 fly2r
= fly2r
+ U1i
* fly6i
;
1339 fly2i
= fly4i
- U1i
* fly6r
;
1340 fly2i
= fly2i
- U1r
* fly6i
;
1341 fly4r
= scale
* fly4r
- fly2r
;
1342 fly4i
= scale
* fly4i
- fly2i
;
1344 fly1r
= fly0r
+ U1i
* fly3r
;
1345 fly1r
= fly1r
+ U1r
* fly3i
;
1346 fly1i
= fly0i
- U1r
* fly3r
;
1347 fly1i
= fly1i
+ U1i
* fly3i
;
1348 fly0r
= scale
* fly0r
- fly1r
;
1349 fly0i
= scale
* fly0i
- fly1i
;
1351 fly6r
= t0r
- U2r
* fly4r
;
1352 fly6r
= fly6r
+ U2i
* fly4i
;
1353 fly6i
= t0i
- U2i
* fly4r
;
1354 fly6i
= fly6i
- U2r
* fly4i
;
1355 t0r
= scale
* t0r
- fly6r
;
1356 t0i
= scale
* t0i
- fly6i
;
1358 fly3r
= fly5r
- U2i
* fly2r
;
1359 fly3r
= fly3r
- U2r
* fly2i
;
1360 fly3i
= fly5i
+ U2r
* fly2r
;
1361 fly3i
= fly3i
- U2i
* fly2i
;
1362 fly2r
= scale
* fly5r
- fly3r
;
1363 fly2i
= scale
* fly5i
- fly3i
;
1365 fly4r
= t1r
- U3r
* fly0r
;
1366 fly4r
= fly4r
+ U3i
* fly0i
;
1367 fly4i
= t1i
- U3i
* fly0r
;
1368 fly4i
= fly4i
- U3r
* fly0i
;
1369 t1r
= scale
* t1r
- fly4r
;
1370 t1i
= scale
* t1i
- fly4i
;
1372 fly5r
= fly7r
+ U3i
* fly1r
;
1373 fly5r
= fly5r
+ U3r
* fly1i
;
1374 fly5i
= fly7i
- U3r
* fly1r
;
1375 fly5i
= fly5i
+ U3i
* fly1i
;
1376 fly7r
= scale
* fly7r
- fly5r
;
1377 fly7i
= scale
* fly7i
- fly5i
;
1379 *(fly0P
+ FlyOffsetA
) = fly6r
;
1380 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
1384 *(fly2P
+ 1) = fly3i
;
1385 *(fly2P
+ FlyOffsetA
) = fly2r
;
1386 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
1388 fly0r
= *(fly0P
+ FlyOffsetB
);
1389 fly0i
= *(fly0P
+ FlyOffsetBIm
);
1391 *(fly1P
+ FlyOffsetA
) = fly4r
;
1392 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
1396 fly1r
= *(fly1P
+ FlyOffsetB
);
1397 fly1i
= *(fly1P
+ FlyOffsetBIm
);
1399 *(fly3P
+ FlyOffsetA
) = fly5r
;
1400 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
1402 *(fly3P
+ 1) = fly7i
;
1404 fly0P
= (fly0P
+ FlyOffsetB
);
1405 fly1P
= (fly1P
+ FlyOffsetB
);
1406 fly2P
= (fly2P
+ FlyOffsetB
);
1407 fly3P
= (fly3P
+ FlyOffsetB
);
1411 fly2i
= *(fly2P
+ 1);
1413 fly3i
= *(fly3P
+ 1);
1414 fly4r
= *(fly0P
+ FlyOffsetA
);
1415 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1416 fly5r
= *(fly1P
+ FlyOffsetA
);
1417 fly5i
= *(fly1P
+ FlyOffsetAIm
);
1418 fly6r
= *(fly2P
+ FlyOffsetA
);
1419 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1420 fly7r
= *(fly3P
+ FlyOffsetA
);
1421 fly7i
= *(fly3P
+ FlyOffsetAIm
);
1423 t1r
= fly0r
- U0r
* fly1r
;
1424 t1r
= t1r
+ U0i
* fly1i
;
1425 t1i
= fly0i
- U0i
* fly1r
;
1426 t1i
= t1i
- U0r
* fly1i
;
1427 t0r
= scale
* fly0r
- t1r
;
1428 t0i
= scale
* fly0i
- t1i
;
1430 fly1r
= fly2r
- U0r
* fly3r
;
1431 fly1r
= fly1r
+ U0i
* fly3i
;
1432 fly1i
= fly2i
- U0i
* fly3r
;
1433 fly1i
= fly1i
- U0r
* fly3i
;
1434 fly2r
= scale
* fly2r
- fly1r
;
1435 fly2i
= scale
* fly2i
- fly1i
;
1437 fly0r
= fly4r
- U0r
* fly5r
;
1438 fly0r
= fly0r
+ U0i
* fly5i
;
1439 fly0i
= fly4i
- U0i
* fly5r
;
1440 fly0i
= fly0i
- U0r
* fly5i
;
1441 fly4r
= scale
* fly4r
- fly0r
;
1442 fly4i
= scale
* fly4i
- fly0i
;
1444 fly3r
= fly6r
- U0r
* fly7r
;
1445 fly3r
= fly3r
+ U0i
* fly7i
;
1446 fly3i
= fly6i
- U0i
* fly7r
;
1447 fly3i
= fly3i
- U0r
* fly7i
;
1448 fly6r
= scale
* fly6r
- fly3r
;
1449 fly6i
= scale
* fly6i
- fly3i
;
1451 fly5r
= t0r
- U1r
* fly2r
;
1452 fly5r
= fly5r
+ U1i
* fly2i
;
1453 fly5i
= t0i
- U1i
* fly2r
;
1454 fly5i
= fly5i
- U1r
* fly2i
;
1455 t0r
= scale
* t0r
- fly5r
;
1456 t0i
= scale
* t0i
- fly5i
;
1458 fly7r
= t1r
+ U1i
* fly1r
;
1459 fly7r
= fly7r
+ U1r
* fly1i
;
1460 fly7i
= t1i
- U1r
* fly1r
;
1461 fly7i
= fly7i
+ U1i
* fly1i
;
1462 t1r
= scale
* t1r
- fly7r
;
1463 t1i
= scale
* t1i
- fly7i
;
1465 fly2r
= fly4r
- U1r
* fly6r
;
1466 fly2r
= fly2r
+ U1i
* fly6i
;
1467 fly2i
= fly4i
- U1i
* fly6r
;
1468 fly2i
= fly2i
- U1r
* fly6i
;
1469 fly4r
= scale
* fly4r
- fly2r
;
1470 fly4i
= scale
* fly4i
- fly2i
;
1472 fly1r
= fly0r
+ U1i
* fly3r
;
1473 fly1r
= fly1r
+ U1r
* fly3i
;
1474 fly1i
= fly0i
- U1r
* fly3r
;
1475 fly1i
= fly1i
+ U1i
* fly3i
;
1476 fly0r
= scale
* fly0r
- fly1r
;
1477 fly0i
= scale
* fly0i
- fly1i
;
1479 U0i
= *(U0iP
= (U0iP
- NsameU4
));
1480 U0r
= *(U0rP
= (U0rP
+ NsameU4
));
1481 U1r
= *(U1rP
= (U1rP
+ NsameU2
));
1482 U1i
= *(U1iP
= (U1iP
- NsameU2
));
1486 fly6r
= t0r
- U2r
* fly4r
;
1487 fly6r
= fly6r
+ U2i
* fly4i
;
1488 fly6i
= t0i
- U2i
* fly4r
;
1489 fly6i
= fly6i
- U2r
* fly4i
;
1490 t0r
= scale
* t0r
- fly6r
;
1491 t0i
= scale
* t0i
- fly6i
;
1493 fly3r
= fly5r
- U2i
* fly2r
;
1494 fly3r
= fly3r
- U2r
* fly2i
;
1495 fly3i
= fly5i
+ U2r
* fly2r
;
1496 fly3i
= fly3i
- U2i
* fly2i
;
1497 fly2r
= scale
* fly5r
- fly3r
;
1498 fly2i
= scale
* fly5i
- fly3i
;
1500 fly4r
= t1r
- U3r
* fly0r
;
1501 fly4r
= fly4r
+ U3i
* fly0i
;
1502 fly4i
= t1i
- U3i
* fly0r
;
1503 fly4i
= fly4i
- U3r
* fly0i
;
1504 t1r
= scale
* t1r
- fly4r
;
1505 t1i
= scale
* t1i
- fly4i
;
1507 fly5r
= fly7r
+ U3i
* fly1r
;
1508 fly5r
= fly5r
+ U3r
* fly1i
;
1509 fly5i
= fly7i
- U3r
* fly1r
;
1510 fly5i
= fly5i
+ U3i
* fly1i
;
1511 fly7r
= scale
* fly7r
- fly5r
;
1512 fly7i
= scale
* fly7i
- fly5i
;
1514 *(fly0P
+ FlyOffsetA
) = fly6r
;
1515 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
1519 U2r
= *(U2rP
= (U2rP
+ NsameU1
));
1520 U2i
= *(U2iP
= (U2iP
- NsameU1
));
1523 *(fly2P
+ 1) = fly3i
;
1524 *(fly2P
+ FlyOffsetA
) = fly2r
;
1525 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
1526 *(fly1P
+ FlyOffsetA
) = fly4r
;
1527 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
1531 U3r
= *( U2rP
+ U3offset
);
1532 U3i
= *( U2iP
- U3offset
);
1534 *(fly3P
+ FlyOffsetA
) = fly5r
;
1535 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
1537 *(fly3P
+ 1) = fly7i
;
1541 fly1P
= (IOP
+Flyinc
);
1542 fly2P
= (fly1P
+Flyinc
);
1543 fly3P
= (fly2P
+Flyinc
);
1553 Flyinc
= Flyinc
<< 3;
1556 FlyOffsetAIm
= FlyOffsetA
+ 1;
1557 FlyOffsetBIm
= FlyOffsetB
+ 1;
1565 /* compute multiple real input FFTs on 'Rows' consecutively stored arrays */
1566 /* ioptr = pointer to the data in and out */
1567 /* M = log2 of fft size */
1568 /* Rows = number of FFTs to compute */
1569 /* Utbl = Pointer to cosine table */
1571 void rffts(float *ioptr
, long M
, long Rows
, float *Utbl
){
1572 /* Compute in-place real fft on the rows of the input array */
1574 /* M = log2 of fft size */
1575 /* *ioptr = real input data array */
1576 /* *Utbl = cosine table */
1577 /* Rows = number of rows in ioptr array (use Rows of 1 if ioptr is a 1 dimensional array) */
1579 /* *ioptr = output data array in the following order */
1580 /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */
1640 const long BRshift
= MAXMROOT
- ((M
-1)>>1); /* for RFFT */
1641 const long Nrems2
= Ntbl
[(M
-1)-((M
-1)>>1)+1]; /* for RFFT */
1642 const long Nroot_1_ColInc
= (Ntbl
[(M
-1)-1]-Ntbl
[(M
-1)-((M
-1)>>1)])*2; /* for RFFT */
1644 for (;Rows
>0;Rows
--){
1646 M
=M
-1; /* for RFFT */
1648 FlyOffsetA
= Ntbl
[M
] * 2/2;
1649 FlyOffsetAIm
= FlyOffsetA
+ 1;
1650 FlyOffsetB
= FlyOffsetA
+ 2;
1651 FlyOffsetBIm
= FlyOffsetB
+ 1;
1653 /* BitrevR2 ** bit reverse shuffle and first radix 2 stage ******/
1656 for (stage
= 0; stage
< Ntbl
[M
-(M
>>1)]*2; stage
+= Ntbl
[M
>>1]*2){
1657 for (LoopN
= (Ntbl
[(M
>>1)-1]-1); LoopN
>= 0; LoopN
--){
1658 LoopCnt
= (Ntbl
[(M
>>1)-1]-1);
1659 fly0P
= ioptr
+ Nroot_1_ColInc
+ ((int)BRcnt
[LoopN
] >> BRshift
)*(2*2) + stage
;
1660 IOP
= ioptr
+ (LoopN
<<(M
+1)/2) * 2 + stage
;
1661 fly1P
= IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2);
1664 fly1r
= *(fly0P
+FlyOffsetA
);
1665 fly1i
= *(fly0P
+FlyOffsetAIm
);
1666 for (; LoopCnt
> LoopN
;){
1668 fly2i
= *(fly0P
+(2+1));
1669 fly3r
= *(fly0P
+FlyOffsetB
);
1670 fly3i
= *(fly0P
+FlyOffsetBIm
);
1673 fly5r
= *(fly1P
+FlyOffsetA
);
1674 fly5i
= *(fly1P
+FlyOffsetAIm
);
1676 fly6i
= *(fly1P
+(2+1));
1677 fly7r
= *(fly1P
+FlyOffsetB
);
1678 fly7i
= *(fly1P
+FlyOffsetBIm
);
1680 t0r
= fly0r
+ fly1r
;
1681 t0i
= fly0i
+ fly1i
;
1682 fly1r
= fly0r
- fly1r
;
1683 fly1i
= fly0i
- fly1i
;
1684 t1r
= fly2r
+ fly3r
;
1685 t1i
= fly2i
+ fly3i
;
1686 fly3r
= fly2r
- fly3r
;
1687 fly3i
= fly2i
- fly3i
;
1688 fly0r
= fly4r
+ fly5r
;
1689 fly0i
= fly4i
+ fly5i
;
1690 fly5r
= fly4r
- fly5r
;
1691 fly5i
= fly4i
- fly5i
;
1692 fly2r
= fly6r
+ fly7r
;
1693 fly2i
= fly6i
+ fly7i
;
1694 fly7r
= fly6r
- fly7r
;
1695 fly7i
= fly6i
- fly7i
;
1698 *(fly1P
+1) = scale
*t0i
;
1699 *(fly1P
+2) = scale
*fly1r
;
1700 *(fly1P
+(2+1)) = scale
*fly1i
;
1701 *(fly1P
+FlyOffsetA
) = scale
*t1r
;
1702 *(fly1P
+FlyOffsetAIm
) = scale
*t1i
;
1703 *(fly1P
+FlyOffsetB
) = scale
*fly3r
;
1704 *(fly1P
+FlyOffsetBIm
) = scale
*fly3i
;
1705 *fly0P
= scale
*fly0r
;
1706 *(fly0P
+1) = scale
*fly0i
;
1707 *(fly0P
+2) = scale
*fly5r
;
1708 *(fly0P
+(2+1)) = scale
*fly5i
;
1709 *(fly0P
+FlyOffsetA
) = scale
*fly2r
;
1710 *(fly0P
+FlyOffsetAIm
) = scale
*fly2i
;
1711 *(fly0P
+FlyOffsetB
) = scale
*fly7r
;
1712 *(fly0P
+FlyOffsetBIm
) = scale
*fly7i
;
1717 fly1r
= *(fly0P
+FlyOffsetA
);
1718 fly1i
= *(fly0P
+FlyOffsetAIm
);
1720 fly1P
= (IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2));
1723 fly2i
= *(fly0P
+(2+1));
1724 fly3r
= *(fly0P
+FlyOffsetB
);
1725 fly3i
= *(fly0P
+FlyOffsetBIm
);
1727 t0r
= fly0r
+ fly1r
;
1728 t0i
= fly0i
+ fly1i
;
1729 fly1r
= fly0r
- fly1r
;
1730 fly1i
= fly0i
- fly1i
;
1731 t1r
= fly2r
+ fly3r
;
1732 t1i
= fly2i
+ fly3i
;
1733 fly3r
= fly2r
- fly3r
;
1734 fly3i
= fly2i
- fly3i
;
1737 *(fly0P
+1) = scale
*t0i
;
1738 *(fly0P
+2) = scale
*fly1r
;
1739 *(fly0P
+(2+1)) = scale
*fly1i
;
1740 *(fly0P
+FlyOffsetA
) = scale
*t1r
;
1741 *(fly0P
+FlyOffsetAIm
) = scale
*t1i
;
1742 *(fly0P
+FlyOffsetB
) = scale
*fly3r
;
1743 *(fly0P
+FlyOffsetBIm
) = scale
*fly3i
;
1750 /**** FFTC **************/
1757 NsameU4
= Ntbl
[M
+1]/4; /* for RFFT */
1761 if ( (M
-1-(stage
* 3)) != 0 ){
1762 FlyOffsetA
= Flyinc
<< 2;
1763 FlyOffsetB
= FlyOffsetA
<< 1;
1764 FlyOffsetAIm
= FlyOffsetA
+ 1;
1765 FlyOffsetBIm
= FlyOffsetB
+ 1;
1766 if ( (M
-1-(stage
* 3)) == 1 ){
1767 /* 1 radix 2 stage */
1771 fly1P
= (IOP
+Flyinc
);
1772 fly2P
= (fly1P
+Flyinc
);
1773 fly3P
= (fly2P
+Flyinc
);
1787 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
1793 fly2i
= *(fly2P
+ 1);
1795 fly1i
= *(fly3P
+ 1);
1796 fly4r
= *(fly0P
+ FlyOffsetA
);
1797 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1798 fly0r
= *(fly1P
+ FlyOffsetA
);
1799 fly0i
= *(fly1P
+ FlyOffsetAIm
);
1800 fly6r
= *(fly2P
+ FlyOffsetA
);
1801 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1802 fly3r
= *(fly3P
+ FlyOffsetA
);
1803 fly3i
= *(fly3P
+ FlyOffsetAIm
);
1805 fly5r
= t0r
- fly2r
;
1806 fly5i
= t0i
- fly2i
;
1810 fly7r
= t1r
- fly1i
;
1811 fly7i
= t1i
+ fly1r
;
1815 fly2r
= fly4r
- fly6r
;
1816 fly2i
= fly4i
- fly6i
;
1817 fly4r
= fly4r
+ fly6r
;
1818 fly4i
= fly4i
+ fly6i
;
1820 fly1r
= fly0r
- fly3i
;
1821 fly1i
= fly0i
+ fly3r
;
1822 fly0r
= fly0r
+ fly3i
;
1823 fly0i
= fly0i
- fly3r
;
1826 *(fly2P
+ 1) = fly5i
;
1830 *(fly3P
+ 1) = fly7i
;
1833 *(fly2P
+ FlyOffsetA
) = fly2r
;
1834 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
1835 *(fly0P
+ FlyOffsetA
) = fly4r
;
1836 *(fly0P
+ FlyOffsetAIm
) = fly4i
;
1837 *(fly3P
+ FlyOffsetA
) = fly1r
;
1838 *(fly3P
+ FlyOffsetAIm
) = fly1i
;
1839 *(fly1P
+ FlyOffsetA
) = fly0r
;
1840 *(fly1P
+ FlyOffsetAIm
) = fly0i
;
1842 fly0P
= (fly0P
+ FlyOffsetB
);
1843 fly1P
= (fly1P
+ FlyOffsetB
);
1844 fly2P
= (fly2P
+ FlyOffsetB
);
1845 fly3P
= (fly3P
+ FlyOffsetB
);
1851 Flyinc
= Flyinc
<< 1;
1854 /* 1 radix 4 stage */
1857 U3r
= 0.7071067811865475244008443621; /* sqrt(0.5); */
1860 fly1P
= (IOP
+Flyinc
);
1861 fly2P
= (fly1P
+Flyinc
);
1862 fly3P
= (fly2P
+Flyinc
);
1873 f3 - -i- f1 -U3a- f2
1876 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
1882 fly2i
= *(fly2P
+ 1);
1884 fly1i
= *(fly3P
+ 1);
1885 fly4r
= *(fly0P
+ FlyOffsetA
);
1886 fly4i
= *(fly0P
+ FlyOffsetAIm
);
1887 fly0r
= *(fly1P
+ FlyOffsetA
);
1888 fly0i
= *(fly1P
+ FlyOffsetAIm
);
1889 fly6r
= *(fly2P
+ FlyOffsetA
);
1890 fly6i
= *(fly2P
+ FlyOffsetAIm
);
1891 fly3r
= *(fly3P
+ FlyOffsetA
);
1892 fly3i
= *(fly3P
+ FlyOffsetAIm
);
1894 fly5r
= t0r
- fly2r
;
1895 fly5i
= t0i
- fly2i
;
1899 fly7r
= t1r
- fly1i
;
1900 fly7i
= t1i
+ fly1r
;
1904 fly2r
= fly4r
- fly6r
;
1905 fly2i
= fly4i
- fly6i
;
1906 fly4r
= fly4r
+ fly6r
;
1907 fly4i
= fly4i
+ fly6i
;
1909 fly1r
= fly0r
- fly3i
;
1910 fly1i
= fly0i
+ fly3r
;
1911 fly0r
= fly0r
+ fly3i
;
1912 fly0i
= fly0i
- fly3r
;
1914 fly6r
= t0r
- fly4r
;
1915 fly6i
= t0i
- fly4i
;
1919 fly3r
= fly5r
- fly2i
;
1920 fly3i
= fly5i
+ fly2r
;
1921 fly5r
= fly5r
+ fly2i
;
1922 fly5i
= fly5i
- fly2r
;
1924 fly4r
= t1r
- U3r
* fly0r
;
1925 fly4r
= fly4r
- U3i
* fly0i
;
1926 fly4i
= t1i
+ U3i
* fly0r
;
1927 fly4i
= fly4i
- U3r
* fly0i
;
1928 t1r
= scale
* t1r
- fly4r
;
1929 t1i
= scale
* t1i
- fly4i
;
1931 fly2r
= fly7r
+ U3i
* fly1r
;
1932 fly2r
= fly2r
- U3r
* fly1i
;
1933 fly2i
= fly7i
+ U3r
* fly1r
;
1934 fly2i
= fly2i
+ U3i
* fly1i
;
1935 fly7r
= scale
* fly7r
- fly2r
;
1936 fly7i
= scale
* fly7i
- fly2i
;
1938 *(fly0P
+ FlyOffsetA
) = fly6r
;
1939 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
1942 *(fly2P
+ FlyOffsetA
) = fly3r
;
1943 *(fly2P
+ FlyOffsetAIm
) = fly3i
;
1945 *(fly2P
+ 1) = fly5i
;
1946 *(fly1P
+ FlyOffsetA
) = fly4r
;
1947 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
1950 *(fly3P
+ FlyOffsetA
) = fly2r
;
1951 *(fly3P
+ FlyOffsetAIm
) = fly2i
;
1953 *(fly3P
+ 1) = fly7i
;
1955 fly0P
= (fly0P
+ FlyOffsetB
);
1956 fly1P
= (fly1P
+ FlyOffsetB
);
1957 fly2P
= (fly2P
+ FlyOffsetB
);
1958 fly3P
= (fly3P
+ FlyOffsetB
);
1965 Flyinc
= Flyinc
<< 2;
1969 NsameU2
= NsameU4
>> 1;
1970 NsameU1
= NsameU2
>> 1;
1972 FlyOffsetA
= Flyinc
<< 2;
1973 FlyOffsetB
= FlyOffsetA
<< 1;
1974 FlyOffsetAIm
= FlyOffsetA
+ 1;
1975 FlyOffsetBIm
= FlyOffsetB
+ 1;
1978 /* ****** RADIX 8 Stages */
1979 for (stage
= stage
<<1; stage
> 0 ; stage
--){
1981 /* an fft stage is done in two parts to ease use of the single quadrant cos table */
1983 /* fftcalc1(iobuf, Utbl, N, NdiffU, LoopN); */
1986 U0iP
= &Utbl
[Ntbl
[M
-1]]; /* for RFFT */
1991 U3offset
= (Ntbl
[M
+1]) / 8; /* for RFFT */
2001 U3r
= *( U2rP
+ U3offset
);
2002 U3i
= *( U2iP
- U3offset
);
2006 fly1P
= (IOP
+Flyinc
);
2007 fly2P
= (fly1P
+Flyinc
);
2008 fly3P
= (fly2P
+Flyinc
);
2010 for (diffUcnt
= (NdiffU
)>>1; diffUcnt
> 0; diffUcnt
--){
2014 f0 - - t0 - - t0 - - t0
2015 f1 -U0 - t1 - - t1 - - t1
2016 f2 - - f2 -U1 - f5 - - f3
2017 f3 -U0 - f1 -U1a- f7 - - f7
2018 f4 - - f4 - - f4 -U2 - f6
2019 f5 -U0 - f0 - - f0 -U3 - f4
2020 f6 - - f6 -U1 - f2 -U2a- f2
2021 f7 -U0 - f3 -U1a- f1 -U3a- f5
2029 for (LoopCnt
= LoopN
-1; LoopCnt
> 0 ; LoopCnt
--){
2032 fly2i
= *(fly2P
+ 1);
2034 fly3i
= *(fly3P
+ 1);
2035 fly4r
= *(fly0P
+ FlyOffsetA
);
2036 fly4i
= *(fly0P
+ FlyOffsetAIm
);
2037 fly5r
= *(fly1P
+ FlyOffsetA
);
2038 fly5i
= *(fly1P
+ FlyOffsetAIm
);
2039 fly6r
= *(fly2P
+ FlyOffsetA
);
2040 fly6i
= *(fly2P
+ FlyOffsetAIm
);
2041 fly7r
= *(fly3P
+ FlyOffsetA
);
2042 fly7i
= *(fly3P
+ FlyOffsetAIm
);
2044 t1r
= fly0r
- U0r
* fly1r
;
2045 t1r
= t1r
- U0i
* fly1i
;
2046 t1i
= fly0i
+ U0i
* fly1r
;
2047 t1i
= t1i
- U0r
* fly1i
;
2048 t0r
= scale
* fly0r
- t1r
;
2049 t0i
= scale
* fly0i
- t1i
;
2051 fly1r
= fly2r
- U0r
* fly3r
;
2052 fly1r
= fly1r
- U0i
* fly3i
;
2053 fly1i
= fly2i
+ U0i
* fly3r
;
2054 fly1i
= fly1i
- U0r
* fly3i
;
2055 fly2r
= scale
* fly2r
- fly1r
;
2056 fly2i
= scale
* fly2i
- fly1i
;
2058 fly0r
= fly4r
- U0r
* fly5r
;
2059 fly0r
= fly0r
- U0i
* fly5i
;
2060 fly0i
= fly4i
+ U0i
* fly5r
;
2061 fly0i
= fly0i
- U0r
* fly5i
;
2062 fly4r
= scale
* fly4r
- fly0r
;
2063 fly4i
= scale
* fly4i
- fly0i
;
2065 fly3r
= fly6r
- U0r
* fly7r
;
2066 fly3r
= fly3r
- U0i
* fly7i
;
2067 fly3i
= fly6i
+ U0i
* fly7r
;
2068 fly3i
= fly3i
- U0r
* fly7i
;
2069 fly6r
= scale
* fly6r
- fly3r
;
2070 fly6i
= scale
* fly6i
- fly3i
;
2073 fly5r
= t0r
- U1r
* fly2r
;
2074 fly5r
= fly5r
- U1i
* fly2i
;
2075 fly5i
= t0i
+ U1i
* fly2r
;
2076 fly5i
= fly5i
- U1r
* fly2i
;
2077 t0r
= scale
* t0r
- fly5r
;
2078 t0i
= scale
* t0i
- fly5i
;
2080 fly7r
= t1r
+ U1i
* fly1r
;
2081 fly7r
= fly7r
- U1r
* fly1i
;
2082 fly7i
= t1i
+ U1r
* fly1r
;
2083 fly7i
= fly7i
+ U1i
* fly1i
;
2084 t1r
= scale
* t1r
- fly7r
;
2085 t1i
= scale
* t1i
- fly7i
;
2087 fly2r
= fly4r
- U1r
* fly6r
;
2088 fly2r
= fly2r
- U1i
* fly6i
;
2089 fly2i
= fly4i
+ U1i
* fly6r
;
2090 fly2i
= fly2i
- U1r
* fly6i
;
2091 fly4r
= scale
* fly4r
- fly2r
;
2092 fly4i
= scale
* fly4i
- fly2i
;
2094 fly1r
= fly0r
+ U1i
* fly3r
;
2095 fly1r
= fly1r
- U1r
* fly3i
;
2096 fly1i
= fly0i
+ U1r
* fly3r
;
2097 fly1i
= fly1i
+ U1i
* fly3i
;
2098 fly0r
= scale
* fly0r
- fly1r
;
2099 fly0i
= scale
* fly0i
- fly1i
;
2101 fly6r
= t0r
- U2r
* fly4r
;
2102 fly6r
= fly6r
- U2i
* fly4i
;
2103 fly6i
= t0i
+ U2i
* fly4r
;
2104 fly6i
= fly6i
- U2r
* fly4i
;
2105 t0r
= scale
* t0r
- fly6r
;
2106 t0i
= scale
* t0i
- fly6i
;
2108 fly3r
= fly5r
- U2i
* fly2r
;
2109 fly3r
= fly3r
+ U2r
* fly2i
;
2110 fly3i
= fly5i
- U2r
* fly2r
;
2111 fly3i
= fly3i
- U2i
* fly2i
;
2112 fly2r
= scale
* fly5r
- fly3r
;
2113 fly2i
= scale
* fly5i
- fly3i
;
2115 fly4r
= t1r
- U3r
* fly0r
;
2116 fly4r
= fly4r
- U3i
* fly0i
;
2117 fly4i
= t1i
+ U3i
* fly0r
;
2118 fly4i
= fly4i
- U3r
* fly0i
;
2119 t1r
= scale
* t1r
- fly4r
;
2120 t1i
= scale
* t1i
- fly4i
;
2122 fly5r
= fly7r
+ U3i
* fly1r
;
2123 fly5r
= fly5r
- U3r
* fly1i
;
2124 fly5i
= fly7i
+ U3r
* fly1r
;
2125 fly5i
= fly5i
+ U3i
* fly1i
;
2126 fly7r
= scale
* fly7r
- fly5r
;
2127 fly7i
= scale
* fly7i
- fly5i
;
2129 *(fly0P
+ FlyOffsetA
) = fly6r
;
2130 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
2134 *(fly2P
+ 1) = fly3i
;
2135 *(fly2P
+ FlyOffsetA
) = fly2r
;
2136 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
2138 fly0r
= *(fly0P
+ FlyOffsetB
);
2139 fly0i
= *(fly0P
+ FlyOffsetBIm
);
2141 *(fly1P
+ FlyOffsetA
) = fly4r
;
2142 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
2146 fly1r
= *(fly1P
+ FlyOffsetB
);
2147 fly1i
= *(fly1P
+ FlyOffsetBIm
);
2149 *(fly3P
+ FlyOffsetA
) = fly5r
;
2150 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
2152 *(fly3P
+ 1) = fly7i
;
2154 fly0P
= (fly0P
+ FlyOffsetB
);
2155 fly1P
= (fly1P
+ FlyOffsetB
);
2156 fly2P
= (fly2P
+ FlyOffsetB
);
2157 fly3P
= (fly3P
+ FlyOffsetB
);
2161 fly2i
= *(fly2P
+ 1);
2163 fly3i
= *(fly3P
+ 1);
2164 fly4r
= *(fly0P
+ FlyOffsetA
);
2165 fly4i
= *(fly0P
+ FlyOffsetAIm
);
2166 fly5r
= *(fly1P
+ FlyOffsetA
);
2167 fly5i
= *(fly1P
+ FlyOffsetAIm
);
2168 fly6r
= *(fly2P
+ FlyOffsetA
);
2169 fly6i
= *(fly2P
+ FlyOffsetAIm
);
2170 fly7r
= *(fly3P
+ FlyOffsetA
);
2171 fly7i
= *(fly3P
+ FlyOffsetAIm
);
2173 t1r
= fly0r
- U0r
* fly1r
;
2174 t1r
= t1r
- U0i
* fly1i
;
2175 t1i
= fly0i
+ U0i
* fly1r
;
2176 t1i
= t1i
- U0r
* fly1i
;
2177 t0r
= scale
* fly0r
- t1r
;
2178 t0i
= scale
* fly0i
- t1i
;
2180 fly1r
= fly2r
- U0r
* fly3r
;
2181 fly1r
= fly1r
- U0i
* fly3i
;
2182 fly1i
= fly2i
+ U0i
* fly3r
;
2183 fly1i
= fly1i
- U0r
* fly3i
;
2184 fly2r
= scale
* fly2r
- fly1r
;
2185 fly2i
= scale
* fly2i
- fly1i
;
2187 fly0r
= fly4r
- U0r
* fly5r
;
2188 fly0r
= fly0r
- U0i
* fly5i
;
2189 fly0i
= fly4i
+ U0i
* fly5r
;
2190 fly0i
= fly0i
- U0r
* fly5i
;
2191 fly4r
= scale
* fly4r
- fly0r
;
2192 fly4i
= scale
* fly4i
- fly0i
;
2194 fly3r
= fly6r
- U0r
* fly7r
;
2195 fly3r
= fly3r
- U0i
* fly7i
;
2196 fly3i
= fly6i
+ U0i
* fly7r
;
2197 fly3i
= fly3i
- U0r
* fly7i
;
2198 fly6r
= scale
* fly6r
- fly3r
;
2199 fly6i
= scale
* fly6i
- fly3i
;
2202 fly5r
= t0r
- U1r
* fly2r
;
2203 fly5r
= fly5r
- U1i
* fly2i
;
2204 fly5i
= t0i
+ U1i
* fly2r
;
2205 fly5i
= fly5i
- U1r
* fly2i
;
2206 t0r
= scale
* t0r
- fly5r
;
2207 t0i
= scale
* t0i
- fly5i
;
2209 fly7r
= t1r
+ U1i
* fly1r
;
2210 fly7r
= fly7r
- U1r
* fly1i
;
2211 fly7i
= t1i
+ U1r
* fly1r
;
2212 fly7i
= fly7i
+ U1i
* fly1i
;
2213 t1r
= scale
* t1r
- fly7r
;
2214 t1i
= scale
* t1i
- fly7i
;
2216 fly2r
= fly4r
- U1r
* fly6r
;
2217 fly2r
= fly2r
- U1i
* fly6i
;
2218 fly2i
= fly4i
+ U1i
* fly6r
;
2219 fly2i
= fly2i
- U1r
* fly6i
;
2220 fly4r
= scale
* fly4r
- fly2r
;
2221 fly4i
= scale
* fly4i
- fly2i
;
2223 fly1r
= fly0r
+ U1i
* fly3r
;
2224 fly1r
= fly1r
- U1r
* fly3i
;
2225 fly1i
= fly0i
+ U1r
* fly3r
;
2226 fly1i
= fly1i
+ U1i
* fly3i
;
2227 fly0r
= scale
* fly0r
- fly1r
;
2228 fly0i
= scale
* fly0i
- fly1i
;
2230 U0i
= *(U0iP
= (U0iP
- NsameU4
));
2231 U0r
= *(U0rP
= (U0rP
+ NsameU4
));
2232 U1r
= *(U1rP
= (U1rP
+ NsameU2
));
2233 U1i
= *(U1iP
= (U1iP
- NsameU2
));
2237 fly6r
= t0r
- U2r
* fly4r
;
2238 fly6r
= fly6r
- U2i
* fly4i
;
2239 fly6i
= t0i
+ U2i
* fly4r
;
2240 fly6i
= fly6i
- U2r
* fly4i
;
2241 t0r
= scale
* t0r
- fly6r
;
2242 t0i
= scale
* t0i
- fly6i
;
2244 fly3r
= fly5r
- U2i
* fly2r
;
2245 fly3r
= fly3r
+ U2r
* fly2i
;
2246 fly3i
= fly5i
- U2r
* fly2r
;
2247 fly3i
= fly3i
- U2i
* fly2i
;
2248 fly2r
= scale
* fly5r
- fly3r
;
2249 fly2i
= scale
* fly5i
- fly3i
;
2251 fly4r
= t1r
- U3r
* fly0r
;
2252 fly4r
= fly4r
- U3i
* fly0i
;
2253 fly4i
= t1i
+ U3i
* fly0r
;
2254 fly4i
= fly4i
- U3r
* fly0i
;
2255 t1r
= scale
* t1r
- fly4r
;
2256 t1i
= scale
* t1i
- fly4i
;
2258 fly5r
= fly7r
+ U3i
* fly1r
;
2259 fly5r
= fly5r
- U3r
* fly1i
;
2260 fly5i
= fly7i
+ U3r
* fly1r
;
2261 fly5i
= fly5i
+ U3i
* fly1i
;
2262 fly7r
= scale
* fly7r
- fly5r
;
2263 fly7i
= scale
* fly7i
- fly5i
;
2265 *(fly0P
+ FlyOffsetA
) = fly6r
;
2266 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
2270 U2r
= *(U2rP
= (U2rP
+ NsameU1
));
2271 U2i
= *(U2iP
= (U2iP
- NsameU1
));
2274 *(fly2P
+ 1) = fly3i
;
2275 *(fly2P
+ FlyOffsetA
) = fly2r
;
2276 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
2277 *(fly1P
+ FlyOffsetA
) = fly4r
;
2278 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
2282 U3r
= *( U2rP
+ U3offset
);
2283 U3i
= *( U2iP
- U3offset
);
2285 *(fly3P
+ FlyOffsetA
) = fly5r
;
2286 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
2288 *(fly3P
+ 1) = fly7i
;
2292 fly1P
= (IOP
+Flyinc
);
2293 fly2P
= (fly1P
+Flyinc
);
2294 fly3P
= (fly2P
+Flyinc
);
2304 Flyinc
= Flyinc
<< 3;
2307 FlyOffsetAIm
= FlyOffsetA
+ 1;
2308 FlyOffsetBIm
= FlyOffsetB
+ 1;
2315 FlyOffsetA
= Ntbl
[M
] * 2/4;
2316 FlyOffsetAIm
= Ntbl
[M
] * 2/4 + 1;
2320 fly0P
= (IOP
+ Ntbl
[M
]*2/4);
2321 fly1P
= (IOP
+ Ntbl
[M
]*2/8);
2323 U0rP
= &Utbl
[Ntbl
[M
-3]];
2330 fly1i
= *(fly0P
+ 1);
2332 fly2i
= *(fly1P
+ 1);
2333 fly3r
= *(fly1P
+ FlyOffsetA
);
2334 fly3i
= *(fly1P
+ FlyOffsetAIm
);
2336 t0r
= scale
* fly0r
+ scale
* fly0i
; /* compute Re(x[0]) */
2337 t0i
= scale
* fly0r
- scale
* fly0i
; /* compute Re(x[N/2]) */
2338 t1r
= scale
* fly1r
;
2339 t1i
= -scale
* fly1i
;
2341 fly0r
= fly2r
+ fly3r
;
2342 fly0i
= fly2i
- fly3i
;
2343 fly1r
= fly2i
+ fly3i
;
2344 fly1i
= fly3r
- fly2r
;
2346 fly2r
= fly0r
+ U0r
* fly1r
;
2347 fly2r
= fly2r
+ U0r
* fly1i
;
2348 fly2i
= fly0i
- U0r
* fly1r
;
2349 fly2i
= fly2i
+ U0r
* fly1i
;
2350 fly3r
= scale
* fly0r
- fly2r
;
2351 fly3i
= fly2i
- scale
* fly0i
;
2358 *(fly1P
+ 1) = fly2i
;
2359 *(fly1P
+ FlyOffsetA
) = fly3r
;
2360 *(fly1P
+ FlyOffsetAIm
) = fly3i
;
2363 U0iP
= &Utbl
[Ntbl
[M
-2]-1];
2369 fly1P
= (IOP
+ (Ntbl
[M
-2]-1)*2);
2379 for (diffUcnt
= Ntbl
[M
-3]-1; diffUcnt
> 0 ; diffUcnt
--){
2382 fly0i
= *(fly0P
+ 1);
2383 fly1r
= *(fly1P
+ FlyOffsetA
);
2384 fly1i
= *(fly1P
+ FlyOffsetAIm
);
2386 fly2i
= *(fly1P
+ 1);
2387 fly3r
= *(fly0P
+ FlyOffsetA
);
2388 fly3i
= *(fly0P
+ FlyOffsetAIm
);
2390 t0r
= fly0r
+ fly1r
;
2391 t0i
= fly0i
- fly1i
;
2392 t1r
= fly0i
+ fly1i
;
2393 t1i
= fly1r
- fly0r
;
2395 fly0r
= fly2r
+ fly3r
;
2396 fly0i
= fly2i
- fly3i
;
2397 fly1r
= fly2i
+ fly3i
;
2398 fly1i
= fly3r
- fly2r
;
2400 fly2r
= t0r
+ U0r
* t1r
;
2401 fly2r
= fly2r
+ U0i
* t1i
;
2402 fly2i
= t0i
- U0i
* t1r
;
2403 fly2i
= fly2i
+ U0r
* t1i
;
2404 fly3r
= scale
* t0r
- fly2r
;
2405 fly3i
= fly2i
- scale
* t0i
;
2407 t0r
= fly0r
+ U0i
* fly1r
;
2408 t0r
= t0r
+ U0r
* fly1i
;
2409 t0i
= fly0i
- U0r
* fly1r
;
2410 t0i
= t0i
+ U0i
* fly1i
;
2411 t1r
= scale
* fly0r
- t0r
;
2412 t1i
= t0i
- scale
* fly0i
;
2415 *(fly0P
+ 1) = fly2i
;
2416 *(fly1P
+ FlyOffsetA
) = fly3r
;
2417 *(fly1P
+ FlyOffsetAIm
) = fly3i
;
2419 U0r
= *(U0rP
= (U0rP
+ 1));
2420 U0i
= *(U0iP
= (U0iP
- 1));
2424 *(fly0P
+ FlyOffsetA
) = t1r
;
2425 *(fly0P
+ FlyOffsetAIm
) = t1i
;
2435 void riffts(float *ioptr
, long M
, long Rows
, float *Utbl
){
2436 /* Compute in-place real ifft on the rows of the input array */
2438 /* M = log2 of fft size */
2439 /* *ioptr = input data array in the following order */
2440 /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */
2441 /* *Utbl = cosine table */
2442 /* Rows = number of rows in ioptr array (use Rows of 1 if ioptr is a 1 dimensional array) */
2444 /* *ioptr = real output data array */
2504 const long BRshift
= MAXMROOT
- ((M
-1)>>1); /* for RIFFT */
2505 const long Nrems2
= Ntbl
[(M
-1)-((M
-1)>>1)+1]; /* for RIFFT */
2506 const long Nroot_1_ColInc
= (Ntbl
[(M
-1)-1]-Ntbl
[(M
-1)-((M
-1)>>1)])*2; /* for RIFFT */
2508 for (;Rows
>0;Rows
--){
2512 FlyOffsetA
= Ntbl
[M
] * 2/4;
2513 FlyOffsetAIm
= Ntbl
[M
] * 2/4 + 1;
2517 fly0P
= (IOP
+ Ntbl
[M
]*2/4);
2518 fly1P
= (IOP
+ Ntbl
[M
]*2/8);
2520 U0rP
= &Utbl
[Ntbl
[M
-3]];
2527 fly1i
= *(fly0P
+ 1);
2529 fly2i
= *(fly1P
+ 1);
2530 fly3r
= *(fly1P
+ FlyOffsetA
);
2531 fly3i
= *(fly1P
+ FlyOffsetAIm
);
2533 t0r
= fly0r
+ fly0i
;
2534 t0i
= fly0r
- fly0i
;
2535 t1r
= fly1r
+ fly1r
;
2536 t1i
= -fly1i
- fly1i
;
2538 fly0r
= fly2r
+ fly3r
;
2539 fly0i
= fly2i
- fly3i
;
2540 fly1r
= fly2r
- fly3r
;
2541 fly1i
= fly2i
+ fly3i
;
2543 fly3r
= fly1r
* U0r
;
2544 fly3r
= fly3r
- U0r
* fly1i
;
2545 fly3i
= fly1r
* U0r
;
2546 fly3i
= fly3i
+ U0r
* fly1i
;
2548 fly2r
= fly0r
- fly3i
;
2549 fly2i
= fly0i
+ fly3r
;
2550 fly1r
= fly0r
+ fly3i
;
2551 fly1i
= -fly0i
+ fly3r
;
2558 *(fly1P
+ 1) = fly2i
;
2559 *(fly1P
+ FlyOffsetA
) = fly1r
;
2560 *(fly1P
+ FlyOffsetAIm
) = fly1i
;
2563 U0iP
= &Utbl
[Ntbl
[M
-2]-1];
2569 fly1P
= (IOP
+ (Ntbl
[M
-2]-1)*2);
2579 for (diffUcnt
= Ntbl
[M
-3]-1; diffUcnt
> 0 ; diffUcnt
--){
2582 fly0i
= *(fly0P
+ 1);
2583 fly1r
= *(fly1P
+ FlyOffsetA
);
2584 fly1i
= *(fly1P
+ FlyOffsetAIm
);
2586 fly2i
= *(fly1P
+ 1);
2587 fly3r
= *(fly0P
+ FlyOffsetA
);
2588 fly3i
= *(fly0P
+ FlyOffsetAIm
);
2590 t0r
= fly0r
+ fly1r
;
2591 t0i
= fly0i
- fly1i
;
2592 t1r
= fly0r
- fly1r
;
2593 t1i
= fly0i
+ fly1i
;
2595 fly0r
= fly2r
+ fly3r
;
2596 fly0i
= fly2i
- fly3i
;
2597 fly1r
= fly2r
- fly3r
;
2598 fly1i
= fly2i
+ fly3i
;
2602 fly3r
= fly3r
- U0i
* t1i
;
2604 fly3i
= fly3i
+ U0r
* t1i
;
2607 t1r
= t1r
- U0r
* fly1i
;
2609 t1i
= t1i
+ U0i
* fly1i
;
2612 fly2r
= t0r
- fly3i
;
2613 fly2i
= t0i
+ fly3r
;
2614 fly1r
= t0r
+ fly3i
;
2615 fly1i
= -t0i
+ fly3r
;
2619 fly3r
= fly0r
+ t1i
;
2620 fly3i
= -fly0i
+ t1r
;
2624 *(fly0P
+ 1) = fly2i
;
2625 *(fly1P
+ FlyOffsetA
) = fly1r
;
2626 *(fly1P
+ FlyOffsetAIm
) = fly1i
;
2628 U0r
= *(U0rP
= (U0rP
+ 1));
2629 U0i
= *(U0iP
= (U0iP
- 1));
2633 *(fly0P
+ FlyOffsetA
) = fly3r
;
2634 *(fly0P
+ FlyOffsetAIm
) = fly3i
;
2640 M
=M
-1; /* for RIFFT */
2642 FlyOffsetA
= Ntbl
[M
] * 2/2;
2643 FlyOffsetAIm
= FlyOffsetA
+ 1;
2644 FlyOffsetB
= FlyOffsetA
+ 2;
2645 FlyOffsetBIm
= FlyOffsetB
+ 1;
2647 /* BitrevR2 ** bit reverse shuffle and first radix 2 stage ******/
2649 scale
= 1./Ntbl
[M
+1];
2650 for (stage
= 0; stage
< Ntbl
[M
-(M
>>1)]*2; stage
+= Ntbl
[M
>>1]*2){
2651 for (LoopN
= (Ntbl
[(M
>>1)-1]-1); LoopN
>= 0; LoopN
--){
2652 LoopCnt
= (Ntbl
[(M
>>1)-1]-1);
2653 fly0P
= ioptr
+ Nroot_1_ColInc
+ ((int)BRcnt
[LoopN
] >> BRshift
)*(2*2) + stage
;
2654 IOP
= ioptr
+ (LoopN
<<(M
+1)/2) * 2 + stage
;
2655 fly1P
= IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2);
2658 fly1r
= *(fly0P
+FlyOffsetA
);
2659 fly1i
= *(fly0P
+FlyOffsetAIm
);
2660 for (; LoopCnt
> LoopN
;){
2662 fly2i
= *(fly0P
+(2+1));
2663 fly3r
= *(fly0P
+FlyOffsetB
);
2664 fly3i
= *(fly0P
+FlyOffsetBIm
);
2667 fly5r
= *(fly1P
+FlyOffsetA
);
2668 fly5i
= *(fly1P
+FlyOffsetAIm
);
2670 fly6i
= *(fly1P
+(2+1));
2671 fly7r
= *(fly1P
+FlyOffsetB
);
2672 fly7i
= *(fly1P
+FlyOffsetBIm
);
2674 t0r
= fly0r
+ fly1r
;
2675 t0i
= fly0i
+ fly1i
;
2676 fly1r
= fly0r
- fly1r
;
2677 fly1i
= fly0i
- fly1i
;
2678 t1r
= fly2r
+ fly3r
;
2679 t1i
= fly2i
+ fly3i
;
2680 fly3r
= fly2r
- fly3r
;
2681 fly3i
= fly2i
- fly3i
;
2682 fly0r
= fly4r
+ fly5r
;
2683 fly0i
= fly4i
+ fly5i
;
2684 fly5r
= fly4r
- fly5r
;
2685 fly5i
= fly4i
- fly5i
;
2686 fly2r
= fly6r
+ fly7r
;
2687 fly2i
= fly6i
+ fly7i
;
2688 fly7r
= fly6r
- fly7r
;
2689 fly7i
= fly6i
- fly7i
;
2691 *(fly1P
) = scale
*t0r
;
2692 *(fly1P
+1) = scale
*t0i
;
2693 *(fly1P
+2) = scale
*fly1r
;
2694 *(fly1P
+(2+1)) = scale
*fly1i
;
2695 *(fly1P
+FlyOffsetA
) = scale
*t1r
;
2696 *(fly1P
+FlyOffsetAIm
) = scale
*t1i
;
2697 *(fly1P
+FlyOffsetB
) = scale
*fly3r
;
2698 *(fly1P
+FlyOffsetBIm
) = scale
*fly3i
;
2699 *(fly0P
) = scale
*fly0r
;
2700 *(fly0P
+1) = scale
*fly0i
;
2701 *(fly0P
+2) = scale
*fly5r
;
2702 *(fly0P
+(2+1)) = scale
*fly5i
;
2703 *(fly0P
+FlyOffsetA
) = scale
*fly2r
;
2704 *(fly0P
+FlyOffsetAIm
) = scale
*fly2i
;
2705 *(fly0P
+FlyOffsetB
) = scale
*fly7r
;
2706 *(fly0P
+FlyOffsetBIm
) = scale
*fly7i
;
2711 fly1r
= *(fly0P
+FlyOffsetA
);
2712 fly1i
= *(fly0P
+FlyOffsetAIm
);
2714 fly1P
= (IOP
+ ((int)BRcnt
[LoopCnt
] >> BRshift
)*(2*2));
2717 fly2i
= *(fly0P
+(2+1));
2718 fly3r
= *(fly0P
+FlyOffsetB
);
2719 fly3i
= *(fly0P
+FlyOffsetBIm
);
2721 t0r
= fly0r
+ fly1r
;
2722 t0i
= fly0i
+ fly1i
;
2723 fly1r
= fly0r
- fly1r
;
2724 fly1i
= fly0i
- fly1i
;
2725 t1r
= fly2r
+ fly3r
;
2726 t1i
= fly2i
+ fly3i
;
2727 fly3r
= fly2r
- fly3r
;
2728 fly3i
= fly2i
- fly3i
;
2730 *(fly0P
) = scale
*t0r
;
2731 *(fly0P
+1) = scale
*t0i
;
2732 *(fly0P
+2) = scale
*fly1r
;
2733 *(fly0P
+(2+1)) = scale
*fly1i
;
2734 *(fly0P
+FlyOffsetA
) = scale
*t1r
;
2735 *(fly0P
+FlyOffsetAIm
) = scale
*t1i
;
2736 *(fly0P
+FlyOffsetB
) = scale
*fly3r
;
2737 *(fly0P
+FlyOffsetBIm
) = scale
*fly3i
;
2742 /**** FFTC **************/
2749 NsameU4
= Ntbl
[M
+1]/4; /* for RIFFT */
2753 if ( (M
-1-(stage
* 3)) != 0 ){
2754 FlyOffsetA
= Flyinc
<< 2;
2755 FlyOffsetB
= FlyOffsetA
<< 1;
2756 FlyOffsetAIm
= FlyOffsetA
+ 1;
2757 FlyOffsetBIm
= FlyOffsetB
+ 1;
2758 if ( (M
-1-(stage
* 3)) == 1 ){
2759 /* 1 radix 2 stage */
2763 fly1P
= (IOP
+Flyinc
);
2764 fly2P
= (fly1P
+Flyinc
);
2765 fly3P
= (fly2P
+Flyinc
);
2779 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
2785 fly2i
= *(fly2P
+ 1);
2787 fly1i
= *(fly3P
+ 1);
2788 fly4r
= *(fly0P
+ FlyOffsetA
);
2789 fly4i
= *(fly0P
+ FlyOffsetAIm
);
2790 fly0r
= *(fly1P
+ FlyOffsetA
);
2791 fly0i
= *(fly1P
+ FlyOffsetAIm
);
2792 fly6r
= *(fly2P
+ FlyOffsetA
);
2793 fly6i
= *(fly2P
+ FlyOffsetAIm
);
2794 fly3r
= *(fly3P
+ FlyOffsetA
);
2795 fly3i
= *(fly3P
+ FlyOffsetAIm
);
2797 fly5r
= t0r
- fly2r
;
2798 fly5i
= t0i
- fly2i
;
2802 fly7r
= t1r
+ fly1i
;
2803 fly7i
= t1i
- fly1r
;
2807 fly2r
= fly4r
- fly6r
;
2808 fly2i
= fly4i
- fly6i
;
2809 fly4r
= fly4r
+ fly6r
;
2810 fly4i
= fly4i
+ fly6i
;
2812 fly1r
= fly0r
+ fly3i
;
2813 fly1i
= fly0i
- fly3r
;
2814 fly0r
= fly0r
- fly3i
;
2815 fly0i
= fly0i
+ fly3r
;
2818 *(fly2P
+ 1) = fly5i
;
2822 *(fly3P
+ 1) = fly7i
;
2825 *(fly2P
+ FlyOffsetA
) = fly2r
;
2826 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
2827 *(fly0P
+ FlyOffsetA
) = fly4r
;
2828 *(fly0P
+ FlyOffsetAIm
) = fly4i
;
2829 *(fly3P
+ FlyOffsetA
) = fly1r
;
2830 *(fly3P
+ FlyOffsetAIm
) = fly1i
;
2831 *(fly1P
+ FlyOffsetA
) = fly0r
;
2832 *(fly1P
+ FlyOffsetAIm
) = fly0i
;
2834 fly0P
= (fly0P
+ FlyOffsetB
);
2835 fly1P
= (fly1P
+ FlyOffsetB
);
2836 fly2P
= (fly2P
+ FlyOffsetB
);
2837 fly3P
= (fly3P
+ FlyOffsetB
);
2843 Flyinc
= Flyinc
<< 1;
2846 /* 1 radix 4 stage */
2849 U3r
= 0.7071067811865475244008443621; /* sqrt(0.5); */
2852 fly1P
= (IOP
+Flyinc
);
2853 fly2P
= (fly1P
+Flyinc
);
2854 fly3P
= (fly2P
+Flyinc
);
2865 f3 - -i- f1 -U3a- f2
2868 for (LoopCnt
= LoopN
; LoopCnt
> 0 ; LoopCnt
--){
2874 fly2i
= *(fly2P
+ 1);
2876 fly1i
= *(fly3P
+ 1);
2877 fly4r
= *(fly0P
+ FlyOffsetA
);
2878 fly4i
= *(fly0P
+ FlyOffsetAIm
);
2879 fly0r
= *(fly1P
+ FlyOffsetA
);
2880 fly0i
= *(fly1P
+ FlyOffsetAIm
);
2881 fly6r
= *(fly2P
+ FlyOffsetA
);
2882 fly6i
= *(fly2P
+ FlyOffsetAIm
);
2883 fly3r
= *(fly3P
+ FlyOffsetA
);
2884 fly3i
= *(fly3P
+ FlyOffsetAIm
);
2886 fly5r
= t0r
- fly2r
;
2887 fly5i
= t0i
- fly2i
;
2891 fly7r
= t1r
+ fly1i
;
2892 fly7i
= t1i
- fly1r
;
2896 fly2r
= fly4r
- fly6r
;
2897 fly2i
= fly4i
- fly6i
;
2898 fly4r
= fly4r
+ fly6r
;
2899 fly4i
= fly4i
+ fly6i
;
2901 fly1r
= fly0r
+ fly3i
;
2902 fly1i
= fly0i
- fly3r
;
2903 fly0r
= fly0r
- fly3i
;
2904 fly0i
= fly0i
+ fly3r
;
2906 fly6r
= t0r
- fly4r
;
2907 fly6i
= t0i
- fly4i
;
2911 fly3r
= fly5r
+ fly2i
;
2912 fly3i
= fly5i
- fly2r
;
2913 fly5r
= fly5r
- fly2i
;
2914 fly5i
= fly5i
+ fly2r
;
2916 fly4r
= t1r
- U3r
* fly0r
;
2917 fly4r
= fly4r
+ U3i
* fly0i
;
2918 fly4i
= t1i
- U3i
* fly0r
;
2919 fly4i
= fly4i
- U3r
* fly0i
;
2920 t1r
= scale
* t1r
- fly4r
;
2921 t1i
= scale
* t1i
- fly4i
;
2923 fly2r
= fly7r
+ U3i
* fly1r
;
2924 fly2r
= fly2r
+ U3r
* fly1i
;
2925 fly2i
= fly7i
- U3r
* fly1r
;
2926 fly2i
= fly2i
+ U3i
* fly1i
;
2927 fly7r
= scale
* fly7r
- fly2r
;
2928 fly7i
= scale
* fly7i
- fly2i
;
2930 *(fly0P
+ FlyOffsetA
) = fly6r
;
2931 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
2934 *(fly2P
+ FlyOffsetA
) = fly3r
;
2935 *(fly2P
+ FlyOffsetAIm
) = fly3i
;
2937 *(fly2P
+ 1) = fly5i
;
2938 *(fly1P
+ FlyOffsetA
) = fly4r
;
2939 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
2942 *(fly3P
+ FlyOffsetA
) = fly2r
;
2943 *(fly3P
+ FlyOffsetAIm
) = fly2i
;
2945 *(fly3P
+ 1) = fly7i
;
2947 fly0P
= (fly0P
+ FlyOffsetB
);
2948 fly1P
= (fly1P
+ FlyOffsetB
);
2949 fly2P
= (fly2P
+ FlyOffsetB
);
2950 fly3P
= (fly3P
+ FlyOffsetB
);
2957 Flyinc
= Flyinc
<< 2;
2961 NsameU2
= NsameU4
>> 1;
2962 NsameU1
= NsameU2
>> 1;
2964 FlyOffsetA
= Flyinc
<< 2;
2965 FlyOffsetB
= FlyOffsetA
<< 1;
2966 FlyOffsetAIm
= FlyOffsetA
+ 1;
2967 FlyOffsetBIm
= FlyOffsetB
+ 1;
2970 /* ****** RADIX 8 Stages */
2971 for (stage
= stage
<<1; stage
> 0 ; stage
--){
2973 /* an fft stage is done in two parts to ease use of the single quadrant cos table */
2975 /* fftcalc1(iobuf, Utbl, N, NdiffU, LoopN); */
2978 U0iP
= &Utbl
[Ntbl
[M
-1]]; /* for RIFFT */
2983 U3offset
= (Ntbl
[M
+1]) / 8; /* for RIFFT */
2993 U3r
= *( U2rP
+ U3offset
);
2994 U3i
= *( U2iP
- U3offset
);
2998 fly1P
= (IOP
+Flyinc
);
2999 fly2P
= (fly1P
+Flyinc
);
3000 fly3P
= (fly2P
+Flyinc
);
3002 for (diffUcnt
= (NdiffU
)>>1; diffUcnt
> 0; diffUcnt
--){
3006 f0 - - t0 - - t0 - - t0
3007 f1 -U0 - t1 - - t1 - - t1
3008 f2 - - f2 -U1 - f5 - - f3
3009 f3 -U0 - f1 -U1a- f7 - - f7
3010 f4 - - f4 - - f4 -U2 - f6
3011 f5 -U0 - f0 - - f0 -U3 - f4
3012 f6 - - f6 -U1 - f2 -U2a- f2
3013 f7 -U0 - f3 -U1a- f1 -U3a- f5
3021 for (LoopCnt
= LoopN
-1; LoopCnt
> 0 ; LoopCnt
--){
3024 fly2i
= *(fly2P
+ 1);
3026 fly3i
= *(fly3P
+ 1);
3027 fly4r
= *(fly0P
+ FlyOffsetA
);
3028 fly4i
= *(fly0P
+ FlyOffsetAIm
);
3029 fly5r
= *(fly1P
+ FlyOffsetA
);
3030 fly5i
= *(fly1P
+ FlyOffsetAIm
);
3031 fly6r
= *(fly2P
+ FlyOffsetA
);
3032 fly6i
= *(fly2P
+ FlyOffsetAIm
);
3033 fly7r
= *(fly3P
+ FlyOffsetA
);
3034 fly7i
= *(fly3P
+ FlyOffsetAIm
);
3036 t1r
= fly0r
- U0r
* fly1r
;
3037 t1r
= t1r
+ U0i
* fly1i
;
3038 t1i
= fly0i
- U0i
* fly1r
;
3039 t1i
= t1i
- U0r
* fly1i
;
3040 t0r
= scale
* fly0r
- t1r
;
3041 t0i
= scale
* fly0i
- t1i
;
3043 fly1r
= fly2r
- U0r
* fly3r
;
3044 fly1r
= fly1r
+ U0i
* fly3i
;
3045 fly1i
= fly2i
- U0i
* fly3r
;
3046 fly1i
= fly1i
- U0r
* fly3i
;
3047 fly2r
= scale
* fly2r
- fly1r
;
3048 fly2i
= scale
* fly2i
- fly1i
;
3050 fly0r
= fly4r
- U0r
* fly5r
;
3051 fly0r
= fly0r
+ U0i
* fly5i
;
3052 fly0i
= fly4i
- U0i
* fly5r
;
3053 fly0i
= fly0i
- U0r
* fly5i
;
3054 fly4r
= scale
* fly4r
- fly0r
;
3055 fly4i
= scale
* fly4i
- fly0i
;
3057 fly3r
= fly6r
- U0r
* fly7r
;
3058 fly3r
= fly3r
+ U0i
* fly7i
;
3059 fly3i
= fly6i
- U0i
* fly7r
;
3060 fly3i
= fly3i
- U0r
* fly7i
;
3061 fly6r
= scale
* fly6r
- fly3r
;
3062 fly6i
= scale
* fly6i
- fly3i
;
3065 fly5r
= t0r
- U1r
* fly2r
;
3066 fly5r
= fly5r
+ U1i
* fly2i
;
3067 fly5i
= t0i
- U1i
* fly2r
;
3068 fly5i
= fly5i
- U1r
* fly2i
;
3069 t0r
= scale
* t0r
- fly5r
;
3070 t0i
= scale
* t0i
- fly5i
;
3072 fly7r
= t1r
+ U1i
* fly1r
;
3073 fly7r
= fly7r
+ U1r
* fly1i
;
3074 fly7i
= t1i
- U1r
* fly1r
;
3075 fly7i
= fly7i
+ U1i
* fly1i
;
3076 t1r
= scale
* t1r
- fly7r
;
3077 t1i
= scale
* t1i
- fly7i
;
3079 fly2r
= fly4r
- U1r
* fly6r
;
3080 fly2r
= fly2r
+ U1i
* fly6i
;
3081 fly2i
= fly4i
- U1i
* fly6r
;
3082 fly2i
= fly2i
- U1r
* fly6i
;
3083 fly4r
= scale
* fly4r
- fly2r
;
3084 fly4i
= scale
* fly4i
- fly2i
;
3086 fly1r
= fly0r
+ U1i
* fly3r
;
3087 fly1r
= fly1r
+ U1r
* fly3i
;
3088 fly1i
= fly0i
- U1r
* fly3r
;
3089 fly1i
= fly1i
+ U1i
* fly3i
;
3090 fly0r
= scale
* fly0r
- fly1r
;
3091 fly0i
= scale
* fly0i
- fly1i
;
3093 fly6r
= t0r
- U2r
* fly4r
;
3094 fly6r
= fly6r
+ U2i
* fly4i
;
3095 fly6i
= t0i
- U2i
* fly4r
;
3096 fly6i
= fly6i
- U2r
* fly4i
;
3097 t0r
= scale
* t0r
- fly6r
;
3098 t0i
= scale
* t0i
- fly6i
;
3100 fly3r
= fly5r
- U2i
* fly2r
;
3101 fly3r
= fly3r
- U2r
* fly2i
;
3102 fly3i
= fly5i
+ U2r
* fly2r
;
3103 fly3i
= fly3i
- U2i
* fly2i
;
3104 fly2r
= scale
* fly5r
- fly3r
;
3105 fly2i
= scale
* fly5i
- fly3i
;
3107 fly4r
= t1r
- U3r
* fly0r
;
3108 fly4r
= fly4r
+ U3i
* fly0i
;
3109 fly4i
= t1i
- U3i
* fly0r
;
3110 fly4i
= fly4i
- U3r
* fly0i
;
3111 t1r
= scale
* t1r
- fly4r
;
3112 t1i
= scale
* t1i
- fly4i
;
3114 fly5r
= fly7r
+ U3i
* fly1r
;
3115 fly5r
= fly5r
+ U3r
* fly1i
;
3116 fly5i
= fly7i
- U3r
* fly1r
;
3117 fly5i
= fly5i
+ U3i
* fly1i
;
3118 fly7r
= scale
* fly7r
- fly5r
;
3119 fly7i
= scale
* fly7i
- fly5i
;
3121 *(fly0P
+ FlyOffsetA
) = fly6r
;
3122 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
3126 *(fly2P
+ 1) = fly3i
;
3127 *(fly2P
+ FlyOffsetA
) = fly2r
;
3128 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
3130 fly0r
= *(fly0P
+ FlyOffsetB
);
3131 fly0i
= *(fly0P
+ FlyOffsetBIm
);
3133 *(fly1P
+ FlyOffsetA
) = fly4r
;
3134 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
3138 fly1r
= *(fly1P
+ FlyOffsetB
);
3139 fly1i
= *(fly1P
+ FlyOffsetBIm
);
3141 *(fly3P
+ FlyOffsetA
) = fly5r
;
3142 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
3144 *(fly3P
+ 1) = fly7i
;
3146 fly0P
= (fly0P
+ FlyOffsetB
);
3147 fly1P
= (fly1P
+ FlyOffsetB
);
3148 fly2P
= (fly2P
+ FlyOffsetB
);
3149 fly3P
= (fly3P
+ FlyOffsetB
);
3153 fly2i
= *(fly2P
+ 1);
3155 fly3i
= *(fly3P
+ 1);
3156 fly4r
= *(fly0P
+ FlyOffsetA
);
3157 fly4i
= *(fly0P
+ FlyOffsetAIm
);
3158 fly5r
= *(fly1P
+ FlyOffsetA
);
3159 fly5i
= *(fly1P
+ FlyOffsetAIm
);
3160 fly6r
= *(fly2P
+ FlyOffsetA
);
3161 fly6i
= *(fly2P
+ FlyOffsetAIm
);
3162 fly7r
= *(fly3P
+ FlyOffsetA
);
3163 fly7i
= *(fly3P
+ FlyOffsetAIm
);
3165 t1r
= fly0r
- U0r
* fly1r
;
3166 t1r
= t1r
+ U0i
* fly1i
;
3167 t1i
= fly0i
- U0i
* fly1r
;
3168 t1i
= t1i
- U0r
* fly1i
;
3169 t0r
= scale
* fly0r
- t1r
;
3170 t0i
= scale
* fly0i
- t1i
;
3172 fly1r
= fly2r
- U0r
* fly3r
;
3173 fly1r
= fly1r
+ U0i
* fly3i
;
3174 fly1i
= fly2i
- U0i
* fly3r
;
3175 fly1i
= fly1i
- U0r
* fly3i
;
3176 fly2r
= scale
* fly2r
- fly1r
;
3177 fly2i
= scale
* fly2i
- fly1i
;
3179 fly0r
= fly4r
- U0r
* fly5r
;
3180 fly0r
= fly0r
+ U0i
* fly5i
;
3181 fly0i
= fly4i
- U0i
* fly5r
;
3182 fly0i
= fly0i
- U0r
* fly5i
;
3183 fly4r
= scale
* fly4r
- fly0r
;
3184 fly4i
= scale
* fly4i
- fly0i
;
3186 fly3r
= fly6r
- U0r
* fly7r
;
3187 fly3r
= fly3r
+ U0i
* fly7i
;
3188 fly3i
= fly6i
- U0i
* fly7r
;
3189 fly3i
= fly3i
- U0r
* fly7i
;
3190 fly6r
= scale
* fly6r
- fly3r
;
3191 fly6i
= scale
* fly6i
- fly3i
;
3193 fly5r
= t0r
- U1r
* fly2r
;
3194 fly5r
= fly5r
+ U1i
* fly2i
;
3195 fly5i
= t0i
- U1i
* fly2r
;
3196 fly5i
= fly5i
- U1r
* fly2i
;
3197 t0r
= scale
* t0r
- fly5r
;
3198 t0i
= scale
* t0i
- fly5i
;
3200 fly7r
= t1r
+ U1i
* fly1r
;
3201 fly7r
= fly7r
+ U1r
* fly1i
;
3202 fly7i
= t1i
- U1r
* fly1r
;
3203 fly7i
= fly7i
+ U1i
* fly1i
;
3204 t1r
= scale
* t1r
- fly7r
;
3205 t1i
= scale
* t1i
- fly7i
;
3207 fly2r
= fly4r
- U1r
* fly6r
;
3208 fly2r
= fly2r
+ U1i
* fly6i
;
3209 fly2i
= fly4i
- U1i
* fly6r
;
3210 fly2i
= fly2i
- U1r
* fly6i
;
3211 fly4r
= scale
* fly4r
- fly2r
;
3212 fly4i
= scale
* fly4i
- fly2i
;
3214 fly1r
= fly0r
+ U1i
* fly3r
;
3215 fly1r
= fly1r
+ U1r
* fly3i
;
3216 fly1i
= fly0i
- U1r
* fly3r
;
3217 fly1i
= fly1i
+ U1i
* fly3i
;
3218 fly0r
= scale
* fly0r
- fly1r
;
3219 fly0i
= scale
* fly0i
- fly1i
;
3221 U0i
= *(U0iP
= (U0iP
- NsameU4
));
3222 U0r
= *(U0rP
= (U0rP
+ NsameU4
));
3223 U1r
= *(U1rP
= (U1rP
+ NsameU2
));
3224 U1i
= *(U1iP
= (U1iP
- NsameU2
));
3228 fly6r
= t0r
- U2r
* fly4r
;
3229 fly6r
= fly6r
+ U2i
* fly4i
;
3230 fly6i
= t0i
- U2i
* fly4r
;
3231 fly6i
= fly6i
- U2r
* fly4i
;
3232 t0r
= scale
* t0r
- fly6r
;
3233 t0i
= scale
* t0i
- fly6i
;
3235 fly3r
= fly5r
- U2i
* fly2r
;
3236 fly3r
= fly3r
- U2r
* fly2i
;
3237 fly3i
= fly5i
+ U2r
* fly2r
;
3238 fly3i
= fly3i
- U2i
* fly2i
;
3239 fly2r
= scale
* fly5r
- fly3r
;
3240 fly2i
= scale
* fly5i
- fly3i
;
3242 fly4r
= t1r
- U3r
* fly0r
;
3243 fly4r
= fly4r
+ U3i
* fly0i
;
3244 fly4i
= t1i
- U3i
* fly0r
;
3245 fly4i
= fly4i
- U3r
* fly0i
;
3246 t1r
= scale
* t1r
- fly4r
;
3247 t1i
= scale
* t1i
- fly4i
;
3249 fly5r
= fly7r
+ U3i
* fly1r
;
3250 fly5r
= fly5r
+ U3r
* fly1i
;
3251 fly5i
= fly7i
- U3r
* fly1r
;
3252 fly5i
= fly5i
+ U3i
* fly1i
;
3253 fly7r
= scale
* fly7r
- fly5r
;
3254 fly7i
= scale
* fly7i
- fly5i
;
3256 *(fly0P
+ FlyOffsetA
) = fly6r
;
3257 *(fly0P
+ FlyOffsetAIm
) = fly6i
;
3261 U2r
= *(U2rP
= (U2rP
+ NsameU1
));
3262 U2i
= *(U2iP
= (U2iP
- NsameU1
));
3265 *(fly2P
+ 1) = fly3i
;
3266 *(fly2P
+ FlyOffsetA
) = fly2r
;
3267 *(fly2P
+ FlyOffsetAIm
) = fly2i
;
3268 *(fly1P
+ FlyOffsetA
) = fly4r
;
3269 *(fly1P
+ FlyOffsetAIm
) = fly4i
;
3273 U3r
= *( U2rP
+ U3offset
);
3274 U3i
= *( U2iP
- U3offset
);
3276 *(fly3P
+ FlyOffsetA
) = fly5r
;
3277 *(fly3P
+ FlyOffsetAIm
) = fly5i
;
3279 *(fly3P
+ 1) = fly7i
;
3283 fly1P
= (IOP
+Flyinc
);
3284 fly2P
= (fly1P
+Flyinc
);
3285 fly3P
= (fly2P
+Flyinc
);
3295 Flyinc
= Flyinc
<< 3;
3298 FlyOffsetAIm
= FlyOffsetA
+ 1;
3299 FlyOffsetBIm
= FlyOffsetB
+ 1;
3302 M
=M
+1; /* for RIFFT */