Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/dep/ffmpeg/include/libavcodec/avfft.h
4216 views
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg 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.
8
*
9
* FFmpeg 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.
13
*
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with FFmpeg; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#ifndef AVCODEC_AVFFT_H
20
#define AVCODEC_AVFFT_H
21
22
#include "libavutil/attributes.h"
23
#include "version_major.h"
24
#if FF_API_AVFFT
25
26
/**
27
* @file
28
* @ingroup lavc_fft
29
* FFT functions
30
*/
31
32
/**
33
* @defgroup lavc_fft FFT functions
34
* @ingroup lavc_misc
35
*
36
* @{
37
*/
38
39
typedef float FFTSample;
40
41
typedef struct FFTComplex {
42
FFTSample re, im;
43
} FFTComplex;
44
45
typedef struct FFTContext FFTContext;
46
47
/**
48
* Set up a complex FFT.
49
* @param nbits log2 of the length of the input array
50
* @param inverse if 0 perform the forward transform, if 1 perform the inverse
51
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_FFT
52
*/
53
attribute_deprecated
54
FFTContext *av_fft_init(int nbits, int inverse);
55
56
/**
57
* Do the permutation needed BEFORE calling ff_fft_calc().
58
* @deprecated without replacement
59
*/
60
attribute_deprecated
61
void av_fft_permute(FFTContext *s, FFTComplex *z);
62
63
/**
64
* Do a complex FFT with the parameters defined in av_fft_init(). The
65
* input data must be permuted before. No 1.0/sqrt(n) normalization is done.
66
* @deprecated use the av_tx_fn value returned by av_tx_init, which also does permutation
67
*/
68
attribute_deprecated
69
void av_fft_calc(FFTContext *s, FFTComplex *z);
70
71
attribute_deprecated
72
void av_fft_end(FFTContext *s);
73
74
/**
75
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_MDCT,
76
* with a flag of AV_TX_FULL_IMDCT for a replacement to av_imdct_calc.
77
*/
78
attribute_deprecated
79
FFTContext *av_mdct_init(int nbits, int inverse, double scale);
80
attribute_deprecated
81
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
82
attribute_deprecated
83
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
84
attribute_deprecated
85
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
86
attribute_deprecated
87
void av_mdct_end(FFTContext *s);
88
89
/* Real Discrete Fourier Transform */
90
91
enum RDFTransformType {
92
DFT_R2C,
93
IDFT_C2R,
94
IDFT_R2C,
95
DFT_C2R,
96
};
97
98
typedef struct RDFTContext RDFTContext;
99
100
/**
101
* Set up a real FFT.
102
* @param nbits log2 of the length of the input array
103
* @param trans the type of transform
104
*
105
* @deprecated use av_tx_init from libavutil/tx.h with a type of AV_TX_FLOAT_RDFT
106
*/
107
attribute_deprecated
108
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
109
attribute_deprecated
110
void av_rdft_calc(RDFTContext *s, FFTSample *data);
111
attribute_deprecated
112
void av_rdft_end(RDFTContext *s);
113
114
/* Discrete Cosine Transform */
115
116
typedef struct DCTContext DCTContext;
117
118
enum DCTTransformType {
119
DCT_II = 0,
120
DCT_III,
121
DCT_I,
122
DST_I,
123
};
124
125
/**
126
* Set up DCT.
127
*
128
* @param nbits size of the input array:
129
* (1 << nbits) for DCT-II, DCT-III and DST-I
130
* (1 << nbits) + 1 for DCT-I
131
* @param type the type of transform
132
*
133
* @note the first element of the input of DST-I is ignored
134
*
135
* @deprecated use av_tx_init from libavutil/tx.h with an appropriate type of AV_TX_FLOAT_DCT
136
*/
137
attribute_deprecated
138
DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
139
attribute_deprecated
140
void av_dct_calc(DCTContext *s, FFTSample *data);
141
attribute_deprecated
142
void av_dct_end (DCTContext *s);
143
144
/**
145
* @}
146
*/
147
148
#endif /* FF_API_AVFFT */
149
#endif /* AVCODEC_AVFFT_H */
150
151