• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *                                                                            *
3  * Copyright (C) 2018 The Android Open Source Project
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  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #ifndef IXHEAACD_SBR_ROM_H
21 #define IXHEAACD_SBR_ROM_H
22 
23 #define INV_INT_TABLE_SIZE 49
24 #define SBR_NF_NO_RANDOM_VAL 512
25 #define NUM_SER_AP_LINKS 3
26 #define SUBQMF_GROUPS (10)
27 #define QMF_GROUPS (12)
28 #define NO_IID_GROUPS (SUBQMF_GROUPS + QMF_GROUPS)
29 #define NUM_IID_LEVELS (7)
30 #define NUM_IID_LEVELS_FINE (15)
31 #define NUM_ICC_LEVELS (8)
32 #define NO_IID_LEVELS (2 * NUM_IID_LEVELS + 1)
33 #define NO_IID_LEVELS_FINE (2 * NUM_IID_LEVELS_FINE + 1)
34 #define NO_ICC_LEVELS (NUM_ICC_LEVELS)
35 
36 #define IPD_QMF_GROUPS (3)
37 
38 #define SUBQMF_GROUPS_HI_RES (32)
39 #define QMF_GROUPS_HI_RES (18)
40 #define IPD_QMF_GROUPS_HI_RES (1)
41 
42 #define NUM_IID_GROUPS (SUBQMF_GROUPS + QMF_GROUPS)
43 #define NUM_IPD_GROUPS (SUBQMF_GROUPS + IPD_QMF_GROUPS)
44 
45 #define NUM_IID_GROUPS_HI_RES (SUBQMF_GROUPS_HI_RES + QMF_GROUPS_HI_RES)
46 #define NUM_IPD_GROUPS_HI_RES (SUBQMF_GROUPS_HI_RES + IPD_QMF_GROUPS_HI_RES)
47 
48 #define NUM_SUB_QMF_CHANNELS 12
49 #define NUM_SUB_QMF_CHANNELS_HI_RES 32
50 
51 #define NUM_QUAD_MIRROR_FILTER_CHNLS 64
52 
53 #define NUM_IID_STEPS (7)
54 #define NUM_IID_STEPS_FINE (15)
55 #define NUM_ICC_STEPS (8)
56 #define HYBRID_FILTER_LENGTH 13
57 
58 typedef struct {
59   WORD16 sbr_lim_gains_m[8];
60 
61   WORD16 sbr_lim_bands_per_octave_q13[4];
62   WORD16 sbr_smooth_filter[4];
63   WORD16 sbr_inv_int_table[INV_INT_TABLE_SIZE];
64 
65   WORD32 sbr_rand_ph[SBR_NF_NO_RANDOM_VAL + MAX_FREQ_COEFFS];
66 
67 } ia_env_calc_tables_struct;
68 
69 extern const ia_env_calc_tables_struct ixheaacd_aac_dec_env_calc_tables;
70 
71 typedef struct {
72   WORD16 w_32[2 * 30];
73   WORD16 w_16[2 * 12];
74   WORD32 dig_rev_table2_32[4];
75   WORD32 dig_rev_table4_16[2];
76 
77   WORD16 sbr_sin_cos_twiddle_l64[64];
78   WORD16 sbr_alt_sin_twiddle_l64[32];
79   WORD16 sbr_cos_sin_twiddle_ds_l32[32 + 32];
80   WORD16 sbr_sin_cos_twiddle_l32[32];
81   WORD16 sbr_alt_sin_twiddle_l32[16];
82   WORD16 sbr_t_cos_sin_l32[32 + 32];
83 
84   WORD16 post_fft_tbl[18];
85   WORD16 dct23_tw[66];
86 
87   WORD16 qmf_c[1280];
88 
89   UWORD8 dig_rev_table2_128[4];
90   WORD32 w1024[1536];
91   WORD32 esbr_qmf_c[1280];
92   WORD32 esbr_qmf_c_24[480];
93   WORD32 esbr_w_32[2 * 30];
94   WORD32 esbr_w_16[2 * 12];
95 
96   WORD32 esbr_sin_cos_twiddle_l64[64];
97   WORD32 esbr_alt_sin_twiddle_l64[32];
98 
99   WORD32 esbr_sin_cos_twiddle_l32[32];
100   WORD32 esbr_alt_sin_twiddle_l32[16];
101   WORD32 esbr_t_cos_sin_l32[32 + 32];
102 
103   WORD32 esbr_sin_cos_twiddle_l24[24];
104   WORD32 esbr_alt_sin_twiddle_l24[12];
105   WORD32 esbr_t_cos_sin_l24[24 + 24];
106 
107   WORD32 esbr_sin_cos_twiddle_l16[16];
108   WORD32 esbr_alt_sin_twiddle_l16[8];
109   WORD32 esbr_t_cos_sin_l16[16 + 16];
110 
111   WORD16 ixheaacd_sbr_t_cos_sin_l32_eld[32 + 32];
112 
113   WORD16 qmf_c_eld[640];
114   WORD16 qmf_c_eld2[640];
115 
116   WORD16 qmf_c_eld3[640];
117   WORD32 qmf_c_ldsbr_mps[640];
118 
119   WORD16 ixheaacd_sbr_synth_cos_sin_l32[64 + 64];
120 
121 } ia_qmf_dec_tables_struct;
122 
123 extern const ia_qmf_dec_tables_struct ixheaacd_aac_qmf_dec_tables;
124 
125 typedef struct {
126   ia_frame_info_struct sbr_frame_info1_2_4_16[3 + 1 + 3];
127 
128   ia_sbr_header_data_struct str_sbr_default_header;
129   WORD16 ixheaacd_t_huffman_env_bal_1_5db_inp_table[50];
130   WORD16 ixheaacd_f_huffman_env_bal_1_5db_inp_table[50];
131   WORD16 ixheaacd_t_huffman_env_bal_3_0db_inp_table[26];
132   WORD16 ixheaacd_f_huffman_env_bal_3_0db_inp_table[26];
133   WORD16 ixheaacd_t_huffman_noise_3_0db_inp_table[64];
134   WORD16 ixheaacd_t_huffman_noise_bal_3_0db_inp_table[26];
135   WORD16 ixheaacd_t_huffman_env_1_5db_inp_table[122];
136   WORD16 ixheaacd_f_huffman_env_1_5db_inp_table[122];
137   WORD16 ixheaacd_t_huffman_env_3_0db_inp_table[64];
138   WORD16 ixheaacd_f_huffman_env_3_0db_inp_table[64];
139 
140   WORD32 ixheaacd_t_huffman_env_bal_1_5db_idx_table[20];
141   WORD32 ixheaacd_f_huffman_env_bal_1_5db_idx_table[23];
142   WORD32 ixheaacd_t_huffman_env_bal_3_0db_idx_table[16];
143   WORD32 ixheaacd_f_huffman_env_bal_3_0db_idx_table[17];
144   WORD32 ixheaacd_t_huffman_noise_3_0db_idx_table[17];
145   WORD32 ixheaacd_t_huffman_noise_bal_3_0db_idx_table[11];
146   WORD32 ixheaacd_t_huffman_env_1_5db_idx_table[27];
147   WORD32 ixheaacd_f_huffman_env_1_5db_idx_table[28];
148   WORD32 ixheaacd_t_huffman_env_3_0db_idx_table[26];
149   WORD32 ixheaacd_f_huffman_env_3_0db_idx_table[25];
150 
151   WORD8 start_min[12];
152   WORD8 offset_idx[12];
153   WORD8 ixheaacd_drc_offset[7][16];
154   WORD8 stop_min[12];
155   WORD8 stop_off[12][14];
156 
157 } ia_env_extr_tables_struct;
158 
159 extern const ia_env_extr_tables_struct ixheaacd_aac_dec_env_extr_tables;
160 
161 typedef struct {
162   WORD16 decay_scale_factor[72];
163 
164   WORD16 hyb_resol[3];
165   WORD16 rev_link_decay_ser[NUM_SER_AP_LINKS];
166   WORD16 rev_link_delay_ser[3];
167   WORD16 borders_group[NO_IID_GROUPS + 1];
168   WORD16 group_shift[6];
169   WORD16 group_to_bin[NO_IID_GROUPS];
170   WORD16 hybrid_to_bin[SUBQMF_GROUPS];
171   WORD16 delay_to_bin[32];
172 
173   WORD16 frac_delay_phase_fac_qmf_re_im[24 * 2];
174   WORD16 frac_delay_phase_fac_qmf_sub_re_im[16 * 2];
175   WORD16 frac_delay_phase_fac_qmf_ser_re_im[3][32 * 2];
176   WORD16 frac_delay_phase_fac_qmf_sub_ser_re_im[3][16 * 2];
177 
178   WORD16 scale_factors[NO_IID_LEVELS];
179   WORD16 scale_factors_fine[NO_IID_LEVELS_FINE];
180   WORD16 alpha_values[NO_ICC_LEVELS];
181   WORD16 p2_6[6];
182   WORD16 p8_13[13];
183   WORD16 huff_iid_dt[28];
184   WORD16 huff_iid_df[28];
185   WORD16 huff_icc_dt[14];
186   WORD16 huff_icc_df[14];
187   WORD16 huff_iid_dt_fine[60];
188   WORD16 huff_iid_df_fine[60];
189   WORD32 dummy;
190 
191   FLOAT32 qmf_fract_delay_phase_factor_im[NUM_QUAD_MIRROR_FILTER_CHNLS];
192   FLOAT32 qmf_fract_delay_phase_factor_re[NUM_QUAD_MIRROR_FILTER_CHNLS];
193 
194   FLOAT32 frac_delay_phase_fac_qmf_sub_im_20[NUM_SUB_QMF_CHANNELS];
195   FLOAT32 frac_delay_phase_fac_qmf_sub_re_20[NUM_SUB_QMF_CHANNELS];
196   FLOAT32 frac_delay_phase_fac_qmf_sub_im_34[NUM_SUB_QMF_CHANNELS_HI_RES];
197   FLOAT32 frac_delay_phase_fac_qmf_sub_re_34[NUM_SUB_QMF_CHANNELS_HI_RES];
198 
199   FLOAT32 qmf_ser_fract_delay_phase_factor_im[NUM_QUAD_MIRROR_FILTER_CHNLS]
200                                              [NUM_SER_AP_LINKS];
201   FLOAT32 qmf_ser_fract_delay_phase_factor_re[NUM_QUAD_MIRROR_FILTER_CHNLS]
202                                              [NUM_SER_AP_LINKS];
203 
204   FLOAT32 frac_delay_phase_fac_ser_qmf_sub_im_20[NUM_SUB_QMF_CHANNELS][NUM_SER_AP_LINKS];
205   FLOAT32 frac_delay_phase_fac_ser_qmf_sub_re_20[NUM_SUB_QMF_CHANNELS][NUM_SER_AP_LINKS];
206   FLOAT32 frac_delay_phase_fac_ser_qmf_sub_im_34[NUM_SUB_QMF_CHANNELS_HI_RES]
207                                                 [NUM_SER_AP_LINKS];
208   FLOAT32 frac_delay_phase_fac_ser_qmf_sub_re_34[NUM_SUB_QMF_CHANNELS_HI_RES]
209                                                 [NUM_SER_AP_LINKS];
210 
211   FLOAT32 scale_factors_flt[NO_IID_LEVELS];
212   FLOAT32 scale_factors_fine_flt[NO_IID_LEVELS_FINE];
213 
214   FLOAT32 alphas[NUM_ICC_LEVELS];
215   FLOAT32 all_pass_link_decay_ser[NUM_SER_AP_LINKS];
216   FLOAT32 p8_13_20[HYBRID_FILTER_LENGTH];
217   FLOAT32 p2_13_20[HYBRID_FILTER_LENGTH];
218   FLOAT32 p12_13_34[HYBRID_FILTER_LENGTH];
219   FLOAT32 p8_13_34[HYBRID_FILTER_LENGTH];
220   FLOAT32 p4_13_34[HYBRID_FILTER_LENGTH];
221   FLOAT32 cos_mod_2channel[2][HYBRID_FILTER_LENGTH];
222   FLOAT32 cos_sin_mod_4channel[4][HYBRID_FILTER_LENGTH * 2];
223   FLOAT32 cos_sin_mod_8channel[8][HYBRID_FILTER_LENGTH * 2];
224   FLOAT32 cos_sin_mod_12channel[12][HYBRID_FILTER_LENGTH * 2];
225 
226   WORD32 qmf_delay_idx_tbl[NUM_QUAD_MIRROR_FILTER_CHNLS];
227   WORD32 group_borders_20_tbl[NUM_IID_GROUPS + 1];
228   WORD32 group_borders_34_tbl[NUM_IID_GROUPS_HI_RES + 1];
229   WORD32 bin_group_map_20[NUM_IID_GROUPS];
230   WORD32 bin_group_map_34[NUM_IID_GROUPS_HI_RES];
231   WORD32 quantized_iids[NUM_IID_STEPS];
232   WORD32 quantized_iids_fine[NUM_IID_STEPS_FINE];
233   FLOAT32 quantized_rhos[NUM_ICC_STEPS];
234   WORD32 ipd_bins_tbl[3];
235 
236   WORD16 band_res_hyb20[3];
237   WORD16 band_res_hyb34[5];
238 } ia_ps_tables_struct;
239 
240 extern const ia_ps_tables_struct ixheaacd_aac_dec_ps_tables;
241 
242 typedef struct {
243   ia_env_calc_tables_struct *env_calc_tables_ptr;
244   ia_qmf_dec_tables_struct *qmf_dec_tables_ptr;
245   ia_env_extr_tables_struct *env_extr_tables_ptr;
246   ia_ps_tables_struct *ps_tables_ptr;
247   WORD32 *sbr_rand_ph;
248 } ia_sbr_tables_struct;
249 
250 #endif
251