spLib
読み取り中…
検索中…
一致する文字列を見つけられません
fft.h
[詳解]
1
4#ifndef SPLIB_FFT_H
5#define SPLIB_FFT_H
6
7#include <sp/spPlugin.h>
8#include <sp/vector.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
21 /*----@addtogroup fftGroup----*/
22
23#define spFFTPrecision spPrecision
24#define spFFTSpeed spComputeSpeed
26#define SP_FFT_HIGHEST_PRECISION SP_HIGHEST_PRECISION
27#define SP_FFT_HIGH_DOUBLE_PRECISION SP_HIGH_DOUBLE_PRECISION
28#define SP_FFT_DOUBLE_PRECISION SP_DOUBLE_PRECISION
29#define SP_FFT_LOW_DOUBLE_PRECISION SP_LOW_DOUBLE_PRECISION
30#define SP_FFT_HIGH_FLOAT_PRECISION SP_HIGH_FLOAT_PRECISION
31#define SP_FFT_FLOAT_PRECISION SP_FLOAT_PRECISION
32#define SP_FFT_LOW_FLOAT_PRECISION SP_LOW_FLOAT_PRECISION
33#define SP_FFT_32BIT_PRECISION SP_32BIT_PRECISION
34#define SP_FFT_24BIT_PRECISION SP_24BIT_PRECISION
35#define SP_FFT_16BIT_PRECISION SP_16BIT_PRECISION
36#define SP_FFT_IGNORE_PRECISION SP_IGNORE_PRECISION
37#define SP_FFT_UNKNOWN_PRECISION SP_UNKNOWN_PRECISION
38#define SP_FFT_DEFAULT_PRECISION SP_FFT_FLOAT_PRECISION
40#define SP_FFT_SPEED_EXTREMELY_FAST SP_COMPUTE_SPEED_EXTREMELY_FAST
41#define SP_FFT_SPEED_VERY_FAST SP_COMPUTE_SPEED_VERY_FAST
42#define SP_FFT_SPEED_FASTER SP_COMPUTE_SPEED_FASTER
43#define SP_FFT_SPEED_FAST SP_COMPUTE_SPEED_FAST
44#define SP_FFT_SPEED_NORMAL SP_COMPUTE_SPEED_NORMAL
45#define SP_FFT_SPEED_SLOW SP_COMPUTE_SPEED_SLOW
46#define SP_FFT_SPEED_SLOWER SP_COMPUTE_SPEED_SLOWER
47#define SP_FFT_SPEED_VERY_SLOW SP_COMPUTE_SPEED_VERY_SLOW
48#define SP_FFT_SPEED_EXTREMELY_SLOW SP_COMPUTE_SPEED_EXTREMELY_SLOW
49#define SP_FFT_SPEED_UNKNOWN SP_COMPUTE_SPEED_UNKNOWN
59typedef struct _spFFTRec *spFFTRec;
61#if defined(MACOS)
62#pragma import on
63#endif
64
69extern int spfftf(float *xRe, float *xIm, long fftl, int inv);
76extern int spfft(double *xRe, double *xIm, long fftl, int inv);
77/* spectrum: data[0]=Re(X[0]), data[1]=Re(X[fftl/2]), data[2*n]=Re(X[n]), data[2*n+1]=Im(X[n]) (n > 0, n < fftl/2) */
79extern int sprfftf(float *data, long fftl, int inv);
87extern int sprfft(double *data, long fftl, int inv);
88
95extern void datashifts(short *data, long length, long shift);
97extern void datashiftl(long *data, long length, long shift);
99extern void datashiftf(float *data, long length, long shift);
104extern void datashift(double *data, long length, long shift);
106extern void ridatashifts(short *real, short *imag, long length, long shift);
108extern void ridatashiftl(long *real, long *imag, long length, long shift);
110extern void ridatashiftf(float *real, float *imag, long length, long shift);
116extern void ridatashift(double *real, double *imag, long length, long shift);
118extern void circshifts(short *data, long length, long shift);
120extern void circshiftl(long *data, long length, long shift);
122extern void circshiftf(float *data, long length, long shift);
127extern void circshift(double *data, long length, long shift);
129extern void ricircshifts(short *real, short *imag, long length, long shift);
131extern void ricircshiftl(long *real, long *imag, long length, long shift);
133extern void ricircshiftf(float *real, float *imag, long length, long shift);
139extern void ricircshift(double *real, double *imag, long length, long shift);
140
142extern void fftturnf(float *xRe, float *xIm, long fftl);
147extern void fftturn(double *xRe, double *xIm, long fftl);
149extern void fftshiftf(float *xRe, float *xIm, long fftl);
154extern void fftshift(double *xRe, double *xIm, long fftl);
155
161/* support in-place (can be real == rspec) and NULL-imag (version 0.9.1+) */
162extern void ffttorfftf(float *real, float *imag, float *rspec, long fftl);
163extern void ffttorfft(double *real, double *imag, double *rspec, long fftl);
164extern void ffttorfftipf(float *real, float *imag, long fftl);
165extern void ffttorfftip(double *real, double *imag, long fftl);
166extern void rffttofftf(float *rspec, float *real, float *imag, long fftl);
167extern void rffttofft(double *rspec, double *real, double *imag, long fftl);
168extern void rffttofftipf(float *real, float *imag, long fftl);
169extern void rffttofftip(double *real, double *imag, long fftl);
170
171extern void multrfftf(float *rspec1, float *rspec2, long fftl);
172extern void multrfft(double *rspec1, double *rspec2, long fftl);
173extern void rffttopowerf(float *rspec, float exponent, long fftl); /* 1.0=power, 0.5=abs */
174extern void rffttopower(double *rspec, double exponent, long fftl); /* 1.0=power, 0.5=abs */
175extern void powertorfftf(float *powspec, float orig_exponent, long fftl); /* 1.0=power, 0.5=abs */
176extern void powertorfft(double *powspec, double orig_exponent, long fftl); /* 1.0=power, 0.5=abs */
177extern void rffttohpowerf(float *rspec, float *ohpowspec, float exponent, long fftl);
178extern void rffttohpower(double *rspec, double *ohpowspec, double exponent, long fftl);
179extern void rffttoanglef(float *rspec, long fftl);
180extern void rffttoangle(double *rspec, long fftl);
181extern void rffttologf(float *rspec, long fftl);
182extern void rffttolog(double *rspec, long fftl);
183extern void rffttoexpf(float *rspec, long fftl);
184extern void rffttoexp(double *rspec, long fftl);
185
191extern int rfftcep(double *x, double *pw, long fftl);
192extern int spectocepip(double *real, double *imag, long fftl);
193extern int spectocep(double *real, double *imag, double *cep, long fftl);
194extern int ceptospecip(double *real, double *imag, long fftl);
195extern int ceptospec(double *cep, double *real, double *imag, long fftl);
196extern int ceptompc(double *cep, long fftl);
197extern int ceplif(double *cep, long fftl, long lif);
198extern int cepwlif(double *cep, long fftl, long period, long width);
199
207extern int spGetNumFFTPlugin(void);
212extern char *xspSearchFFTPluginFile(int *index);
216extern spBool spSetDefaultFFTPlugin(const char *name);
224extern spPlugin *spLoadFFTPlugin(const char *name);
229
233extern spFFTSpeed spGetFFTSpeed(spFFTPrecision precision);
245extern spFFTRec spInitBatchedFFTByPlugin(spPlugin *plugin, long order, long batch, spFFTPrecision precision);
256extern spFFTRec spInitBatchedFFT(long order, long batch, spFFTPrecision precision);
265extern spFFTRec spInitFFTByPlugin(spPlugin *plugin, long order, spFFTPrecision precision);
273extern spFFTRec spInitFFT(long order, spFFTPrecision precision);
277extern spBool spFreeFFT(spFFTRec fftrec);
282extern spBool spResetFFTOrder(spFFTRec fftrec, long order);
286extern long spGetFFTOrder(spFFTRec fftrec);
290extern long spGetFFTLength(spFFTRec fftrec);
294extern long spGetFFTBatch(spFFTRec fftrec);
296extern spBool spExecFFTF(spFFTRec fftrec, float *real, float *imag, int inv);
303extern spBool spExecFFT(spFFTRec fftrec, double *real, double *imag, int inv);
305extern spBool spExecRealFFTF(spFFTRec fftrec, float *data, int inv);
313extern spBool spExecRealFFT(spFFTRec fftrec, double *data, int inv);
315extern spBool spExecFFTPowerF(spFFTRec fftrec, float *data, float exponent);
321extern spBool spExecFFTPower(spFFTRec fftrec, double *data, double exponent);
322
328extern spBool spTurnFFTSpectrumF(spFFTRec fftrec, float *real, float *imag);
329extern spBool spTurnFFTSpectrum(spFFTRec fftrec, double *real, double *imag);
330extern spBool spExecFFTShiftF(spFFTRec fftrec, float *real, float *imag);
331extern spBool spExecFFTShift(spFFTRec fftrec, double *real, double *imag);
332extern spBool spExecDataShiftF(spFFTRec fftrec, float *real, float *imag, long shift);
333extern spBool spExecDataShift(spFFTRec fftrec, double *real, double *imag, long shift);
334extern spBool spExecCircShiftF(spFFTRec fftrec, float *real, float *imag, long shift);
335extern spBool spExecCircShift(spFFTRec fftrec, double *real, double *imag, long shift);
336
342extern spBool spGetSpectrumForRealFFTF(spFFTRec fftrec, float *real, float *imag, float *rspec);
343extern spBool spGetSpectrumForRealFFT(spFFTRec fftrec, double *real, double *imag, double *rspec);
344extern spBool spGetComplexFromRealFFTF(spFFTRec fftrec, float *rspec, float *real, float *imag);
345extern spBool spGetComplexFromRealFFT(spFFTRec fftrec, double *rspec, double *real, double *imag);
346extern spBool spMultiplySpectrumOfRealFFTF(spFFTRec fftrec, float *rspec1, float *rspec2);
347extern spBool spMultiplySpectrumOfRealFFT(spFFTRec fftrec, double *rspec1, double *rspec2);
348
354extern void fvfft(FVector x);
355extern void dvfft(DVector x);
356extern void fvifft(FVector x);
357extern void dvifft(DVector x);
358extern FVector xfvfft(FVector x, long length);
359extern DVector xdvfft(DVector x, long length);
360extern FVector xfvifft(FVector x, long length);
361extern DVector xdvifft(DVector x, long length);
362
368extern void svdatashift(SVector x, long shift);
369extern void lvdatashift(LVector x, long shift);
370extern void fvdatashift(FVector x, long shift);
371extern void dvdatashift(DVector x, long shift);
372extern void svcircshift(SVector x, long shift);
373extern void lvcircshift(LVector x, long shift);
374extern void fvcircshift(FVector x, long shift);
375extern void dvcircshift(DVector x, long shift);
376extern FVector xfvfftshift(FVector x, long length);
377extern DVector xdvfftshift(DVector x, long length);
378extern FVector xfvfftturn(FVector x, long length);
379extern DVector xdvfftturn(DVector x, long length);
380extern void fvfftshift(FVector x);
381extern void dvfftshift(DVector x);
382extern void fvfftturn(FVector x);
383extern void dvfftturn(DVector x);
384
390extern FVector xfvfftconv(FVector a, FVector b, long fftl);
391extern DVector xdvfftconv(DVector a, DVector b, long fftl);
392
393extern FVector xfvfftpower(FVector x, long fftl);
394extern DVector xdvfftpower(DVector x, long fftl);
395extern FVector xfvfftabs(FVector x, long fftl);
396extern DVector xdvfftabs(DVector x, long fftl);
397
398extern FVector xfvfftangle(FVector x, long fftl);
399extern DVector xdvfftangle(DVector x, long fftl);
400extern FVector xfvfftgrpdly(FVector x, long fftl);
401extern DVector xdvfftgrpdly(DVector x, long fftl);
402extern FVector xfvgdtophase(FVector gd, long fftl, int reverse);
403extern DVector xdvgdtophase(DVector gd, long fftl, int reverse);
404extern FVector xfvzerophase(FVector x, long fftl);
405extern DVector xdvzerophase(DVector x, long fftl);
406extern FVector xfvcspec(FVector mag, FVector phs);
407extern DVector xdvcspec(DVector mag, DVector phs);
408
414extern void dvspectocep(DVector x);
415extern void dvceptospec(DVector x);
416extern DVector xdvrcep(DVector x, long fftl);
417extern void dvrcep(DVector x);
418extern void dvceptompc(DVector cep);
419extern DVector xdvmpcep(DVector x, long fftl);
420extern void dvmpcep(DVector x);
421extern void dvlif(DVector cep, long fftl, long lif);
422extern DVector xdvmelwarp(DVector cep, long order, long mel_order, double alpha);
423
429extern DVector xdvtsp(double amp, long m, long n, int inverse);
430extern DVector xdvftsp(double amp, long m, long n, int inverse); /* tsp in frequency domain */
431extern DVector xdvrftsp(double amp, long m, long n, int inverse); /* tsp in frequency domain for real FFT */
432
433/* alpha: duty factor associated with the duration (>= 2 is recommended).
434 * Bigger value makes the duration short. */
435extern DVector xdvgtsp(double amp, double alpha, long n, int inverse);
436extern DVector xdvfgtsp(double amp, double alpha, long n, int inverse); /* gtsp in frequency domain */
437extern DVector xdvrfgtsp(double amp, double alpha, long n, int inverse); /* gtsp in frequency domain for real FFT */
438
439extern void dvtspshift(DVector tsp, long m, int inverse);
440extern void dvgtspshift(DVector gtsp, double alpha, int inverse);
441
445extern spFFTRec dvinitfft(long order, spFFTPrecision precision);
446extern spBool dvfreefft(spFFTRec fftrec);
447extern spBool dvresetfftorder(spFFTRec fftrec, long order);
448extern long dvgetfftorder(spFFTRec fftrec);
449extern long dvgetfftlength(spFFTRec fftrec);
450extern long dvgetfftbatch(spFFTRec fftrec);
451
452extern spBool dvexecfftf(spFFTRec fftrec, float *real, float *imag, int inv);
453extern spBool dvexecfft(spFFTRec fftrec, double *real, double *imag, int inv);
454extern spBool dvexecrfftf(spFFTRec fftrec, float *data, int inv);
455extern spBool dvexecrfft(spFFTRec fftrec, double *data, int inv);
456
460extern spBool dvfftex(spFFTRec fftrec, DVector x);
461extern spBool dvifftex(spFFTRec fftrec, DVector x);
462extern spBool dvrfftex(spFFTRec fftrec, DVector x);
463extern spBool dvirfftex(spFFTRec fftrec, DVector x);
464extern DVector xdvfftex(spFFTRec fftrec, DVector x);
465extern DVector xdvifftex(spFFTRec fftrec, DVector x);
466extern DVector xdvrfftex(spFFTRec fftrec, DVector x);
467extern DVector xdvirfftex(spFFTRec fftrec, DVector x);
468
474extern spBool dvfftturnex(spFFTRec fftrec, DVector x);
475extern DVector xdvfftturnex(spFFTRec fftrec, DVector x);
476extern spBool dvfftshiftex(spFFTRec fftrec, DVector x);
477extern DVector xdvfftshiftex(spFFTRec fftrec, DVector x);
478
484extern spBool dvmultrfftex(spFFTRec fftrec, DVector a, DVector b);
485extern void dvrffttofftex(spFFTRec fftrec, DVector x);
486extern void dvffttorfftex(spFFTRec fftrec, DVector x);
487extern void dvrffttopowerex(spFFTRec fftrec, DVector x, double exponent);
488extern void dvpowertorfftex(spFFTRec fftrec, DVector x, double orig_exponent);
489
495extern spBool dvfftpowerex(spFFTRec fftrec, DVector x);
496extern spBool dvfftabsex(spFFTRec fftrec, DVector x);
497extern spBool dvifftabsex(spFFTRec fftrec, DVector x);
498extern spBool dvfftangleex(spFFTRec fftrec, DVector x);
499extern spBool dvfftgrpdlyex(spFFTRec fftrec, DVector x);
500extern DVector xdvfftgrpdlyex(spFFTRec fftrec, DVector x);
501extern spBool dvfftconvex(spFFTRec fftrec, DVector a, DVector b);
502extern DVector xdvfftconvex(spFFTRec fftrec, DVector a, DVector b);
503
509extern spBool dvspectocepex(spFFTRec fftrec, DVector x);
510extern spBool dvspectompcex(spFFTRec fftrec, DVector x);
511extern spBool dvrffttocepex(spFFTRec fftrec, DVector x);
512extern spBool dvrffttompcex(spFFTRec fftrec, DVector x);
513extern spBool dvceptospecex(spFFTRec fftrec, DVector x);
514extern spBool dvceptorfftex(spFFTRec fftrec, DVector x);
515extern void dvceptompcex(spFFTRec fftrec, DVector x);
516extern spBool dvrcepex(spFFTRec fftrec, DVector x);
517extern spBool dvmpcepex(spFFTRec fftrec, DVector x);
518
521#if defined(MACOS)
522#pragma import off
523#endif
524
525 /*----@addtogroup fftGroup----*/
526
527#define fftf(xRe, xIm, fftl, inv) spfftf(xRe, xIm, fftl, inv);
528#define fft(xRe, xIm, fftl, inv) spfft(xRe, xIm, fftl, inv);
529
530#define xdvrceps(x, fftl) xdvrcep(x, fftl)
531#define dvrceps(x) dvrcep(x)
532#define xdvmpceps(x, fftl) xdvmpcep(x, fftl)
533#define dvmpceps(x) dvmpcep(x)
534
535#define spectocep_ow spectocepip
536#define ceptospec_ow ceptospecip
537
538#define fftpowtorfftf(powspec, orig_exponent, fftl) powertorfftf(powspec, orig_exponent, fftl)
539#define fftpowtorfft(powspec, orig_exponent, fftl) powertorfft(powspec, orig_exponent, fftl)
540
541#define DVFFTRec spFFTRec
542
543#ifdef __cplusplus
544} /* Close scope of 'extern "C"' declaration */
545#endif
546
547#endif /* SPLIB_FFT_H */
FFTの実行を制御するクラスです.
spBool spExecFFTPower(spFFTRec fftrec, double *data, double exponent)
spBool spResetFFTOrder(spFFTRec fftrec, long order)
void ricircshiftf(float *real, float *imag, long length, long shift)
void ridatashiftl(long *real, long *imag, long length, long shift)
int spfftf(float *xRe, float *xIm, long fftl, int inv)
void fftshiftf(float *xRe, float *xIm, long fftl)
int spfft(double *xRe, double *xIm, long fftl, int inv)
void datashift(double *data, long length, long shift)
long spGetFFTOrder(spFFTRec fftrec)
spBool spExecFFT(spFFTRec fftrec, double *real, double *imag, int inv)
spBool spExecRealFFT(spFFTRec fftrec, double *data, int inv)
spFFTSpeed spGetFFTSpeed(spFFTPrecision precision)
void circshifts(short *data, long length, long shift)
struct _spFFTRec * spFFTRec
Definition fft.h:59
spBool spExecFFTF(spFFTRec fftrec, float *real, float *imag, int inv)
void ridatashift(double *real, double *imag, long length, long shift)
long spGetFFTLength(spFFTRec fftrec)
spFFTRec spInitFFT(long order, spFFTPrecision precision)
void ricircshift(double *real, double *imag, long length, long shift)
void circshiftf(float *data, long length, long shift)
spFFTRec spInitFFTByPlugin(spPlugin *plugin, long order, spFFTPrecision precision)
void fftshift(double *xRe, double *xIm, long fftl)
spBool spFreeFFT(spFFTRec fftrec)
int sprfft(double *data, long fftl, int inv)
int sprfftf(float *data, long fftl, int inv)
spBool spExecFFTPowerF(spFFTRec fftrec, float *data, float exponent)
spPlugin * spLoadFFTPlugin(const char *name)
void fftturn(double *xRe, double *xIm, long fftl)
void ridatashifts(short *real, short *imag, long length, long shift)
void datashiftl(long *data, long length, long shift)
void datashiftf(float *data, long length, long shift)
spFFTRec spInitBatchedFFT(long order, long batch, spFFTPrecision precision)
spBool spExecRealFFTF(spFFTRec fftrec, float *data, int inv)
spFFTRec spInitBatchedFFTByPlugin(spPlugin *plugin, long order, long batch, spFFTPrecision precision)
void circshift(double *data, long length, long shift)
spBool spSetDefaultFFTPlugin(const char *name)
void ridatashiftf(float *real, float *imag, long length, long shift)
void fftturnf(float *xRe, float *xIm, long fftl)
spBool spFreeFFTPlugin(spPlugin *plugin)
void ricircshifts(short *real, short *imag, long length, long shift)
char * xspSearchFFTPluginFile(int *index)
spBool spIsFFTPlugin(spPlugin *plugin)
long spGetFFTBatch(spFFTRec fftrec)
void datashifts(short *data, long length, long shift)
void circshiftl(long *data, long length, long shift)
int spGetNumFFTPlugin(void)
void ricircshiftl(long *real, long *imag, long length, long shift)
int spBool