| 1 | /* |
| 2 | * Copyright (C) 2015, Mike Walters <[email protected]> |
| 3 | * |
| 4 | * This file is part of inspectrum. |
| 5 | * |
| 6 | * This program is free software: you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation, either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include "fft.h"cxx . . $ `<file>/src/fft.h`/ |
| 21 | #include "string.h" |
| 22 | |
| 23 | FFTcxx . . $ FFT#::FFTcxx . . $ FFT#FFT(d4f767463ce0a6b3).(int size) |
| 24 | { |
| 25 | fftSizecxx . . $ FFT#fftSize. = size; |
| 26 | |
| 27 | fftwIncxx . . $ FFT#fftwIn. = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSizecxx . . $ FFT#fftSize.); |
| 28 | fftwOutcxx . . $ FFT#fftwOut. = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * fftSizecxx . . $ FFT#fftSize.); |
| 29 | fftwPlancxx . . $ FFT#fftwPlan. = fftwf_plan_dft_1d(fftSizecxx . . $ FFT#fftSize., fftwIncxx . . $ FFT#fftwIn., fftwOutcxx . . $ FFT#fftwOut., FFTW_FORWARDcxx . . $ `<external>/4982487536923700009/fftw3.h:489:9`!, FFTW_MEASUREcxx . . $ `<external>/4982487536923700009/fftw3.h:495:9`!); |
| 30 | } |
| 31 | |
| 32 | FFTcxx . . $ FFT#::~cxx . . $ FFT#`~FFT`(49f6e7a06ebc5aa8).FFTcxx . . $ FFT#() |
| 33 | { |
| 34 | if (fftwPlancxx . . $ FFT#fftwPlan.) fftwf_destroy_plan(fftwPlancxx . . $ FFT#fftwPlan.); |
| 35 | if (fftwIncxx . . $ FFT#fftwIn.) fftwf_free(fftwIncxx . . $ FFT#fftwIn.); |
| 36 | if (fftwOutcxx . . $ FFT#fftwOut.) fftwf_free(fftwOutcxx . . $ FFT#fftwOut.); |
| 37 | } |
| 38 | |
| 39 | void FFTcxx . . $ FFT#::processcxx . . $ FFT#process(6c58c5e2437d25a2).(void *dest, void *source) |
| 40 | { |
| 41 | memcpy(fftwIncxx . . $ FFT#fftwIn., source, fftSizecxx . . $ FFT#fftSize. * sizeof(fftwf_complex)); |
| 42 | fftwf_execute(fftwPlancxx . . $ FFT#fftwPlan.); |
| 43 | memcpy(dest, fftwOutcxx . . $ FFT#fftwOut., fftSizecxx . . $ FFT#fftSize. * sizeof(fftwf_complex)); |
| 44 | } |