1 /******************************************************************************
2  *
3  *  Copyright 2022 Google LLC
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #ifndef __LC3_TABLES_H
20 #define __LC3_TABLES_H
21 
22 #include "common.h"
23 #include "bits.h"
24 
25 
26 /**
27  * MDCT Twiddles and window coefficients
28  */
29 
30 struct lc3_fft_bf3_twiddles { int n3; const struct lc3_complex (*t)[2]; };
31 struct lc3_fft_bf2_twiddles { int n2; const struct lc3_complex *t; };
32 struct lc3_mdct_rot_def { int n4; const struct lc3_complex *w; };
33 
34 extern const struct lc3_fft_bf3_twiddles *lc3_fft_twiddles_bf3[];
35 extern const struct lc3_fft_bf2_twiddles *lc3_fft_twiddles_bf2[][3];
36 extern const struct lc3_mdct_rot_def *lc3_mdct_rot[LC3_NUM_DT][LC3_NUM_SRATE];
37 
38 extern const float *lc3_mdct_win[LC3_NUM_DT][LC3_NUM_SRATE];
39 
40 
41 /**
42  * Limits of bands
43  */
44 
45 #define LC3_NUM_BANDS  64
46 
47 extern const int lc3_band_lim[LC3_NUM_DT][LC3_NUM_SRATE][LC3_NUM_BANDS+1];
48 
49 
50 /**
51  * SNS Quantization
52  */
53 
54 extern const float lc3_sns_lfcb[32][8];
55 extern const float lc3_sns_hfcb[32][8];
56 
57 struct lc3_sns_vq_gains {
58     int count; const float *v;
59 };
60 
61 extern const struct lc3_sns_vq_gains lc3_sns_vq_gains[4];
62 
63 extern const int32_t lc3_sns_mpvq_offsets[][11];
64 
65 
66 /**
67  * TNS Arithmetic Coding
68  */
69 
70 extern const struct lc3_ac_model lc3_tns_order_models[];
71 extern const uint16_t lc3_tns_order_bits[][8];
72 
73 extern const struct lc3_ac_model lc3_tns_coeffs_models[];
74 extern const uint16_t lc3_tns_coeffs_bits[][17];
75 
76 
77 /**
78  * Long Term Postfilter
79  */
80 
81 extern const float *lc3_ltpf_cnum[LC3_NUM_SRATE][4];
82 extern const float *lc3_ltpf_cden[LC3_NUM_SRATE][4];
83 
84 
85 /**
86  * Spectral Data Arithmetic Coding
87  */
88 
89 extern const uint8_t lc3_spectrum_lookup[2][2][256][4];
90 extern const struct lc3_ac_model lc3_spectrum_models[];
91 extern const uint16_t lc3_spectrum_bits[][17];
92 
93 
94 #endif /* __LC3_TABLES_H */
95