annotate lib/libavcodec/avfft.h @ 2383:342b73a61a60

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