Mercurial > hg > peckfft
comparison peck_fftr.c @ 6:fee54f1878f7
kill FIXED_POINT stuff, simplify
author | Peter Meerwald <p.meerwald@bct-electronic.com> |
---|---|
date | Fri, 16 Sep 2011 15:18:28 +0200 |
parents | 2d6c49fcafcb |
children | 655dc5c14169 |
comparison
equal
deleted
inserted
replaced
5:c7237a7544eb | 6:fee54f1878f7 |
---|---|
88 * yielding the Nyquist bin of input time sequence. | 88 * yielding the Nyquist bin of input time sequence. |
89 */ | 89 */ |
90 | 90 |
91 tdc.r = st->tmpbuf[0].r; | 91 tdc.r = st->tmpbuf[0].r; |
92 tdc.i = st->tmpbuf[0].i; | 92 tdc.i = st->tmpbuf[0].i; |
93 C_FIXDIV(tdc,2); | |
94 CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i); | |
95 CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); | |
96 freqdata[0].r = tdc.r + tdc.i; | 93 freqdata[0].r = tdc.r + tdc.i; |
97 freqdata[ncfft].r = tdc.r - tdc.i; | 94 freqdata[ncfft].r = tdc.r - tdc.i; |
98 #if USE_SIMD == SIMD_SSE2 | 95 #if USE_SIMD == SIMD_SSE2 |
99 freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); | 96 freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); |
100 #elif USE_SIMD == SIMD_NEON4 | 97 #elif USE_SIMD == SIMD_NEON4 |
107 | 104 |
108 for (k = 1; k <= ncfft/2; ++k) { | 105 for (k = 1; k <= ncfft/2; ++k) { |
109 fpk = st->tmpbuf[k]; | 106 fpk = st->tmpbuf[k]; |
110 fpnk.r = st->tmpbuf[ncfft-k].r; | 107 fpnk.r = st->tmpbuf[ncfft-k].r; |
111 fpnk.i = - st->tmpbuf[ncfft-k].i; | 108 fpnk.i = - st->tmpbuf[ncfft-k].i; |
112 C_FIXDIV(fpk, 2); | |
113 C_FIXDIV(fpnk, 2); | |
114 | 109 |
115 C_ADD(f1k, fpk, fpnk); | 110 C_ADD(f1k, fpk, fpnk); |
116 C_SUB(f2k, fpk, fpnk); | 111 C_SUB(f2k, fpk, fpnk); |
117 C_MUL(tw, f2k, st->super_twiddles[k-1]); | 112 C_MUL(tw, f2k, st->super_twiddles[k-1]); |
118 | 113 |
134 | 129 |
135 ncfft = st->substate->nfft; | 130 ncfft = st->substate->nfft; |
136 | 131 |
137 st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; | 132 st->tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r; |
138 st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; | 133 st->tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r; |
139 C_FIXDIV(st->tmpbuf[0], 2); | |
140 | 134 |
141 for (k = 1; k <= ncfft / 2; ++k) { | 135 for (k = 1; k <= ncfft / 2; ++k) { |
142 peck_fft_cpx fk, fnkc, fek, fok, tmp; | 136 peck_fft_cpx fk, fnkc, fek, fok, tmp; |
143 fk = freqdata[k]; | 137 fk = freqdata[k]; |
144 fnkc.r = freqdata[ncfft - k].r; | 138 fnkc.r = freqdata[ncfft - k].r; |
145 fnkc.i = -freqdata[ncfft - k].i; | 139 fnkc.i = -freqdata[ncfft - k].i; |
146 C_FIXDIV(fk, 2); | |
147 C_FIXDIV(fnkc, 2); | |
148 | 140 |
149 C_ADD(fek, fk, fnkc); | 141 C_ADD(fek, fk, fnkc); |
150 C_SUB(tmp, fk, fnkc); | 142 C_SUB(tmp, fk, fnkc); |
151 C_MUL(fok, tmp, st->super_twiddles[k-1]); | 143 C_MUL(fok, tmp, st->super_twiddles[k-1]); |
152 C_ADD(st->tmpbuf[k], fek, fok); | 144 C_ADD(st->tmpbuf[k], fek, fok); |