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 "libavutil/mem_internal.h"
33 
34 #include "sbcdsp_data.h"
35 
36 #define F_PROTO(x) ((int32_t) (((x) * 2) * ((int32_t) 1 << 15) + 0.5))
37 #define F_COS(x) ((int32_t) (((x) ) * ((int32_t) 1 << 15) + 0.5))
38 
39 /*
40  * Constant tables for the use in SIMD optimized analysis filters
41  * Each table consists of two parts:
42  * 1. reordered "proto" table
43  * 2. reordered "cos" table
44  *
45  * Due to non-symmetrical reordering, separate tables for "even"
46  * and "odd" cases are needed
47  */
48 
50 #define C0 1.0932568993
51 #define C1 1.3056875580
52 #define C2 1.3056875580
53 #define C3 1.6772280856
54 
55 #define F(x) F_PROTO(x)
56  F(0.00000000E+00 * C0), F(3.83720193E-03 * C0),
57  F(5.36548976E-04 * C1), F(2.73370904E-03 * C1),
58  F(3.06012286E-03 * C2), F(3.89205149E-03 * C2),
59  F(0.00000000E+00 * C3), -F(1.49188357E-03 * C3),
60  F(1.09137620E-02 * C0), F(2.58767811E-02 * C0),
61  F(2.04385087E-02 * C1), F(3.21939290E-02 * C1),
62  F(7.76463494E-02 * C2), F(6.13245186E-03 * C2),
63  F(0.00000000E+00 * C3), -F(2.88757392E-02 * C3),
64  F(1.35593274E-01 * C0), F(2.94315332E-01 * C0),
65  F(1.94987841E-01 * C1), F(2.81828203E-01 * C1),
66  -F(1.94987841E-01 * C2), F(2.81828203E-01 * C2),
67  F(0.00000000E+00 * C3), -F(2.46636662E-01 * C3),
68  -F(1.35593274E-01 * C0), F(2.58767811E-02 * C0),
69  -F(7.76463494E-02 * C1), F(6.13245186E-03 * C1),
70  -F(2.04385087E-02 * C2), F(3.21939290E-02 * C2),
71  F(0.00000000E+00 * C3), F(2.88217274E-02 * C3),
72  -F(1.09137620E-02 * C0), F(3.83720193E-03 * C0),
73  -F(3.06012286E-03 * C1), F(3.89205149E-03 * C1),
74  -F(5.36548976E-04 * C2), F(2.73370904E-03 * C2),
75  F(0.00000000E+00 * C3), -F(1.86581691E-03 * C3),
76 #undef F
77 #define F(x) F_COS(x)
78  F(0.7071067812 / C0), F(0.9238795325 / C1),
79  -F(0.7071067812 / C0), F(0.3826834324 / C1),
80  -F(0.7071067812 / C0), -F(0.3826834324 / C1),
81  F(0.7071067812 / C0), -F(0.9238795325 / C1),
82  F(0.3826834324 / C2), -F(1.0000000000 / C3),
83  -F(0.9238795325 / C2), -F(1.0000000000 / C3),
84  F(0.9238795325 / C2), -F(1.0000000000 / C3),
85  -F(0.3826834324 / C2), -F(1.0000000000 / C3),
86 #undef F
87 
88 #undef C0
89 #undef C1
90 #undef C2
91 #undef C3
92 };
93 
95 #define C0 1.3056875580
96 #define C1 1.6772280856
97 #define C2 1.0932568993
98 #define C3 1.3056875580
99 
100 #define F(x) F_PROTO(x)
101  F(2.73370904E-03 * C0), F(5.36548976E-04 * C0),
102  -F(1.49188357E-03 * C1), F(0.00000000E+00 * C1),
103  F(3.83720193E-03 * C2), F(1.09137620E-02 * C2),
104  F(3.89205149E-03 * C3), F(3.06012286E-03 * C3),
105  F(3.21939290E-02 * C0), F(2.04385087E-02 * C0),
106  -F(2.88757392E-02 * C1), F(0.00000000E+00 * C1),
107  F(2.58767811E-02 * C2), F(1.35593274E-01 * C2),
108  F(6.13245186E-03 * C3), F(7.76463494E-02 * C3),
109  F(2.81828203E-01 * C0), F(1.94987841E-01 * C0),
110  -F(2.46636662E-01 * C1), F(0.00000000E+00 * C1),
111  F(2.94315332E-01 * C2), -F(1.35593274E-01 * C2),
112  F(2.81828203E-01 * C3), -F(1.94987841E-01 * C3),
113  F(6.13245186E-03 * C0), -F(7.76463494E-02 * C0),
114  F(2.88217274E-02 * C1), F(0.00000000E+00 * C1),
115  F(2.58767811E-02 * C2), -F(1.09137620E-02 * C2),
116  F(3.21939290E-02 * C3), -F(2.04385087E-02 * C3),
117  F(3.89205149E-03 * C0), -F(3.06012286E-03 * C0),
118  -F(1.86581691E-03 * C1), F(0.00000000E+00 * C1),
119  F(3.83720193E-03 * C2), F(0.00000000E+00 * C2),
120  F(2.73370904E-03 * C3), -F(5.36548976E-04 * C3),
121 #undef F
122 #define F(x) F_COS(x)
123  F(0.9238795325 / C0), -F(1.0000000000 / C1),
124  F(0.3826834324 / C0), -F(1.0000000000 / C1),
125  -F(0.3826834324 / C0), -F(1.0000000000 / C1),
126  -F(0.9238795325 / C0), -F(1.0000000000 / C1),
127  F(0.7071067812 / C2), F(0.3826834324 / C3),
128  -F(0.7071067812 / C2), -F(0.9238795325 / C3),
129  -F(0.7071067812 / C2), F(0.9238795325 / C3),
130  F(0.7071067812 / C2), -F(0.3826834324 / C3),
131 #undef F
132 
133 #undef C0
134 #undef C1
135 #undef C2
136 #undef C3
137 };
138 
140 #define C0 2.7906148894
141 #define C1 2.4270044280
142 #define C2 2.8015616024
143 #define C3 3.1710363741
144 #define C4 2.5377944043
145 #define C5 2.4270044280
146 #define C6 2.8015616024
147 #define C7 3.1710363741
148 
149 #define F(x) F_PROTO(x)
150  F(0.00000000E+00 * C0), F(2.01182542E-03 * C0),
151  F(1.56575398E-04 * C1), F(1.78371725E-03 * C1),
152  F(3.43256425E-04 * C2), F(1.47640169E-03 * C2),
153  F(5.54620202E-04 * C3), F(1.13992507E-03 * C3),
154  -F(8.23919506E-04 * C4), F(0.00000000E+00 * C4),
155  F(2.10371989E-03 * C5), F(3.49717454E-03 * C5),
156  F(1.99454554E-03 * C6), F(1.64973098E-03 * C6),
157  F(1.61656283E-03 * C7), F(1.78805361E-04 * C7),
158  F(5.65949473E-03 * C0), F(1.29371806E-02 * C0),
159  F(8.02941163E-03 * C1), F(1.53184106E-02 * C1),
160  F(1.04584443E-02 * C2), F(1.62208471E-02 * C2),
161  F(1.27472335E-02 * C3), F(1.59045603E-02 * C3),
162  -F(1.46525263E-02 * C4), F(0.00000000E+00 * C4),
163  F(8.85757540E-03 * C5), F(5.31873032E-02 * C5),
164  F(2.92408442E-03 * C6), F(3.90751381E-02 * C6),
165  -F(4.91578024E-03 * C7), F(2.61098752E-02 * C7),
166  F(6.79989431E-02 * C0), F(1.46955068E-01 * C0),
167  F(8.29847578E-02 * C1), F(1.45389847E-01 * C1),
168  F(9.75753918E-02 * C2), F(1.40753505E-01 * C2),
169  F(1.11196689E-01 * C3), F(1.33264415E-01 * C3),
170  -F(1.23264548E-01 * C4), F(0.00000000E+00 * C4),
171  F(1.45389847E-01 * C5), -F(8.29847578E-02 * C5),
172  F(1.40753505E-01 * C6), -F(9.75753918E-02 * C6),
173  F(1.33264415E-01 * C7), -F(1.11196689E-01 * C7),
174  -F(6.79989431E-02 * C0), F(1.29371806E-02 * C0),
175  -F(5.31873032E-02 * C1), F(8.85757540E-03 * C1),
176  -F(3.90751381E-02 * C2), F(2.92408442E-03 * C2),
177  -F(2.61098752E-02 * C3), -F(4.91578024E-03 * C3),
178  F(1.46404076E-02 * C4), F(0.00000000E+00 * C4),
179  F(1.53184106E-02 * C5), -F(8.02941163E-03 * C5),
180  F(1.62208471E-02 * C6), -F(1.04584443E-02 * C6),
181  F(1.59045603E-02 * C7), -F(1.27472335E-02 * C7),
182  -F(5.65949473E-03 * C0), F(2.01182542E-03 * C0),
183  -F(3.49717454E-03 * C1), F(2.10371989E-03 * C1),
184  -F(1.64973098E-03 * C2), F(1.99454554E-03 * C2),
185  -F(1.78805361E-04 * C3), F(1.61656283E-03 * C3),
186  -F(9.02154502E-04 * C4), F(0.00000000E+00 * C4),
187  F(1.78371725E-03 * C5), -F(1.56575398E-04 * C5),
188  F(1.47640169E-03 * C6), -F(3.43256425E-04 * C6),
189  F(1.13992507E-03 * C7), -F(5.54620202E-04 * C7),
190 #undef F
191 #define F(x) F_COS(x)
192  F(0.7071067812 / C0), F(0.8314696123 / C1),
193  -F(0.7071067812 / C0), -F(0.1950903220 / C1),
194  -F(0.7071067812 / C0), -F(0.9807852804 / C1),
195  F(0.7071067812 / C0), -F(0.5555702330 / C1),
196  F(0.7071067812 / C0), F(0.5555702330 / C1),
197  -F(0.7071067812 / C0), F(0.9807852804 / C1),
198  -F(0.7071067812 / C0), F(0.1950903220 / C1),
199  F(0.7071067812 / C0), -F(0.8314696123 / C1),
200  F(0.9238795325 / C2), F(0.9807852804 / C3),
201  F(0.3826834324 / C2), F(0.8314696123 / C3),
202  -F(0.3826834324 / C2), F(0.5555702330 / C3),
203  -F(0.9238795325 / C2), F(0.1950903220 / C3),
204  -F(0.9238795325 / C2), -F(0.1950903220 / C3),
205  -F(0.3826834324 / C2), -F(0.5555702330 / C3),
206  F(0.3826834324 / C2), -F(0.8314696123 / C3),
207  F(0.9238795325 / C2), -F(0.9807852804 / C3),
208  -F(1.0000000000 / C4), F(0.5555702330 / C5),
209  -F(1.0000000000 / C4), -F(0.9807852804 / C5),
210  -F(1.0000000000 / C4), F(0.1950903220 / C5),
211  -F(1.0000000000 / C4), F(0.8314696123 / C5),
212  -F(1.0000000000 / C4), -F(0.8314696123 / C5),
213  -F(1.0000000000 / C4), -F(0.1950903220 / C5),
214  -F(1.0000000000 / C4), F(0.9807852804 / C5),
215  -F(1.0000000000 / C4), -F(0.5555702330 / C5),
216  F(0.3826834324 / C6), F(0.1950903220 / C7),
217  -F(0.9238795325 / C6), -F(0.5555702330 / C7),
218  F(0.9238795325 / C6), F(0.8314696123 / C7),
219  -F(0.3826834324 / C6), -F(0.9807852804 / C7),
220  -F(0.3826834324 / C6), F(0.9807852804 / C7),
221  F(0.9238795325 / C6), -F(0.8314696123 / C7),
222  -F(0.9238795325 / C6), F(0.5555702330 / C7),
223  F(0.3826834324 / C6), -F(0.1950903220 / C7),
224 #undef F
225 
226 #undef C0
227 #undef C1
228 #undef C2
229 #undef C3
230 #undef C4
231 #undef C5
232 #undef C6
233 #undef C7
234 };
235 
237 #define C0 2.5377944043
238 #define C1 2.4270044280
239 #define C2 2.8015616024
240 #define C3 3.1710363741
241 #define C4 2.7906148894
242 #define C5 2.4270044280
243 #define C6 2.8015616024
244 #define C7 3.1710363741
245 
246 #define F(x) F_PROTO(x)
247  F(0.00000000E+00 * C0), -F(8.23919506E-04 * C0),
248  F(1.56575398E-04 * C1), F(1.78371725E-03 * C1),
249  F(3.43256425E-04 * C2), F(1.47640169E-03 * C2),
250  F(5.54620202E-04 * C3), F(1.13992507E-03 * C3),
251  F(2.01182542E-03 * C4), F(5.65949473E-03 * C4),
252  F(2.10371989E-03 * C5), F(3.49717454E-03 * C5),
253  F(1.99454554E-03 * C6), F(1.64973098E-03 * C6),
254  F(1.61656283E-03 * C7), F(1.78805361E-04 * C7),
255  F(0.00000000E+00 * C0), -F(1.46525263E-02 * C0),
256  F(8.02941163E-03 * C1), F(1.53184106E-02 * C1),
257  F(1.04584443E-02 * C2), F(1.62208471E-02 * C2),
258  F(1.27472335E-02 * C3), F(1.59045603E-02 * C3),
259  F(1.29371806E-02 * C4), F(6.79989431E-02 * C4),
260  F(8.85757540E-03 * C5), F(5.31873032E-02 * C5),
261  F(2.92408442E-03 * C6), F(3.90751381E-02 * C6),
262  -F(4.91578024E-03 * C7), F(2.61098752E-02 * C7),
263  F(0.00000000E+00 * C0), -F(1.23264548E-01 * C0),
264  F(8.29847578E-02 * C1), F(1.45389847E-01 * C1),
265  F(9.75753918E-02 * C2), F(1.40753505E-01 * C2),
266  F(1.11196689E-01 * C3), F(1.33264415E-01 * C3),
267  F(1.46955068E-01 * C4), -F(6.79989431E-02 * C4),
268  F(1.45389847E-01 * C5), -F(8.29847578E-02 * C5),
269  F(1.40753505E-01 * C6), -F(9.75753918E-02 * C6),
270  F(1.33264415E-01 * C7), -F(1.11196689E-01 * C7),
271  F(0.00000000E+00 * C0), F(1.46404076E-02 * C0),
272  -F(5.31873032E-02 * C1), F(8.85757540E-03 * C1),
273  -F(3.90751381E-02 * C2), F(2.92408442E-03 * C2),
274  -F(2.61098752E-02 * C3), -F(4.91578024E-03 * C3),
275  F(1.29371806E-02 * C4), -F(5.65949473E-03 * C4),
276  F(1.53184106E-02 * C5), -F(8.02941163E-03 * C5),
277  F(1.62208471E-02 * C6), -F(1.04584443E-02 * C6),
278  F(1.59045603E-02 * C7), -F(1.27472335E-02 * C7),
279  F(0.00000000E+00 * C0), -F(9.02154502E-04 * C0),
280  -F(3.49717454E-03 * C1), F(2.10371989E-03 * C1),
281  -F(1.64973098E-03 * C2), F(1.99454554E-03 * C2),
282  -F(1.78805361E-04 * C3), F(1.61656283E-03 * C3),
283  F(2.01182542E-03 * C4), F(0.00000000E+00 * C4),
284  F(1.78371725E-03 * C5), -F(1.56575398E-04 * C5),
285  F(1.47640169E-03 * C6), -F(3.43256425E-04 * C6),
286  F(1.13992507E-03 * C7), -F(5.54620202E-04 * C7),
287 #undef F
288 #define F(x) F_COS(x)
289  -F(1.0000000000 / C0), F(0.8314696123 / C1),
290  -F(1.0000000000 / C0), -F(0.1950903220 / C1),
291  -F(1.0000000000 / C0), -F(0.9807852804 / C1),
292  -F(1.0000000000 / C0), -F(0.5555702330 / C1),
293  -F(1.0000000000 / C0), F(0.5555702330 / C1),
294  -F(1.0000000000 / C0), F(0.9807852804 / C1),
295  -F(1.0000000000 / C0), F(0.1950903220 / C1),
296  -F(1.0000000000 / C0), -F(0.8314696123 / C1),
297  F(0.9238795325 / C2), F(0.9807852804 / C3),
298  F(0.3826834324 / C2), F(0.8314696123 / C3),
299  -F(0.3826834324 / C2), F(0.5555702330 / C3),
300  -F(0.9238795325 / C2), F(0.1950903220 / C3),
301  -F(0.9238795325 / C2), -F(0.1950903220 / C3),
302  -F(0.3826834324 / C2), -F(0.5555702330 / C3),
303  F(0.3826834324 / C2), -F(0.8314696123 / C3),
304  F(0.9238795325 / C2), -F(0.9807852804 / C3),
305  F(0.7071067812 / C4), F(0.5555702330 / C5),
306  -F(0.7071067812 / C4), -F(0.9807852804 / C5),
307  -F(0.7071067812 / C4), F(0.1950903220 / C5),
308  F(0.7071067812 / C4), F(0.8314696123 / C5),
309  F(0.7071067812 / C4), -F(0.8314696123 / C5),
310  -F(0.7071067812 / C4), -F(0.1950903220 / C5),
311  -F(0.7071067812 / C4), F(0.9807852804 / C5),
312  F(0.7071067812 / C4), -F(0.5555702330 / C5),
313  F(0.3826834324 / C6), F(0.1950903220 / C7),
314  -F(0.9238795325 / C6), -F(0.5555702330 / C7),
315  F(0.9238795325 / C6), F(0.8314696123 / C7),
316  -F(0.3826834324 / C6), -F(0.9807852804 / C7),
317  -F(0.3826834324 / C6), F(0.9807852804 / C7),
318  F(0.9238795325 / C6), -F(0.8314696123 / C7),
319  -F(0.9238795325 / C6), F(0.5555702330 / C7),
320  F(0.3826834324 / C6), -F(0.1950903220 / C7),
321 #undef F
322 
323 #undef C0
324 #undef C1
325 #undef C2
326 #undef C3
327 #undef C4
328 #undef C5
329 #undef C6
330 #undef C7
331 };
mem_internal.h
ff_sbcdsp_analysis_consts_fixed8_simd_even
const int16_t ff_sbcdsp_analysis_consts_fixed8_simd_even[80+64]
Definition: sbcdsp_data.c:139
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:94
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:49
C1
#define C1
E
#define E
Definition: avdct.c:32
sbcdsp_data.h
SBC_ALIGN
#define SBC_ALIGN
Definition: sbc.h:80
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem.h:116
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:236
C7
#define C7
C3
#define C3
C6
#define C6
C4
#define C4