SAF
Loading...
Searching...
No Matches
kiss_fft.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003-2010, Mark Borgerding. All rights reserved.
3 * This file is part of KISS FFT - https://github.com/mborgerding/kissfft
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 * See COPYING file for more information.
7 */
8
19#ifndef KISS_FFT_H
20#define KISS_FFT_H
21
22#include <stdlib.h>
23#include <stdio.h>
24#include <math.h>
25#include <string.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/*
32 ATTENTION!
33 If you would like a :
34 -- a utility that will handle the caching of fft objects
35 -- real-only (no imaginary time component ) FFT
36 -- a multi-dimensional FFT
37 -- a command-line utility to perform ffts
38 -- a command-line utility to perform fast-convolution filtering
39
40 Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
41 in the tools/ directory.
42*/
43
44/* User may override KISS_FFT_MALLOC and/or KISS_FFT_FREE. */
45#ifdef USE_SIMD
46# include <xmmintrin.h>
47# define kiss_fft_scalar __m128
48# ifndef KISS_FFT_MALLOC
49# define KISS_FFT_MALLOC(nbytes) _mm_malloc(nbytes,16)
50# endif
51# ifndef KISS_FFT_FREE
52# define KISS_FFT_FREE _mm_free
53# endif
54#else
55# ifndef KISS_FFT_MALLOC
56# define KISS_FFT_MALLOC malloc
57# endif
58# ifndef KISS_FFT_FREE
59# define KISS_FFT_FREE free
60# endif
61#endif
62
63
64#ifdef FIXED_POINT
65#include <stdint.h>
66# if (FIXED_POINT == 32)
67# define kiss_fft_scalar int32_t
68# else
69# define kiss_fft_scalar int16_t
70# endif
71#else
72# ifndef kiss_fft_scalar
73/* default is float */
74# define kiss_fft_scalar float
75# endif
76#endif
77
79typedef struct {
80 kiss_fft_scalar r;
81 kiss_fft_scalar i;
83
84typedef struct kiss_fft_state* kiss_fft_cfg;
85
108kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
109
120void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
121
125void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
126
127/* If kiss_fft_alloc allocated a buffer, it is one contiguous
128 buffer and can be simply free()d when no longer needed*/
129#define kiss_fft_free KISS_FFT_FREE
130
135void kiss_fft_cleanup(void);
136
137
141int kiss_fft_next_fast_size(int n);
142
143/* for real ffts, we need an even size */
144#define kiss_fftr_next_fast_size_real(n) \
145 (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
146
147#ifdef __cplusplus
148}
149#endif
150
151#endif
void kiss_fft_stride(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout, int fin_stride)
A more generic version of the above function.
Definition kiss_fft.c:372
int kiss_fft_next_fast_size(int n)
Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,...
Definition kiss_fft.c:397
void kiss_fft_cleanup(void)
Cleans up some memory that gets managed internally.
Definition kiss_fft.c:392
void kiss_fft(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout)
kiss_fft(cfg,in_out_buf)
Definition kiss_fft.c:386
kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem)
kiss_fft_alloc
Definition kiss_fft.c:340
Complex data type used by kissFFT.
Definition kiss_fft.h:79
Internal KissFFT structure.