equal
deleted
inserted
replaced
66 public void transform(double[] data) { |
66 public void transform(double[] data) { |
67 bitreversal(data); |
67 bitreversal(data); |
68 calc(fftFrameSize, data, sign, w); |
68 calc(fftFrameSize, data, sign, w); |
69 } |
69 } |
70 |
70 |
71 private final static double[] computeTwiddleFactors(int fftFrameSize, |
71 private static double[] computeTwiddleFactors(int fftFrameSize, |
72 int sign) { |
72 int sign) { |
73 |
73 |
74 int imax = (int) (Math.log(fftFrameSize) / Math.log(2.)); |
74 int imax = (int) (Math.log(fftFrameSize) / Math.log(2.)); |
75 |
75 |
76 double[] warray = new double[(fftFrameSize - 1) * 4]; |
76 double[] warray = new double[(fftFrameSize - 1) * 4]; |
120 } |
120 } |
121 |
121 |
122 return warray; |
122 return warray; |
123 } |
123 } |
124 |
124 |
125 private final static void calc(int fftFrameSize, double[] data, int sign, |
125 private static void calc(int fftFrameSize, double[] data, int sign, |
126 double[] w) { |
126 double[] w) { |
127 |
127 |
128 final int fftFrameSize2 = fftFrameSize << 1; |
128 final int fftFrameSize2 = fftFrameSize << 1; |
129 |
129 |
130 int nstep = 2; |
130 int nstep = 2; |
137 else |
137 else |
138 calcF4I(fftFrameSize, data, i, nstep, w); |
138 calcF4I(fftFrameSize, data, i, nstep, w); |
139 |
139 |
140 } |
140 } |
141 |
141 |
142 private final static void calcF2E(int fftFrameSize, double[] data, int i, |
142 private static void calcF2E(int fftFrameSize, double[] data, int i, |
143 int nstep, double[] w) { |
143 int nstep, double[] w) { |
144 int jmax = nstep; |
144 int jmax = nstep; |
145 for (int n = 0; n < jmax; n += 2) { |
145 for (int n = 0; n < jmax; n += 2) { |
146 double wr = w[i++]; |
146 double wr = w[i++]; |
147 double wi = w[i++]; |
147 double wi = w[i++]; |
161 |
161 |
162 } |
162 } |
163 |
163 |
164 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
164 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
165 // complex operators |
165 // complex operators |
166 private final static void calcF4F(int fftFrameSize, double[] data, int i, |
166 private static void calcF4F(int fftFrameSize, double[] data, int i, |
167 int nstep, double[] w) { |
167 int nstep, double[] w) { |
168 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
168 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
169 // Factor-4 Decomposition |
169 // Factor-4 Decomposition |
170 |
170 |
171 int w_len = w.length >> 1; |
171 int w_len = w.length >> 1; |
329 |
329 |
330 } |
330 } |
331 |
331 |
332 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
332 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
333 // complex operators |
333 // complex operators |
334 private final static void calcF4I(int fftFrameSize, double[] data, int i, |
334 private static void calcF4I(int fftFrameSize, double[] data, int i, |
335 int nstep, double[] w) { |
335 int nstep, double[] w) { |
336 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
336 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
337 // Factor-4 Decomposition |
337 // Factor-4 Decomposition |
338 |
338 |
339 int w_len = w.length >> 1; |
339 int w_len = w.length >> 1; |
497 |
497 |
498 } |
498 } |
499 |
499 |
500 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
500 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
501 // complex operators |
501 // complex operators |
502 private final static void calcF4FE(int fftFrameSize, double[] data, int i, |
502 private static void calcF4FE(int fftFrameSize, double[] data, int i, |
503 int nstep, double[] w) { |
503 int nstep, double[] w) { |
504 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
504 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
505 // Factor-4 Decomposition |
505 // Factor-4 Decomposition |
506 |
506 |
507 int w_len = w.length >> 1; |
507 int w_len = w.length >> 1; |
591 |
591 |
592 } |
592 } |
593 |
593 |
594 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
594 // Perform Factor-4 Decomposition with 3 * complex operators and 8 +/- |
595 // complex operators |
595 // complex operators |
596 private final static void calcF4IE(int fftFrameSize, double[] data, int i, |
596 private static void calcF4IE(int fftFrameSize, double[] data, int i, |
597 int nstep, double[] w) { |
597 int nstep, double[] w) { |
598 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
598 final int fftFrameSize2 = fftFrameSize << 1; // 2*fftFrameSize; |
599 // Factor-4 Decomposition |
599 // Factor-4 Decomposition |
600 |
600 |
601 int w_len = w.length >> 1; |
601 int w_len = w.length >> 1; |
683 |
683 |
684 } |
684 } |
685 |
685 |
686 } |
686 } |
687 |
687 |
688 private final void bitreversal(double[] data) { |
688 private void bitreversal(double[] data) { |
689 if (fftFrameSize < 4) |
689 if (fftFrameSize < 4) |
690 return; |
690 return; |
691 |
691 |
692 int inverse = fftFrameSize2 - 2; |
692 int inverse = fftFrameSize2 - 2; |
693 for (int i = 0; i < fftFrameSize; i += 4) { |
693 for (int i = 0; i < fftFrameSize; i += 4) { |