File indexing completed on 2024-06-16 04:35:41
0001 /* 0002 SPDX-FileCopyrightText: 2003-2010 Mark Borgerding <Mark@Borgerding.net> 0003 SPDX-License-Identifier: BSD-3-Clause 0004 0005 All rights reserved. 0006 0007 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 0008 0009 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 0010 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or 0011 other materials provided with the distribution. 0012 * Neither the author nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written 0013 permission. 0014 0015 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 0016 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 0017 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 0018 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 0019 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0020 */ 0021 0022 #pragma once 0023 0024 #include "../kiss_fft.h" 0025 0026 #ifdef __cplusplus 0027 extern "C" { 0028 #endif 0029 0030 /* 0031 KFC -- Kiss FFT Cache 0032 0033 Not needing to deal with kiss_fft_alloc and a config 0034 object may be handy for a lot of programs. 0035 0036 KFC uses the underlying KISS FFT functions, but caches the config object. 0037 The first time kfc_fft or kfc_ifft for a given FFT size, the cfg 0038 object is created for it. All subsequent calls use the cached 0039 configuration object. 0040 0041 NOTE: 0042 You should probably not use this if your program will be using a lot 0043 of various sizes of FFTs. There is a linear search through the 0044 cached objects. If you are only using one or two FFT sizes, this 0045 will be negligible. Otherwise, you may want to use another method 0046 of managing the cfg objects. 0047 0048 There is no automated cleanup of the cached objects. This could lead 0049 to large memory usage in a program that uses a lot of *DIFFERENT* 0050 sized FFTs. If you want to force all cached cfg objects to be freed, 0051 call kfc_cleanup. 0052 0053 */ 0054 0055 /*forward complex FFT */ 0056 void kfc_fft(int nfft, const kiss_fft_cpx *fin, kiss_fft_cpx *fout); 0057 /*reverse complex FFT */ 0058 void kfc_ifft(int nfft, const kiss_fft_cpx *fin, kiss_fft_cpx *fout); 0059 0060 /*free all cached objects*/ 0061 void kfc_cleanup(void); 0062 0063 #ifdef __cplusplus 0064 } 0065 #endif