Blame gst-libs/gst/fft/kiss_fft_s16.h

Packit 971217
#ifndef KISS_FFT_S16_H
Packit 971217
#define KISS_FFT_S16_H
Packit 971217
Packit 971217
#ifdef HAVE_CONFIG_H
Packit 971217
#include "config.h"
Packit 971217
#endif
Packit 971217
Packit 971217
#ifdef HAVE_STDINT_H
Packit 971217
#include <stdint.h>
Packit 971217
#endif
Packit 971217
Packit 971217
#include <stdlib.h>
Packit 971217
#include <stdio.h>
Packit 971217
#include <math.h>
Packit 971217
#include <string.h>
Packit 971217
#include <glib.h>
Packit 971217
Packit 971217
#ifdef __cplusplus
Packit 971217
extern "C" {
Packit 971217
#endif
Packit 971217
Packit 971217
/*
Packit 971217
 ATTENTION!
Packit 971217
 If you would like a :
Packit 971217
 -- a utility that will handle the caching of fft objects
Packit 971217
 -- real-only (no imaginary time component ) FFT
Packit 971217
 -- a multi-dimensional FFT
Packit 971217
 -- a command-line utility to perform ffts
Packit 971217
 -- a command-line utility to perform fast-convolution filtering
Packit 971217
Packit 971217
 Then see kfc.h kiss_fftr.h kiss_fftnd.h fftutil.c kiss_fastfir.c
Packit 971217
  in the tools/ directory.
Packit 971217
*/
Packit 971217
Packit 971217
#define KISS_FFT_S16_MALLOC g_malloc
Packit 971217
Packit 971217
#define kiss_fft_s16_scalar int16_t
Packit 971217
Packit 971217
typedef struct {
Packit 971217
    kiss_fft_s16_scalar r;
Packit 971217
    kiss_fft_s16_scalar i;
Packit 971217
}kiss_fft_s16_cpx;
Packit 971217
Packit 971217
typedef struct kiss_fft_s16_state* kiss_fft_s16_cfg;
Packit 971217
Packit 971217
/* 
Packit 971217
 *  kiss_fft_s16_alloc
Packit 971217
 *  
Packit 971217
 *  Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
Packit 971217
 *
Packit 971217
 *  typical usage:      kiss_fft_s16_cfg mycfg=kiss_fft_s16_alloc(1024,0,NULL,NULL);
Packit 971217
 *
Packit 971217
 *  The return value from fft_alloc is a cfg buffer used internally
Packit 971217
 *  by the fft routine or NULL.
Packit 971217
 *
Packit 971217
 *  If lenmem is NULL, then kiss_fft_s16_alloc will allocate a cfg buffer using malloc.
Packit 971217
 *  The returned value should be free()d when done to avoid memory leaks.
Packit 971217
 *  
Packit 971217
 *  The state can be placed in a user supplied buffer 'mem':
Packit 971217
 *  If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
Packit 971217
 *      then the function places the cfg in mem and the size used in *lenmem
Packit 971217
 *      and returns mem.
Packit 971217
 *  
Packit 971217
 *  If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
Packit 971217
 *      then the function returns NULL and places the minimum cfg 
Packit 971217
 *      buffer size in *lenmem.
Packit 971217
 * */
Packit 971217
Packit 971217
kiss_fft_s16_cfg kiss_fft_s16_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); 
Packit 971217
Packit 971217
/*
Packit 971217
 * kiss_fft(cfg,in_out_buf)
Packit 971217
 *
Packit 971217
 * Perform an FFT on a complex input buffer.
Packit 971217
 * for a forward FFT,
Packit 971217
 * fin should be  f[0] , f[1] , ... ,f[nfft-1]
Packit 971217
 * fout will be   F[0] , F[1] , ... ,F[nfft-1]
Packit 971217
 * Note that each element is complex and can be accessed like
Packit 971217
    f[k].r and f[k].i
Packit 971217
 * */
Packit 971217
void kiss_fft_s16(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout);
Packit 971217
Packit 971217
/*
Packit 971217
 A more generic version of the above function. It reads its input from every Nth sample.
Packit 971217
 * */
Packit 971217
void kiss_fft_s16_stride(kiss_fft_s16_cfg cfg,const kiss_fft_s16_cpx *fin,kiss_fft_s16_cpx *fout,int fin_stride);
Packit 971217
Packit 971217
/* If kiss_fft_s16_alloc allocated a buffer, it is one contiguous 
Packit 971217
   buffer and can be simply free()d when no longer needed*/
Packit 971217
#define kiss_fft_s16_free g_free
Packit 971217
Packit 971217
/*
Packit 971217
 Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up 
Packit 971217
 your compiler output to call this before you exit.
Packit 971217
*/
Packit 971217
void kiss_fft_s16_cleanup(void);
Packit 971217
	
Packit 971217
Packit 971217
/*
Packit 971217
 * Returns the smallest integer k, such that k>=n and k has only "fast" factors (2,3,5)
Packit 971217
 */
Packit 971217
int kiss_fft_s16_next_fast_size(int n);
Packit 971217
Packit 971217
/* for real ffts, we need an even size */
Packit 971217
#define kiss_fftr_next_fast_size_real(n) \
Packit 971217
        (kiss_fft_next_fast_size( ((n)+1)>>1)<<1)
Packit 971217
Packit 971217
#ifdef __cplusplus
Packit 971217
} 
Packit 971217
#endif
Packit 971217
Packit 971217
#endif