summaryrefslogtreecommitdiffstats
path: root/libavcodec/dsputil.h
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-10-28 00:34:08 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-10-28 00:34:08 +0000
commitbb6f5690728486b71e280a295aef4c49d25ee758 (patch)
treebb4def001175ea9c928da56cc2eb8cbcc77488b1 /libavcodec/dsputil.h
parent6d291820978ee1058f7154ed0b8cb7377c8bed51 (diff)
downloadffmpeg-streaming-bb6f5690728486b71e280a295aef4c49d25ee758.zip
ffmpeg-streaming-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.h49
1 files changed, 48 insertions, 1 deletions
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index a8285c8..096dc28 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
OpenPOWER on IntegriCloud