Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / fft / kiss_fft_s32.h
1 #ifndef KISS_FFT_S32_H
2 #define KISS_FFT_S32_H
3
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <math.h>
7 #include <string.h>
8 #include <glib.h>
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 /*
15  ATTENTION!
16  If you would like a :
17  -- a utility that will handle the caching of fft objects
18  -- real-only (no imaginary time component ) FFT
19  -- a multi-dimensional FFT
20  -- a command-line utility to perform ffts
21  -- a command-line utility to perform fast-convolution filtering
22
23  Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
24   in the tools/ directory.
25 */
26
27 #define KISS_FFT_S32_MALLOC g_malloc
28
29
30 #include "_stdint.h"
31
32 #define kiss_fft_s32_scalar int32_t
33
34 typedef struct {
35     kiss_fft_s32_scalar r;
36     kiss_fft_s32_scalar i;
37 }kiss_fft_s32_cpx;
38
39 typedef struct kiss_fft_s32_state* kiss_fft_s32_cfg;
40
41 /* 
42  *  kiss_fft_s32_alloc
43  *  
44  *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
45  *
46  *  typical usage:      kiss_fft_s32_cfg mycfg=kiss_fft_s32_alloc(1024,0,NULL,NULL);
47  *
48  *  The return value from fft_alloc is a cfg buffer used internally
49  *  by the fft routine or NULL.
50  *
51  *  If lenmem is NULL, then kiss_fft_s32_alloc will allocate a cfg buffer using malloc.
52  *  The returned value should be free()d when done to avoid memory leaks.
53  *  
54  *  The state can be placed in a user supplied buffer 'mem':
55  *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
56  *      then the function places the cfg in mem and the size used in *lenmem
57  *      and returns mem.
58  *  
59  *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
60  *      then the function returns NULL and places the minimum cfg 
61  *      buffer size in *lenmem.
62  * */
63
64 kiss_fft_s32_cfg kiss_fft_s32_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
65
66 /*
67  * kiss_fft(cfg,in_out_buf)
68  *
69  * Perform an FFT on a complex input buffer.
70  * for a forward FFT,
71  * fin should be  f[0] , f[1] , ... ,f[nfft-1]
72  * fout will be   F[0] , F[1] , ... ,F[nfft-1]
73  * Note that each element is complex and can be accessed like
74     f[k].r and f[k].i
75  * */
76 void kiss_fft_s32(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout);
77
78 /*
79  A more generic version of the above function. It reads its input from every Nth sample.
80  * */
81 void kiss_fft_s32_stride(kiss_fft_s32_cfg cfg,const kiss_fft_s32_cpx *fin,kiss_fft_s32_cpx *fout,int fin_stride);
82
83 /* If kiss_fft_s32_alloc allocated a buffer, it is one contiguous 
84    buffer and can be simply free()d when no longer needed*/
85 #define kiss_fft_s32_free g_free
86
87 /*
88  Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
89  your compiler output to call this before you exit.
90 */
91 void kiss_fft_s32_cleanup(void);
92         
93
94 /*
95  * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
96  */
97 int kiss_fft_s32_next_fast_size(int n);
98
99 /* for real ffts, we need an even size */
100 #define kiss_fftr_next_fast_size_real(n) \
101         (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
102
103 #ifdef __cplusplus
104
105 #endif
106
107 #endif