diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-01-04 02:01:18 -0600 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-23 14:23:04 +0000 |
commit | 14c6bb798d6bebc80f07e863236adbaf8d156a9c (patch) | |
tree | 551a4b641906c2626af844fa3239c1b2b1ff0ad3 /lib/rbcodec/codecs/libopus/celt/kiss_fft.h | |
parent | 75d93937965ec4df70d37df6d4feea04577c996b (diff) | |
download | rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.tar.gz rockbox-14c6bb798d6bebc80f07e863236adbaf8d156a9c.zip |
Sync opus codec to upstream git
Change-Id: I0cfcc0005c4ad7bfbb1aaf454188ce70fb043dc1
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/kiss_fft.h')
-rw-r--r-- | lib/rbcodec/codecs/libopus/celt/kiss_fft.h | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/kiss_fft.h b/lib/rbcodec/codecs/libopus/celt/kiss_fft.h index 390b54d948..bffa2bfad6 100644 --- a/lib/rbcodec/codecs/libopus/celt/kiss_fft.h +++ b/lib/rbcodec/codecs/libopus/celt/kiss_fft.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <stdlib.h> | 32 | #include <stdlib.h> |
33 | #include <math.h> | 33 | #include <math.h> |
34 | #include "arch.h" | 34 | #include "arch.h" |
35 | #include "cpu_support.h" | ||
35 | 36 | ||
36 | #ifdef __cplusplus | 37 | #ifdef __cplusplus |
37 | extern "C" { | 38 | extern "C" { |
@@ -77,6 +78,11 @@ typedef struct { | |||
77 | 4*4*4*2 | 78 | 4*4*4*2 |
78 | */ | 79 | */ |
79 | 80 | ||
81 | typedef struct arch_fft_state{ | ||
82 | int is_supported; | ||
83 | void *priv; | ||
84 | } arch_fft_state; | ||
85 | |||
80 | typedef struct kiss_fft_state{ | 86 | typedef struct kiss_fft_state{ |
81 | int nfft; | 87 | int nfft; |
82 | opus_val16 scale; | 88 | opus_val16 scale; |
@@ -87,8 +93,13 @@ typedef struct kiss_fft_state{ | |||
87 | opus_int16 factors[2*MAXFACTORS]; | 93 | opus_int16 factors[2*MAXFACTORS]; |
88 | const opus_int16 *bitrev; | 94 | const opus_int16 *bitrev; |
89 | const kiss_twiddle_cpx *twiddles; | 95 | const kiss_twiddle_cpx *twiddles; |
96 | arch_fft_state *arch_fft; | ||
90 | } kiss_fft_state; | 97 | } kiss_fft_state; |
91 | 98 | ||
99 | #if defined(HAVE_ARM_NE10) | ||
100 | #include "arm/fft_arm.h" | ||
101 | #endif | ||
102 | |||
92 | /*typedef struct kiss_fft_state* kiss_fft_cfg;*/ | 103 | /*typedef struct kiss_fft_state* kiss_fft_cfg;*/ |
93 | 104 | ||
94 | /** | 105 | /** |
@@ -114,9 +125,9 @@ typedef struct kiss_fft_state{ | |||
114 | * buffer size in *lenmem. | 125 | * buffer size in *lenmem. |
115 | * */ | 126 | * */ |
116 | 127 | ||
117 | kiss_fft_state *opus_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem, const kiss_fft_state *base); | 128 | kiss_fft_state *opus_fft_alloc_twiddles(int nfft,void * mem,size_t * lenmem, const kiss_fft_state *base, int arch); |
118 | 129 | ||
119 | kiss_fft_state *opus_fft_alloc(int nfft,void * mem,size_t * lenmem); | 130 | kiss_fft_state *opus_fft_alloc(int nfft,void * mem,size_t * lenmem, int arch); |
120 | 131 | ||
121 | /** | 132 | /** |
122 | * opus_fft(cfg,in_out_buf) | 133 | * opus_fft(cfg,in_out_buf) |
@@ -128,13 +139,59 @@ kiss_fft_state *opus_fft_alloc(int nfft,void * mem,size_t * lenmem); | |||
128 | * Note that each element is complex and can be accessed like | 139 | * Note that each element is complex and can be accessed like |
129 | f[k].r and f[k].i | 140 | f[k].r and f[k].i |
130 | * */ | 141 | * */ |
131 | void opus_fft(const kiss_fft_state *cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); | 142 | void opus_fft_c(const kiss_fft_state *cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); |
132 | void opus_ifft(const kiss_fft_state *cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); | 143 | void opus_ifft_c(const kiss_fft_state *cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); |
133 | 144 | ||
134 | void opus_fft_impl(const kiss_fft_state *st,kiss_fft_cpx *fout); | 145 | void opus_fft_impl(const kiss_fft_state *st,kiss_fft_cpx *fout); |
135 | void opus_ifft_impl(const kiss_fft_state *st,kiss_fft_cpx *fout); | 146 | void opus_ifft_impl(const kiss_fft_state *st,kiss_fft_cpx *fout); |
136 | 147 | ||
137 | void opus_fft_free(const kiss_fft_state *cfg); | 148 | void opus_fft_free(const kiss_fft_state *cfg, int arch); |
149 | |||
150 | |||
151 | void opus_fft_free_arch_c(kiss_fft_state *st); | ||
152 | int opus_fft_alloc_arch_c(kiss_fft_state *st); | ||
153 | |||
154 | #if !defined(OVERRIDE_OPUS_FFT) | ||
155 | /* Is run-time CPU detection enabled on this platform? */ | ||
156 | #if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) | ||
157 | |||
158 | extern int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK+1])( | ||
159 | kiss_fft_state *st); | ||
160 | |||
161 | #define opus_fft_alloc_arch(_st, arch) \ | ||
162 | ((*OPUS_FFT_ALLOC_ARCH_IMPL[(arch)&OPUS_ARCHMASK])(_st)) | ||
163 | |||
164 | extern void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK+1])( | ||
165 | kiss_fft_state *st); | ||
166 | #define opus_fft_free_arch(_st, arch) \ | ||
167 | ((*OPUS_FFT_FREE_ARCH_IMPL[(arch)&OPUS_ARCHMASK])(_st)) | ||
168 | |||
169 | extern void (*const OPUS_FFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, | ||
170 | const kiss_fft_cpx *fin, kiss_fft_cpx *fout); | ||
171 | #define opus_fft(_cfg, _fin, _fout, arch) \ | ||
172 | ((*OPUS_FFT[(arch)&OPUS_ARCHMASK])(_cfg, _fin, _fout)) | ||
173 | |||
174 | extern void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, | ||
175 | const kiss_fft_cpx *fin, kiss_fft_cpx *fout); | ||
176 | #define opus_ifft(_cfg, _fin, _fout, arch) \ | ||
177 | ((*OPUS_IFFT[(arch)&OPUS_ARCHMASK])(_cfg, _fin, _fout)) | ||
178 | |||
179 | #else /* else for if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) */ | ||
180 | |||
181 | #define opus_fft_alloc_arch(_st, arch) \ | ||
182 | ((void)(arch), opus_fft_alloc_arch_c(_st)) | ||
183 | |||
184 | #define opus_fft_free_arch(_st, arch) \ | ||
185 | ((void)(arch), opus_fft_free_arch_c(_st)) | ||
186 | |||
187 | #define opus_fft(_cfg, _fin, _fout, arch) \ | ||
188 | ((void)(arch), opus_fft_c(_cfg, _fin, _fout)) | ||
189 | |||
190 | #define opus_ifft(_cfg, _fin, _fout, arch) \ | ||
191 | ((void)(arch), opus_ifft_c(_cfg, _fin, _fout)) | ||
192 | |||
193 | #endif /* end if defined(OPUS_HAVE_RTCD) && (defined(HAVE_ARM_NE10)) */ | ||
194 | #endif /* end if !defined(OVERRIDE_OPUS_FFT) */ | ||
138 | 195 | ||
139 | #ifdef __cplusplus | 196 | #ifdef __cplusplus |
140 | } | 197 | } |