FFmpeg
sbcdsp_data.c
Go to the documentation of this file.
1 /*
2  * Bluetooth low-complexity, subband codec (SBC)
3  *
4  * Copyright (C) 2017 Aurelien Jacobs <aurel@gnuage.org>
5  * Copyright (C) 2008-2010 Nokia Corporation
6  * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
7  * Copyright (C) 2004-2005 Henryk Ploetz <henryk@ploetzli.ch>
8  * Copyright (C) 2005-2006 Brad Midgley <bmidgley@xmission.com>
9  *
10  * This file is part of FFmpeg.
11  *
12  * FFmpeg is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * FFmpeg is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with FFmpeg; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 
27 /**
28  * @file
29  * miscellaneous SBC tables
30  */
31 
32 #include "sbcdsp_data.h"
33 
34 #define F_PROTO(x) ((int32_t) (((x) * 2) * ((int32_t) 1 << 15) + 0.5))
35 #define F_COS(x) ((int32_t) (((x) ) * ((int32_t) 1 << 15) + 0.5))
36 
37 /*
38  * Constant tables for the use in SIMD optimized analysis filters
39  * Each table consists of two parts:
40  * 1. reordered "proto" table
41  * 2. reordered "cos" table
42  *
43  * Due to non-symmetrical reordering, separate tables for "even"
44  * and "odd" cases are needed
45  */
46 
48 #define C0 1.0932568993
49 #define C1 1.3056875580
50 #define C2 1.3056875580
51 #define C3 1.6772280856
52 
53 #define F(x) F_PROTO(x)
54  F(0.00000000E+00 * C0), F(3.83720193E-03 * C0),
55  F(5.36548976E-04 * C1), F(2.73370904E-03 * C1),
56  F(3.06012286E-03 * C2), F(3.89205149E-03 * C2),
57  F(0.00000000E+00 * C3), -F(1.49188357E-03 * C3),
58  F(1.09137620E-02 * C0), F(2.58767811E-02 * C0),
59  F(2.04385087E-02 * C1), F(3.21939290E-02 * C1),
60  F(7.76463494E-02 * C2), F(6.13245186E-03 * C2),
61  F(0.00000000E+00 * C3), -F(2.88757392E-02 * C3),
62  F(1.35593274E-01 * C0), F(2.94315332E-01 * C0),
63  F(1.94987841E-01 * C1), F(2.81828203E-01 * C1),
64  -F(1.94987841E-01 * C2), F(2.81828203E-01 * C2),
65  F(0.00000000E+00 * C3), -F(2.46636662E-01 * C3),
66  -F(1.35593274E-01 * C0), F(2.58767811E-02 * C0),
67  -F(7.76463494E-02 * C1), F(6.13245186E-03 * C1),
68  -F(2.04385087E-02 * C2), F(3.21939290E-02 * C2),
69  F(0.00000000E+00 * C3), F(2.88217274E-02 * C3),
70  -F(1.09137620E-02 * C0), F(3.83720193E-03 * C0),
71  -F(3.06012286E-03 * C1), F(3.89205149E-03 * C1),
72  -F(5.36548976E-04 * C2), F(2.73370904E-03 * C2),
73  F(0.00000000E+00 * C3), -F(1.86581691E-03 * C3),
74 #undef F
75 #define F(x) F_COS(x)
76  F(0.7071067812 / C0), F(0.9238795325 / C1),
77  -F(0.7071067812 / C0), F(0.3826834324 / C1),
78  -F(0.7071067812 / C0), -F(0.3826834324 / C1),
79  F(0.7071067812 / C0), -F(0.9238795325 / C1),
80  F(0.3826834324 / C2), -F(1.0000000000 / C3),
81  -F(0.9238795325 / C2), -F(1.0000000000 / C3),
82  F(0.9238795325 / C2), -F(1.0000000000 / C3),
83  -F(0.3826834324 / C2), -F(1.0000000000 / C3),
84 #undef F
85 
86 #undef C0
87 #undef C1
88 #undef C2
89 #undef C3
90 };
91 
93 #define C0 1.3056875580
94 #define C1 1.6772280856
95 #define C2 1.0932568993
96 #define C3 1.3056875580
97 
98 #define F(x) F_PROTO(x)
99  F(2.73370904E-03 * C0), F(5.36548976E-04 * C0),
100  -F(1.49188357E-03 * C1), F(0.00000000E+00 * C1),
101  F(3.83720193E-03 * C2), F(1.09137620E-02 * C2),
102  F(3.89205149E-03 * C3), F(3.06012286E-03 * C3),
103  F(3.21939290E-02 * C0), F(2.04385087E-02 * C0),
104  -F(2.88757392E-02 * C1), F(0.00000000E+00 * C1),
105  F(2.58767811E-02 * C2), F(1.35593274E-01 * C2),
106  F(6.13245186E-03 * C3), F(7.76463494E-02 * C3),
107  F(2.81828203E-01 * C0), F(1.94987841E-01 * C0),
108  -F(2.46636662E-01 * C1), F(0.00000000E+00 * C1),
109  F(2.94315332E-01 * C2), -F(1.35593274E-01 * C2),
110  F(2.81828203E-01 * C3), -F(1.94987841E-01 * C3),
111  F(6.13245186E-03 * C0), -F(7.76463494E-02 * C0),
112  F(2.88217274E-02 * C1), F(0.00000000E+00 * C1),
113  F(2.58767811E-02 * C2), -F(1.09137620E-02 * C2),
114  F(3.21939290E-02 * C3), -F(2.04385087E-02 * C3),
115  F(3.89205149E-03 * C0), -F(3.06012286E-03 * C0),
116  -F(1.86581691E-03 * C1), F(0.00000000E+00 * C1),
117  F(3.83720193E-03 * C2), F(0.00000000E+00 * C2),
118  F(2.73370904E-03 * C3), -F(5.36548976E-04 * C3),
119 #undef F
120 #define F(x) F_COS(x)
121  F(0.9238795325 / C0), -F(1.0000000000 / C1),
122  F(0.3826834324 / C0), -F(1.0000000000 / C1),
123  -F(0.3826834324 / C0), -F(1.0000000000 / C1),
124  -F(0.9238795325 / C0), -F(1.0000000000 / C1),
125  F(0.7071067812 / C2), F(0.3826834324 / C3),
126  -F(0.7071067812 / C2), -F(0.9238795325 / C3),
127  -F(0.7071067812 / C2), F(0.9238795325 / C3),
128  F(0.7071067812 / C2), -F(0.3826834324 / C3),
129 #undef F
130 
131 #undef C0
132 #undef C1
133 #undef C2
134 #undef C3
135 };
136 
138 #define C0 2.7906148894
139 #define C1 2.4270044280
140 #define C2 2.8015616024
141 #define C3 3.1710363741
142 #define C4 2.5377944043
143 #define C5 2.4270044280
144 #define C6 2.8015616024
145 #define C7 3.1710363741
146 
147 #define F(x) F_PROTO(x)
148  F(0.00000000E+00 * C0), F(2.01182542E-03 * C0),
149  F(1.56575398E-04 * C1), F(1.78371725E-03 * C1),
150  F(3.43256425E-04 * C2), F(1.47640169E-03 * C2),
151  F(5.54620202E-04 * C3), F(1.13992507E-03 * C3),
152  -F(8.23919506E-04 * C4), F(0.00000000E+00 * C4),
153  F(2.10371989E-03 * C5), F(3.49717454E-03 * C5),
154  F(1.99454554E-03 * C6), F(1.64973098E-03 * C6),
155  F(1.61656283E-03 * C7), F(1.78805361E-04 * C7),
156  F(5.65949473E-03 * C0), F(1.29371806E-02 * C0),
157  F(8.02941163E-03 * C1), F(1.53184106E-02 * C1),
158  F(1.04584443E-02 * C2), F(1.62208471E-02 * C2),
159  F(1.27472335E-02 * C3), F(1.59045603E-02 * C3),
160  -F(1.46525263E-02 * C4), F(0.00000000E+00 * C4),
161  F(8.85757540E-03 * C5), F(5.31873032E-02 * C5),
162  F(2.92408442E-03 * C6), F(3.90751381E-02 * C6),
163  -F(4.91578024E-03 * C7), F(2.61098752E-02 * C7),
164  F(6.79989431E-02 * C0), F(1.46955068E-01 * C0),
165  F(8.29847578E-02 * C1), F(1.45389847E-01 * C1),
166  F(9.75753918E-02 * C2), F(1.40753505E-01 * C2),
167  F(1.11196689E-01 * C3), F(1.33264415E-01 * C3),
168  -F(1.23264548E-01 * C4), F(0.00000000E+00 * C4),
169  F(1.45389847E-01 * C5), -F(8.29847578E-02 * C5),
170  F(1.40753505E-01 * C6), -F(9.75753918E-02 * C6),
171  F(1.33264415E-01 * C7), -F(1.11196689E-01 * C7),
172  -F(6.79989431E-02 * C0), F(1.29371806E-02 * C0),
173  -F(5.31873032E-02 * C1), F(8.85757540E-03 * C1),
174  -F(3.90751381E-02 * C2), F(2.92408442E-03 * C2),
175  -F(2.61098752E-02 * C3), -F(4.91578024E-03 * C3),
176  F(1.46404076E-02 * C4), F(0.00000000E+00 * C4),
177  F(1.53184106E-02 * C5), -F(8.02941163E-03 * C5),
178  F(1.62208471E-02 * C6), -F(1.04584443E-02 * C6),
179  F(1.59045603E-02 * C7), -F(1.27472335E-02 * C7),
180  -F(5.65949473E-03 * C0), F(2.01182542E-03 * C0),
181  -F(3.49717454E-03 * C1), F(2.10371989E-03 * C1),
182  -F(1.64973098E-03 * C2), F(1.99454554E-03 * C2),
183  -F(1.78805361E-04 * C3), F(1.61656283E-03 * C3),
184  -F(9.02154502E-04 * C4), F(0.00000000E+00 * C4),
185  F(1.78371725E-03 * C5), -F(1.56575398E-04 * C5),
186  F(1.47640169E-03 * C6), -F(3.43256425E-04 * C6),
187  F(1.13992507E-03 * C7), -F(5.54620202E-04 * C7),
188 #undef F
189 #define F(x) F_COS(x)
190  F(0.7071067812 / C0), F(0.8314696123 / C1),
191  -F(0.7071067812 / C0), -F(0.1950903220 / C1),
192  -F(0.7071067812 / C0), -F(0.9807852804 / C1),
193  F(0.7071067812 / C0), -F(0.5555702330 / C1),
194  F(0.7071067812 / C0), F(0.5555702330 / C1),
195  -F(0.7071067812 / C0), F(0.9807852804 / C1),
196  -F(0.7071067812 / C0), F(0.1950903220 / C1),
197  F(0.7071067812 / C0), -F(0.8314696123 / C1),
198  F(0.9238795325 / C2), F(0.9807852804 / C3),
199  F(0.3826834324 / C2), F(0.8314696123 / C3),
200  -F(0.3826834324 / C2), F(0.5555702330 / C3),
201  -F(0.9238795325 / C2), F(0.1950903220 / C3),
202  -F(0.9238795325 / C2), -F(0.1950903220 / C3),
203  -F(0.3826834324 / C2), -F(0.5555702330 / C3),
204  F(0.3826834324 / C2), -F(0.8314696123 / C3),
205  F(0.9238795325 / C2), -F(0.9807852804 / C3),
206  -F(1.0000000000 / C4), F(0.5555702330 / C5),
207  -F(1.0000000000 / C4), -F(0.9807852804 / C5),
208  -F(1.0000000000 / C4), F(0.1950903220 / C5),
209  -F(1.0000000000 / C4), F(0.8314696123 / C5),
210  -F(1.0000000000 / C4), -F(0.8314696123 / C5),
211  -F(1.0000000000 / C4), -F(0.1950903220 / C5),
212  -F(1.0000000000 / C4), F(0.9807852804 / C5),
213  -F(1.0000000000 / C4), -F(0.5555702330 / C5),
214  F(0.3826834324 / C6), F(0.1950903220 / C7),
215  -F(0.9238795325 / C6), -F(0.5555702330 / C7),
216  F(0.9238795325 / C6), F(0.8314696123 / C7),
217  -F(0.3826834324 / C6), -F(0.9807852804 / C7),
218  -F(0.3826834324 / C6), F(0.9807852804 / C7),
219  F(0.9238795325 / C6), -F(0.8314696123 / C7),
220  -F(0.9238795325 / C6), F(0.5555702330 / C7),
221  F(0.3826834324 / C6), -F(0.1950903220 / C7),
222 #undef F
223 
224 #undef C0
225 #undef C1
226 #undef C2
227 #undef C3
228 #undef C4
229 #undef C5
230 #undef C6
231 #undef C7
232 };
233 
235 #define C0 2.5377944043
236 #define C1 2.4270044280
237 #define C2 2.8015616024
238 #define C3 3.1710363741
239 #define C4 2.7906148894
240 #define C5 2.4270044280
241 #define C6 2.8015616024
242 #define C7 3.1710363741
243 
244 #define F(x) F_PROTO(x)
245  F(0.00000000E+00 * C0), -F(8.23919506E-04 * C0),
246  F(1.56575398E-04 * C1), F(1.78371725E-03 * C1),
247  F(3.43256425E-04 * C2), F(1.47640169E-03 * C2),
248  F(5.54620202E-04 * C3), F(1.13992507E-03 * C3),
249  F(2.01182542E-03 * C4), F(5.65949473E-03 * C4),
250  F(2.10371989E-03 * C5), F(3.49717454E-03 * C5),
251  F(1.99454554E-03 * C6), F(1.64973098E-03 * C6),
252  F(1.61656283E-03 * C7), F(1.78805361E-04 * C7),
253  F(0.00000000E+00 * C0), -F(1.46525263E-02 * C0),
254  F(8.02941163E-03 * C1), F(1.53184106E-02 * C1),
255  F(1.04584443E-02 * C2), F(1.62208471E-02 * C2),
256  F(1.27472335E-02 * C3), F(1.59045603E-02 * C3),
257  F(1.29371806E-02 * C4), F(6.79989431E-02 * C4),
258  F(8.85757540E-03 * C5), F(5.31873032E-02 * C5),
259  F(2.92408442E-03 * C6), F(3.90751381E-02 * C6),
260  -F(4.91578024E-03 * C7), F(2.61098752E-02 * C7),
261  F(0.00000000E+00 * C0), -F(1.23264548E-01 * C0),
262  F(8.29847578E-02 * C1), F(1.45389847E-01 * C1),
263  F(9.75753918E-02 * C2), F(1.40753505E-01 * C2),
264  F(1.11196689E-01 * C3), F(1.33264415E-01 * C3),
265  F(1.46955068E-01 * C4), -F(6.79989431E-02 * C4),
266  F(1.45389847E-01 * C5), -F(8.29847578E-02 * C5),
267  F(1.40753505E-01 * C6), -F(9.75753918E-02 * C6),
268  F(1.33264415E-01 * C7), -F(1.11196689E-01 * C7),
269  F(0.00000000E+00 * C0), F(1.46404076E-02 * C0),
270  -F(5.31873032E-02 * C1), F(8.85757540E-03 * C1),
271  -F(3.90751381E-02 * C2), F(2.92408442E-03 * C2),
272  -F(2.61098752E-02 * C3), -F(4.91578024E-03 * C3),
273  F(1.29371806E-02 * C4), -F(5.65949473E-03 * C4),
274  F(1.53184106E-02 * C5), -F(8.02941163E-03 * C5),
275  F(1.62208471E-02 * C6), -F(1.04584443E-02 * C6),
276  F(1.59045603E-02 * C7), -F(1.27472335E-02 * C7),
277  F(0.00000000E+00 * C0), -F(9.02154502E-04 * C0),
278  -F(3.49717454E-03 * C1), F(2.10371989E-03 * C1),
279  -F(1.64973098E-03 * C2), F(1.99454554E-03 * C2),
280  -F(1.78805361E-04 * C3), F(1.61656283E-03 * C3),
281  F(2.01182542E-03 * C4), F(0.00000000E+00 * C4),
282  F(1.78371725E-03 * C5), -F(1.56575398E-04 * C5),
283  F(1.47640169E-03 * C6), -F(3.43256425E-04 * C6),
284  F(1.13992507E-03 * C7), -F(5.54620202E-04 * C7),
285 #undef F
286 #define F(x) F_COS(x)
287  -F(1.0000000000 / C0), F(0.8314696123 / C1),
288  -F(1.0000000000 / C0), -F(0.1950903220 / C1),
289  -F(1.0000000000 / C0), -F(0.9807852804 / C1),
290  -F(1.0000000000 / C0), -F(0.5555702330 / C1),
291  -F(1.0000000000 / C0), F(0.5555702330 / C1),
292  -F(1.0000000000 / C0), F(0.9807852804 / C1),
293  -F(1.0000000000 / C0), F(0.1950903220 / C1),
294  -F(1.0000000000 / C0), -F(0.8314696123 / C1),
295  F(0.9238795325 / C2), F(0.9807852804 / C3),
296  F(0.3826834324 / C2), F(0.8314696123 / C3),
297  -F(0.3826834324 / C2), F(0.5555702330 / C3),
298  -F(0.9238795325 / C2), F(0.1950903220 / C3),
299  -F(0.9238795325 / C2), -F(0.1950903220 / C3),
300  -F(0.3826834324 / C2), -F(0.5555702330 / C3),
301  F(0.3826834324 / C2), -F(0.8314696123 / C3),
302  F(0.9238795325 / C2), -F(0.9807852804 / C3),
303  F(0.7071067812 / C4), F(0.5555702330 / C5),
304  -F(0.7071067812 / C4), -F(0.9807852804 / C5),
305  -F(0.7071067812 / C4), F(0.1950903220 / C5),
306  F(0.7071067812 / C4), F(0.8314696123 / C5),
307  F(0.7071067812 / C4), -F(0.8314696123 / C5),
308  -F(0.7071067812 / C4), -F(0.1950903220 / C5),
309  -F(0.7071067812 / C4), F(0.9807852804 / C5),
310  F(0.7071067812 / C4), -F(0.5555702330 / C5),
311  F(0.3826834324 / C6), F(0.1950903220 / C7),
312  -F(0.9238795325 / C6), -F(0.5555702330 / C7),
313  F(0.9238795325 / C6), F(0.8314696123 / C7),
314  -F(0.3826834324 / C6), -F(0.9807852804 / C7),
315  -F(0.3826834324 / C6), F(0.9807852804 / C7),
316  F(0.9238795325 / C6), -F(0.8314696123 / C7),
317  -F(0.9238795325 / C6), F(0.5555702330 / C7),
318  F(0.3826834324 / C6), -F(0.1950903220 / C7),
319 #undef F
320 
321 #undef C0
322 #undef C1
323 #undef C2
324 #undef C3
325 #undef C4
326 #undef C5
327 #undef C6
328 #undef C7
329 };
ff_sbcdsp_analysis_consts_fixed8_simd_even
const int16_t ff_sbcdsp_analysis_consts_fixed8_simd_even[80+64]
Definition: sbcdsp_data.c:137
C0
#define C0
ff_sbcdsp_analysis_consts_fixed4_simd_odd
const int16_t ff_sbcdsp_analysis_consts_fixed4_simd_odd[40+16]
Definition: sbcdsp_data.c:92
F
#define F(x)
ff_sbcdsp_analysis_consts_fixed4_simd_even
const int16_t ff_sbcdsp_analysis_consts_fixed4_simd_even[40+16]
Definition: sbcdsp_data.c:47
C1
#define C1
E
#define E
Definition: avdct.c:32
sbcdsp_data.h
SBC_ALIGN
#define SBC_ALIGN
Definition: sbc.h:78
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:112
C5
#define C5
C2
#define C2
ff_sbcdsp_analysis_consts_fixed8_simd_odd
const int16_t ff_sbcdsp_analysis_consts_fixed8_simd_odd[80+64]
Definition: sbcdsp_data.c:234
C7
#define C7
C3
#define C3
C6
#define C6
C4
#define C4