| 3065 | } |
| 3066 | |
| 3067 | static void rffts1(SPFLOAT * ioptr, int M, SPFLOAT * Utbl, int16_t * BRLow) |
| 3068 | { |
| 3069 | /* Compute in-place real fft on the rows of the input array */ |
| 3070 | /* The result is the complex spectra of the positive frequencies */ |
| 3071 | /* except the location for the first complex number contains the real */ |
| 3072 | /* values for DC and Nyquest */ |
| 3073 | /* INPUTS */ |
| 3074 | /* *ioptr = real input data array */ |
| 3075 | /* M = log2 of fft size */ |
| 3076 | /* *Utbl = cosine table */ |
| 3077 | /* *BRLow = bit reversed counter table */ |
| 3078 | /* OUTPUTS */ |
| 3079 | /* *ioptr = output data array in the following order */ |
| 3080 | /* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), */ |
| 3081 | /* ... Re(x[N/2-1]), Im(x[N/2-1]). */ |
| 3082 | |
| 3083 | SPFLOAT scale; |
| 3084 | int StageCnt; |
| 3085 | int NDiffU; |
| 3086 | |
| 3087 | M = M - 1; |
| 3088 | switch (M) |
| 3089 | { |
| 3090 | case -1: |
| 3091 | break; |
| 3092 | case 0: |
| 3093 | rfft1pt(ioptr); /* a 2 pt fft */ |
| 3094 | break; |
| 3095 | case 1: |
| 3096 | rfft2pt(ioptr); /* a 4 pt fft */ |
| 3097 | break; |
| 3098 | case 2: |
| 3099 | rfft4pt(ioptr); /* an 8 pt fft */ |
| 3100 | break; |
| 3101 | case 3: |
| 3102 | rfft8pt(ioptr); /* a 16 pt fft */ |
| 3103 | break; |
| 3104 | default: |
| 3105 | scale = 0.5; |
| 3106 | /* bit reverse and first radix 2 stage */ |
| 3107 | scbitrevR2(ioptr, M, BRLow, scale); |
| 3108 | StageCnt = (M - 1) / 3; /* number of radix 8 stages */ |
| 3109 | NDiffU = 2; /* one radix 2 stage already complete */ |
| 3110 | if ((M - 1 - (StageCnt * 3)) == 1) |
| 3111 | { |
| 3112 | bfR2(ioptr, M, NDiffU); /* 1 radix 2 stage */ |
| 3113 | NDiffU *= 2; |
| 3114 | } |
| 3115 | if ((M - 1 - (StageCnt * 3)) == 2) |
| 3116 | { |
| 3117 | bfR4(ioptr, M, NDiffU); /* 1 radix 4 stage */ |
| 3118 | NDiffU *= 4; |
| 3119 | } |
| 3120 | if (M <= (int) MCACHE) |
| 3121 | bfstages(ioptr, M, Utbl, 2, NDiffU, StageCnt); /* RADIX 8 Stages */ |
| 3122 | else |
| 3123 | fftrecurs(ioptr, M, Utbl, 2, NDiffU, StageCnt); /* RADIX 8 Stages */ |
| 3124 | frstage(ioptr, M + 1, Utbl); |