aarch64: Add assembly support for -fsanitize=hwaddress tagged globals.
[libav.git] / libavcodec / avfft.c
blob513f57e5f4044c25eef3ce8ca9832ebb5b45e146
1 /*
2 * This file is part of Libav.
4 * Libav is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * Libav is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with Libav; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #include "libavutil/attributes.h"
20 #include "libavutil/mem.h"
21 #include "avfft.h"
22 #include "fft.h"
23 #include "rdft.h"
24 #include "dct.h"
26 /* FFT */
28 FFTContext *av_fft_init(int nbits, int inverse)
30 FFTContext *s = av_malloc(sizeof(*s));
32 if (s && ff_fft_init(s, nbits, inverse))
33 av_freep(&s);
35 return s;
38 void av_fft_permute(FFTContext *s, FFTComplex *z)
40 s->fft_permute(s, z);
43 void av_fft_calc(FFTContext *s, FFTComplex *z)
45 s->fft_calc(s, z);
48 av_cold void av_fft_end(FFTContext *s)
50 if (s) {
51 ff_fft_end(s);
52 av_free(s);
56 #if CONFIG_MDCT
58 FFTContext *av_mdct_init(int nbits, int inverse, double scale)
60 FFTContext *s = av_malloc(sizeof(*s));
62 if (s && ff_mdct_init(s, nbits, inverse, scale))
63 av_freep(&s);
65 return s;
68 void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
70 s->imdct_calc(s, output, input);
73 void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input)
75 s->imdct_half(s, output, input);
78 void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input)
80 s->mdct_calc(s, output, input);
83 av_cold void av_mdct_end(FFTContext *s)
85 if (s) {
86 ff_mdct_end(s);
87 av_free(s);
91 #endif /* CONFIG_MDCT */
93 #if CONFIG_RDFT
95 RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans)
97 RDFTContext *s = av_malloc(sizeof(*s));
99 if (s && ff_rdft_init(s, nbits, trans))
100 av_freep(&s);
102 return s;
105 void av_rdft_calc(RDFTContext *s, FFTSample *data)
107 s->rdft_calc(s, data);
110 av_cold void av_rdft_end(RDFTContext *s)
112 if (s) {
113 ff_rdft_end(s);
114 av_free(s);
118 #endif /* CONFIG_RDFT */
120 #if CONFIG_DCT
122 DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse)
124 DCTContext *s = av_malloc(sizeof(*s));
126 if (s && ff_dct_init(s, nbits, inverse))
127 av_freep(&s);
129 return s;
132 void av_dct_calc(DCTContext *s, FFTSample *data)
134 s->dct_calc(s, data);
137 av_cold void av_dct_end(DCTContext *s)
139 if (s) {
140 ff_dct_end(s);
141 av_free(s);
145 #endif /* CONFIG_DCT */