00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVCODEC_FFT_H
00023 #define AVCODEC_FFT_H
00024
00025 #include <stdint.h>
00026 #include "config.h"
00027 #include "libavutil/mem.h"
00028 #include "avfft.h"
00029
00030
00031
00032 struct FFTContext {
00033 int nbits;
00034 int inverse;
00035 uint16_t *revtab;
00036 FFTComplex *tmp_buf;
00037 int mdct_size;
00038 int mdct_bits;
00039
00040 FFTSample *tcos;
00041 FFTSample *tsin;
00045 void (*fft_permute)(struct FFTContext *s, FFTComplex *z);
00050 void (*fft_calc)(struct FFTContext *s, FFTComplex *z);
00051 void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
00052 void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
00053 void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
00054 int fft_permutation;
00055 #define FF_FFT_PERM_DEFAULT 0
00056 #define FF_FFT_PERM_SWAP_LSBS 1
00057 int mdct_permutation;
00058 #define FF_MDCT_PERM_NONE 0
00059 #define FF_MDCT_PERM_INTERLEAVE 1
00060 };
00061
00062 #if CONFIG_HARDCODED_TABLES
00063 #define COSTABLE_CONST const
00064 #else
00065 #define COSTABLE_CONST
00066 #endif
00067
00068 #define COSTABLE(size) \
00069 COSTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_cos_##size)[size/2]
00070
00071 extern COSTABLE(16);
00072 extern COSTABLE(32);
00073 extern COSTABLE(64);
00074 extern COSTABLE(128);
00075 extern COSTABLE(256);
00076 extern COSTABLE(512);
00077 extern COSTABLE(1024);
00078 extern COSTABLE(2048);
00079 extern COSTABLE(4096);
00080 extern COSTABLE(8192);
00081 extern COSTABLE(16384);
00082 extern COSTABLE(32768);
00083 extern COSTABLE(65536);
00084 extern COSTABLE_CONST FFTSample* const ff_cos_tabs[17];
00085
00090 void ff_init_ff_cos_tabs(int index);
00091
00097 int ff_fft_init(FFTContext *s, int nbits, int inverse);
00098
00099 void ff_fft_init_altivec(FFTContext *s);
00100 void ff_fft_init_mmx(FFTContext *s);
00101 void ff_fft_init_arm(FFTContext *s);
00102 void ff_dct_init_mmx(DCTContext *s);
00103
00104 void ff_fft_end(FFTContext *s);
00105
00106 int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale);
00107 void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
00108 void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
00109 void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
00110 void ff_mdct_end(FFTContext *s);
00111
00112 #endif