annotate ffmpeg/libavcodec/avfft.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents 6840f77b83aa
children
rev   line source
yading@10 1 /*
yading@10 2 * This file is part of FFmpeg.
yading@10 3 *
yading@10 4 * FFmpeg is free software; you can redistribute it and/or
yading@10 5 * modify it under the terms of the GNU Lesser General Public
yading@10 6 * License as published by the Free Software Foundation; either
yading@10 7 * version 2.1 of the License, or (at your option) any later version.
yading@10 8 *
yading@10 9 * FFmpeg is distributed in the hope that it will be useful,
yading@10 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@10 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@10 12 * Lesser General Public License for more details.
yading@10 13 *
yading@10 14 * You should have received a copy of the GNU Lesser General Public
yading@10 15 * License along with FFmpeg; if not, write to the Free Software
yading@10 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@10 17 */
yading@10 18
yading@10 19 #ifndef AVCODEC_AVFFT_H
yading@10 20 #define AVCODEC_AVFFT_H
yading@10 21
yading@10 22 /**
yading@10 23 * @file
yading@10 24 * @ingroup lavc_fft
yading@10 25 * FFT functions
yading@10 26 */
yading@10 27
yading@10 28 /**
yading@10 29 * @defgroup lavc_fft FFT functions
yading@10 30 * @ingroup lavc_misc
yading@10 31 *
yading@10 32 * @{
yading@10 33 */
yading@10 34
yading@10 35 typedef float FFTSample;
yading@10 36
yading@10 37 typedef struct FFTComplex {
yading@10 38 FFTSample re, im;
yading@10 39 } FFTComplex;
yading@10 40
yading@10 41 typedef struct FFTContext FFTContext;
yading@10 42
yading@10 43 /**
yading@10 44 * Set up a complex FFT.
yading@10 45 * @param nbits log2 of the length of the input array
yading@10 46 * @param inverse if 0 perform the forward transform, if 1 perform the inverse
yading@10 47 */
yading@10 48 FFTContext *av_fft_init(int nbits, int inverse);
yading@10 49
yading@10 50 /**
yading@10 51 * Do the permutation needed BEFORE calling ff_fft_calc().
yading@10 52 */
yading@10 53 void av_fft_permute(FFTContext *s, FFTComplex *z);
yading@10 54
yading@10 55 /**
yading@10 56 * Do a complex FFT with the parameters defined in av_fft_init(). The
yading@10 57 * input data must be permuted before. No 1.0/sqrt(n) normalization is done.
yading@10 58 */
yading@10 59 void av_fft_calc(FFTContext *s, FFTComplex *z);
yading@10 60
yading@10 61 void av_fft_end(FFTContext *s);
yading@10 62
yading@10 63 FFTContext *av_mdct_init(int nbits, int inverse, double scale);
yading@10 64 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
yading@10 65 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
yading@10 66 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
yading@10 67 void av_mdct_end(FFTContext *s);
yading@10 68
yading@10 69 /* Real Discrete Fourier Transform */
yading@10 70
yading@10 71 enum RDFTransformType {
yading@10 72 DFT_R2C,
yading@10 73 IDFT_C2R,
yading@10 74 IDFT_R2C,
yading@10 75 DFT_C2R,
yading@10 76 };
yading@10 77
yading@10 78 typedef struct RDFTContext RDFTContext;
yading@10 79
yading@10 80 /**
yading@10 81 * Set up a real FFT.
yading@10 82 * @param nbits log2 of the length of the input array
yading@10 83 * @param trans the type of transform
yading@10 84 */
yading@10 85 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
yading@10 86 void av_rdft_calc(RDFTContext *s, FFTSample *data);
yading@10 87 void av_rdft_end(RDFTContext *s);
yading@10 88
yading@10 89 /* Discrete Cosine Transform */
yading@10 90
yading@10 91 typedef struct DCTContext DCTContext;
yading@10 92
yading@10 93 enum DCTTransformType {
yading@10 94 DCT_II = 0,
yading@10 95 DCT_III,
yading@10 96 DCT_I,
yading@10 97 DST_I,
yading@10 98 };
yading@10 99
yading@10 100 /**
yading@10 101 * Set up DCT.
yading@10 102 * @param nbits size of the input array:
yading@10 103 * (1 << nbits) for DCT-II, DCT-III and DST-I
yading@10 104 * (1 << nbits) + 1 for DCT-I
yading@10 105 *
yading@10 106 * @note the first element of the input of DST-I is ignored
yading@10 107 */
yading@10 108 DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
yading@10 109 void av_dct_calc(DCTContext *s, FFTSample *data);
yading@10 110 void av_dct_end (DCTContext *s);
yading@10 111
yading@10 112 /**
yading@10 113 * @}
yading@10 114 */
yading@10 115
yading@10 116 #endif /* AVCODEC_AVFFT_H */