annotate avfft.c @ 11520:a791382fd782 libavcodec

Reindent after r22618.
author vitor
date Sun, 21 Mar 2010 11:36:17 +0000
parents 384d803faff4
children f468aac92300
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11392
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
1 /*
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
2 * This file is part of FFmpeg.
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
3 *
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
4 * FFmpeg is free software; you can redistribute it and/or
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
5 * modify it under the terms of the GNU Lesser General Public
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
7 * version 2.1 of the License, or (at your option) any later version.
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
8 *
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
9 * FFmpeg is distributed in the hope that it will be useful,
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
12 * Lesser General Public License for more details.
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
13 *
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
14 * You should have received a copy of the GNU Lesser General Public
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
15 * License along with FFmpeg; if not, write to the Free Software
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
17 */
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
18
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
19 #include "libavutil/mem.h"
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
20 #include "avfft.h"
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
21 #include "fft.h"
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
22
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
23 /* FFT */
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
24
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
25 FFTContext *av_fft_init(int nbits, int inverse)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
26 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
27 FFTContext *s = av_malloc(sizeof(*s));
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
28
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
29 if (s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
30 ff_fft_init(s, nbits, inverse);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
31
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
32 return s;
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
33 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
34
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
35 void av_fft_permute(FFTContext *s, FFTComplex *z)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
36 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
37 s->fft_permute(s, z);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
38 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
39
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
40 void av_fft_calc(FFTContext *s, FFTComplex *z)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
41 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
42 s->fft_calc(s, z);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
43 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
44
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
45 void av_fft_end(FFTContext *s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
46 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
47 if (s) {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
48 ff_fft_end(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
49 av_free(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
50 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
51 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
52
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
53 #if CONFIG_MDCT
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
54
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
55 FFTContext *av_mdct_init(int nbits, int inverse, double scale)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
56 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
57 FFTContext *s = av_malloc(sizeof(*s));
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
58
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
59 if (s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
60 ff_mdct_init(s, nbits, inverse, scale);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
61
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
62 return s;
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
63 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
64
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
65 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
66 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
67 s->imdct_calc(s, output, input);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
68 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
69
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
70 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
71 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
72 s->imdct_half(s, output, input);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
73 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
74
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
75 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
76 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
77 s->mdct_calc(s, output, input);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
78 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
79
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
80 void av_mdct_end(FFTContext *s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
81 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
82 if (s) {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
83 ff_mdct_end(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
84 av_free(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
85 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
86 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
87
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
88 #endif /* CONFIG_MDCT */
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
89
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
90 #if CONFIG_RDFT
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
91
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
92 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
93 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
94 RDFTContext *s = av_malloc(sizeof(*s));
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
95
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
96 if (s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
97 ff_rdft_init(s, nbits, trans);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
98
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
99 return s;
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
100 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
101
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
102 void av_rdft_calc(RDFTContext *s, FFTSample *data)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
103 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
104 ff_rdft_calc(s, data);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
105 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
106
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
107 void av_rdft_end(RDFTContext *s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
108 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
109 if (s) {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
110 ff_rdft_end(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
111 av_free(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
112 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
113 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
114
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
115 #endif /* CONFIG_RDFT */
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
116
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
117 #if CONFIG_DCT
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
118
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
119 DCTContext *av_dct_init(int nbits, int inverse)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
120 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
121 DCTContext *s = av_malloc(sizeof(*s));
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
122
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
123 if (s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
124 ff_dct_init(s, nbits, inverse);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
125
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
126 return s;
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
127 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
128
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
129 void av_dct_calc(DCTContext *s, FFTSample *data)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
130 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
131 ff_dct_calc(s, data);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
132 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
133
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
134 void av_dct_end(DCTContext *s)
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
135 {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
136 if (s) {
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
137 ff_dct_end(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
138 av_free(s);
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
139 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
140 }
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
141
384d803faff4 Create a public API for FFT family of functions
mru
parents:
diff changeset
142 #endif /* CONFIG_DCT */