diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/libwmavoice/avfft.c | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/libwmavoice/avfft.c')
-rw-r--r-- | lib/rbcodec/codecs/libwmavoice/avfft.c | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libwmavoice/avfft.c b/lib/rbcodec/codecs/libwmavoice/avfft.c new file mode 100644 index 0000000000..7d5d08390f --- /dev/null +++ b/lib/rbcodec/codecs/libwmavoice/avfft.c | |||
@@ -0,0 +1,142 @@ | |||
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 | #include "libavutil/mem.h" | ||
20 | #include "avfft.h" | ||
21 | #include "fft.h" | ||
22 | |||
23 | /* FFT */ | ||
24 | |||
25 | FFTContext *av_fft_init(int nbits, int inverse) | ||
26 | { | ||
27 | FFTContext *s = av_malloc(sizeof(*s)); | ||
28 | |||
29 | if (s && ff_fft_init(s, nbits, inverse)) | ||
30 | av_freep(&s); | ||
31 | |||
32 | return s; | ||
33 | } | ||
34 | |||
35 | void av_fft_permute(FFTContext *s, FFTComplex *z) | ||
36 | { | ||
37 | s->fft_permute(s, z); | ||
38 | } | ||
39 | |||
40 | void av_fft_calc(FFTContext *s, FFTComplex *z) | ||
41 | { | ||
42 | s->fft_calc(s, z); | ||
43 | } | ||
44 | |||
45 | void av_fft_end(FFTContext *s) | ||
46 | { | ||
47 | if (s) { | ||
48 | ff_fft_end(s); | ||
49 | av_free(s); | ||
50 | } | ||
51 | } | ||
52 | |||
53 | #if CONFIG_MDCT | ||
54 | |||
55 | FFTContext *av_mdct_init(int nbits, int inverse, double scale) | ||
56 | { | ||
57 | FFTContext *s = av_malloc(sizeof(*s)); | ||
58 | |||
59 | if (s && ff_mdct_init(s, nbits, inverse, scale)) | ||
60 | av_freep(&s); | ||
61 | |||
62 | return s; | ||
63 | } | ||
64 | |||
65 | void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) | ||
66 | { | ||
67 | s->imdct_calc(s, output, input); | ||
68 | } | ||
69 | |||
70 | void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input) | ||
71 | { | ||
72 | s->imdct_half(s, output, input); | ||
73 | } | ||
74 | |||
75 | void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) | ||
76 | { | ||
77 | s->mdct_calc(s, output, input); | ||
78 | } | ||
79 | |||
80 | void av_mdct_end(FFTContext *s) | ||
81 | { | ||
82 | if (s) { | ||
83 | ff_mdct_end(s); | ||
84 | av_free(s); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | #endif /* CONFIG_MDCT */ | ||
89 | |||
90 | #if CONFIG_RDFT | ||
91 | |||
92 | RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) | ||
93 | { | ||
94 | RDFTContext *s = av_malloc(sizeof(*s)); | ||
95 | |||
96 | if (s && ff_rdft_init(s, nbits, trans)) | ||
97 | av_freep(&s); | ||
98 | |||
99 | return s; | ||
100 | } | ||
101 | |||
102 | void av_rdft_calc(RDFTContext *s, FFTSample *data) | ||
103 | { | ||
104 | ff_rdft_calc(s, data); | ||
105 | } | ||
106 | |||
107 | void av_rdft_end(RDFTContext *s) | ||
108 | { | ||
109 | if (s) { | ||
110 | ff_rdft_end(s); | ||
111 | av_free(s); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | #endif /* CONFIG_RDFT */ | ||
116 | |||
117 | #if CONFIG_DCT | ||
118 | |||
119 | DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse) | ||
120 | { | ||
121 | DCTContext *s = av_malloc(sizeof(*s)); | ||
122 | |||
123 | if (s && ff_dct_init(s, nbits, inverse)) | ||
124 | av_freep(&s); | ||
125 | |||
126 | return s; | ||
127 | } | ||
128 | |||
129 | void av_dct_calc(DCTContext *s, FFTSample *data) | ||
130 | { | ||
131 | ff_dct_calc(s, data); | ||
132 | } | ||
133 | |||
134 | void av_dct_end(DCTContext *s) | ||
135 | { | ||
136 | if (s) { | ||
137 | ff_dct_end(s); | ||
138 | av_free(s); | ||
139 | } | ||
140 | } | ||
141 | |||
142 | #endif /* CONFIG_DCT */ | ||