diff options
author | Fabrice Bellard <fabrice@bellard.org> | 2002-10-28 00:34:08 +0000 |
---|---|---|
committer | Fabrice Bellard <fabrice@bellard.org> | 2002-10-28 00:34:08 +0000 |
commit | bb6f5690728486b71e280a295aef4c49d25ee758 (patch) | |
tree | bb4def001175ea9c928da56cc2eb8cbcc77488b1 /libavcodec/dsputil.h | |
parent | 6d291820978ee1058f7154ed0b8cb7377c8bed51 (diff) | |
download | ffmpeg-bb6f5690728486b71e280a295aef4c49d25ee758.tar.gz |
new generic FFT/MDCT code for audio codecs
Originally committed as revision 1088 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dsputil.h')
-rw-r--r-- | libavcodec/dsputil.h | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index a8285c80b6..096dc288c6 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -221,5 +221,52 @@ struct unaligned_32 { uint32_t l; } __attribute__((packed)); void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3], int orig_linesize[3], int coded_linesize, AVCodecContext *avctx); - + +/* FFT computation */ + +/* NOTE: soon integer code will be added, so you must use the + FFTSample type */ +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext { + int nbits; + int inverse; + uint16_t *revtab; + FFTComplex *exptab; + FFTComplex *exptab1; /* only used by SSE code */ + void (*fft_calc)(struct FFTContext *s, FFTComplex *z); +} FFTContext; + +int fft_init(FFTContext *s, int nbits, int inverse); +void fft_permute(FFTContext *s, FFTComplex *z); +void fft_calc_c(FFTContext *s, FFTComplex *z); +void fft_calc_sse(FFTContext *s, FFTComplex *z); +static inline void fft_calc(FFTContext *s, FFTComplex *z) +{ + s->fft_calc(s, z); +} +void fft_end(FFTContext *s); + +/* MDCT computation */ + +typedef struct MDCTContext { + int n; /* size of MDCT (i.e. number of input data * 2) */ + int nbits; /* n = 2^nbits */ + /* pre/post rotation tables */ + FFTSample *tcos; + FFTSample *tsin; + FFTContext fft; +} MDCTContext; + +int mdct_init(MDCTContext *s, int nbits, int inverse); +void imdct_calc(MDCTContext *s, FFTSample *output, + const FFTSample *input, FFTSample *tmp); +void mdct_calc(MDCTContext *s, FFTSample *out, + const FFTSample *input, FFTSample *tmp); +void mdct_end(MDCTContext *s); + #endif |