spLib
Loading...
Searching...
No Matches
fftplugin.h
1/*
2 * fftplugin.h
3 */
4
5#ifndef SPLIB_FFTPLUGIN_H
6#define SPLIB_FFTPLUGIN_H
7
8#include <sp/spPluginP.h>
9#include <sp/fft.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define SP_PLUGIN_FFT "FFT 1.2"
16
17#define SP_FFT_PLUGIN_CAPS_SUPPORT_BATCH (1<<(SP_PLUGIN_CAPS_USER_SHIFT))
18
19typedef struct _spFFTPluginRec spFFTPluginRec;
20
21struct _spFFTPluginRec
22{
23 void *host_data;
24 void *user_data;
25
26 spPluginType type;
27 char *plugin_id;
28 long version_id;
29 int priority;
30 unsigned long caps;
31 spBool (*init)(const char *lang);
32 spBool (*free)(void);
33 char *description;
34 char *information;
35
36 void *(*init_instance)(const char *lang);
37 spBool (*free_instance)(void *instance);
38 spOptions (*init_options)(void *instance, const char *lang);
39 spBool (*free_options)(void *instance, spOptions options);
40
41 spBool (*get_num_unit)(void *instance, int *num_unit);
42 const char *(*get_unit_name)(void *instance, int index);
43 spBool (*select_unit)(void *instance, int index);
44
45 spBool (*is_precision_supported)(void *instance, spFFTPrecision precision, spFFTSpeed *speed);
46
47 spBool (*set_other_info)(void *instance, const char *id, char *data);
48 spBool (*get_other_info)(void *instance, const char *id, char *data);
49
50 void *(*init_fft)(void *instance, long order, long batch, spFFTPrecision precision);
51 spBool (*free_fft)(void *instance, void *fftrec);
52 spBool (*reset_fft_order)(void *instance, void *fftrec, long order);
53
54 spBool (*exec_fftf)(void *instance, void *fftrec, float *real, float *imag, int inv);
55 spBool (*exec_fft)(void *instance, void *fftrec, double *real, double *imag, int inv);
56
57 spBool (*exec_real_fftf)(void *instance, void *fftrec, float *data, int inv);
58 spBool (*exec_real_fft)(void *instance, void *fftrec, double *data, int inv);
59
60 /* exec_fft_powerf and exec_fft_power can be NULL.
61 * exponent=1.0:power spectrum, exponent=0.5:amplitude spectrum */
62 spBool (*exec_fft_powerf)(void *instance, void *fftrec, float *data, float exponent);
63 spBool (*exec_fft_power)(void *instance, void *fftrec, double *data, double exponent);
64};
65
66#define SpFFTRecPluginRec(fftrec) ((spFFTPluginRec *)fftrec->plugin->rec)
67
68extern spBool spInitFFT_Plugin(spFFTRec fftrec);
69extern spBool spFreeFFT_Plugin(spFFTRec fftrec);
70extern spBool spResetFFTOrder_Plugin(spFFTRec fftrec);
71extern spBool spExecFFTF_Plugin(spFFTRec fftrec, float *real, float *imag, int inv);
72extern spBool spExecFFT_Plugin(spFFTRec fftrec, double *real, double *imag, int inv);
73extern spBool spExecRealFFTF_Plugin(spFFTRec fftrec, float *data, int inv);
74extern spBool spExecRealFFT_Plugin(spFFTRec fftrec, double *data, int inv);
75extern spBool spExecFFTPowerF_Plugin(spFFTRec fftrec, float *data, float exponent);
76extern spBool spExecFFTPower_Plugin(spFFTRec fftrec, double *data, double exponent);
77
78#ifdef __cplusplus
79} /* Close scope of 'extern "C"' declaration */
80#endif
81
82#endif /* SPLIB_FFTPLUGIN_H */
A class to handle FFT execution.
#define spFFTSpeed
Definition fft.h:24
int spBool
struct _spOptions * spOptions