• 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_CONFIG_H
21 #define IXHEAACD_CONFIG_H
22 
23 #define USAC_MAX_ELEMENTS (16)
24 
25 #define USAC_MAX_CONFIG_EXTENSIONS (16)
26 
27 #define ID_USAC_SCE 0
28 #define ID_USAC_CPE 1
29 #define ID_USAC_LFE 2
30 #define ID_USAC_EXT 3
31 #define ID_USAC_INVALID 0xFF
32 
33 #define USAC_SBR_RATIO_NO_SBR 0
34 #define USAC_SBR_RATIO_INDEX_2_1 1
35 #define USAC_SBR_RATIO_INDEX_8_3 2
36 #define USAC_SBR_RATIO_INDEX_4_1 3
37 
38 #define USAC_OUT_FRAMELENGTH_768 768
39 #define USAC_OUT_FRAMELENGTH_1024 1024
40 #define USAC_OUT_FRAMELENGTH_2048 2048
41 #define USAC_OUT_FRAMELENGTH_4096 4096
42 
43 #define MAX_CORE_SBR_FRAME_LEN_IDX (4)
44 #define IA_MAX_INP_BUFFER_SIZE (8 * 1024 + 11)
45 
46 #define ID_EXT_ELE_FILL 0
47 #define ID_EXT_ELE_MPEGS 1
48 #define ID_EXT_ELE_SAOC 2
49 #define ID_EXT_ELE_AUDIOPREROLL 3
50 #define ID_EXT_ELE_UNI_DRC 4
51 
52 #define ID_CONFIG_EXT_FILL 0
53 #define ID_CONFIG_EXT_LOUDNESS_INFO (2)
54 
55 #define MAX_PARAMETER_BANDS (28)
56 #define MAX_NUM_OTT (5)
57 #define MAX_NUM_TTT (1)
58 #define MAX_INPUT_CHANNELS (2)
59 #define MAX_RESIDUAL_CHANNELS (3)
60 #define MAX_OUTPUT_CHANNELS (7)
61 #define MAX_NUM_EXT_TYPES (8)
62 #define MAX_M_INPUT (2)
63 #define MAX_M_OUTPUT (2)
64 #define QMF_BANDS_TO_HYBRID (3)
65 #define MAX_HYBRID_ONLY_BANDS_PER_QMF (8)
66 #define MAX_ARBITRARY_TREE_LEVELS (2)
67 #define MAX_OUTPUT_CHANNELS_AT \
68   (MAX_OUTPUT_CHANNELS * (1 << MAX_ARBITRARY_TREE_LEVELS))
69 #define MAX_ARBITRARY_TREE_INDEX ((1 << (MAX_ARBITRARY_TREE_LEVELS + 1)) - 1)
70 
71 typedef UWORD8 UINT8;
72 typedef UWORD32 UINT32;
73 
74 typedef struct {
75   UINT32 harmonic_sbr;
76   UINT32 bs_inter_tes;
77   UINT32 bs_pvc;
78   WORD16 dflt_start_freq;
79   WORD16 dflt_stop_freq;
80   WORD16 dflt_header_extra1;
81   WORD16 dflt_header_extra2;
82   WORD16 dflt_freq_scale;
83   WORD16 dflt_alter_scale;
84   WORD16 dflt_noise_bands;
85   WORD16 dflt_limiter_bands;
86   WORD16 dflt_limiter_gains;
87   WORD16 dflt_interpol_freq;
88   WORD16 dflt_smoothing_mode;
89 } ia_usac_dec_sbr_config_struct;
90 
91 typedef struct {
92   UINT32 bs_freq_res;
93   UINT32 bs_fixed_gain_dmx;
94   UINT32 bs_temp_shape_config;
95   UINT32 bs_decorr_config;
96   UINT32 bs_high_rate_mode;
97   UINT32 bs_phase_coding;
98   UINT32 bs_ott_bands_phase_present;
99   UINT32 bs_ott_bands_phase;
100   UINT32 bs_residual_bands;
101   UINT32 bs_pseudo_lr;
102   UINT32 bs_env_quant_mode;
103   UINT32 ldmps_present_flag;
104 
105   UINT32 bs_sampling_freq_index;
106   UINT32 bs_fampling_frequency;
107   UINT32 bs_frame_length;
108   UINT32 bs_tree_config;
109   UINT32 bs_quant_mode;
110   UINT32 bs_one_icc;
111   UINT32 bs_arbitrary_downmix;
112   UINT32 bs_residual_coding;
113   UINT32 bs_fixed_gain_sur;
114   UINT32 bs_fixed_gain_LFE;
115   UINT32 bs_matrix_mode;
116   UINT32 bs_3D_audio_mode;
117   UINT32 bs_3D_audio_HRTF_set;
118   UINT32 bs_HRTF_freq_res;
119   UINT32 HRTF_num_band;
120   UINT32 HRTF_num_phase;  // new
121   UINT32 bs_HRTF_num_chan;
122   UINT32 bs_HRTF_asymmetric;
123   UINT32 bs_HRTF_level_left[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
124   UINT32 bs_HRTF_level_right[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
125   UINT32 bs_HRTF_phase[MAX_OUTPUT_CHANNELS];
126   UINT32 bs_HRTF_phase_LR[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
127   UINT32 bs_HRTF_icc[MAX_OUTPUT_CHANNELS];
128   UINT32 bs_HRTF_icc_LR[MAX_OUTPUT_CHANNELS][MAX_PARAMETER_BANDS];
129   UINT32 bs_ott_bands[MAX_NUM_OTT];
130   UINT32 bs_ttt_dual_mode[MAX_NUM_TTT];
131   UINT32 bs_ttt_mode_low[MAX_NUM_TTT];
132   UINT32 bs_ttt_mode_high[MAX_NUM_TTT];
133   UINT32 bs_ttt_bands_low[MAX_NUM_TTT];
134   UINT32 bs_ttt_bands_high[MAX_NUM_TTT];
135 
136   UINT32 bs_sac_ext_type[MAX_NUM_EXT_TYPES];
137   UINT32 sac_ext_cnt;
138 
139   UINT32 bs_residual_present[MAX_RESIDUAL_CHANNELS];
140   UINT32 bs_residual_sampling_freq_index;
141   UINT32 bs_residual_frames_per_spatial_frame;
142 
143   UINT32 bs_residual_bands_ld_mps[MAX_RESIDUAL_CHANNELS];
144 
145   UINT32 bs_arbitrary_downmix_residual_sampling_freq_index;
146   UINT32 bs_arbitrary_downmix_residual_frames_per_spatial_frame;
147   UINT32 bs_arbitrary_downmix_residual_bands;
148 
149   UINT32 num_out_chan_AT;
150   UINT32 num_ott_boxes_AT;
151   UINT32 bs_output_channel_pos_AT[MAX_OUTPUT_CHANNELS_AT];
152   UINT32 bs_ott_box_present_AT[MAX_OUTPUT_CHANNELS][MAX_ARBITRARY_TREE_INDEX];
153   UINT32 bs_ott_default_cld_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
154   UINT32 bs_ott_mode_lfe_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
155   UINT32 bs_ott_bands_AT[MAX_OUTPUT_CHANNELS * MAX_ARBITRARY_TREE_INDEX];
156 
157   WORD32 num_ott_boxes;
158   WORD32 num_ttt_boxes;
159   WORD32 num_input_channels;
160   WORD32 num_output_channels;
161   WORD32 ott_mode_lfe[MAX_NUM_OTT];  // new
162   WORD32 no_ldsbr_present;
163 } ia_usac_dec_mps_config_struct;
164 
165 #define BS_OUTPUT_CHANNEL_POS_NA -1   /* n/a                                */
166 #define BS_OUTPUT_CHANNEL_POS_L 0     /* Left Front                          */
167 #define BS_OUTPUT_CHANNEL_POS_R 1     /* Right Front                         */
168 #define BS_OUTPUT_CHANNEL_POS_C 2     /* Center Front                        */
169 #define BS_OUTPUT_CHANNEL_POS_LFE 3   /* Low Frequency Enhancement           */
170 #define BS_OUTPUT_CHANNEL_POS_LS 4    /* Left Surround                       */
171 #define BS_OUTPUT_CHANNEL_POS_RS 5    /* Right Surround                      */
172 #define BS_OUTPUT_CHANNEL_POS_LC 6    /* Left Front Center                   */
173 #define BS_OUTPUT_CHANNEL_POS_RC 7    /* Right Front Center                  */
174 #define BS_OUTPUT_CHANNEL_POS_LSR 8   /* Rear Surround Left                  */
175 #define BS_OUTPUT_CHANNEL_POS_RSR 9   /* Rear Surround Right                 */
176 #define BS_OUTPUT_CHANNEL_POS_CS 10   /* Rear Center                         */
177 #define BS_OUTPUT_CHANNEL_POS_LSD 11  /* Left Surround Direct                */
178 #define BS_OUTPUT_CHANNEL_POS_RSD 12  /* Right Surround Direct               */
179 #define BS_OUTPUT_CHANNEL_POS_LSS 13  /* Left Side Surround                  */
180 #define BS_OUTPUT_CHANNEL_POS_RSS 14  /* Right Side Surround                 */
181 #define BS_OUTPUT_CHANNEL_POS_LW 15   /* Left Wide Front                     */
182 #define BS_OUTPUT_CHANNEL_POS_RW 16   /* Right Wide Front                    */
183 #define BS_OUTPUT_CHANNEL_POS_LV 17   /* Left Front Vertical Height          */
184 #define BS_OUTPUT_CHANNEL_POS_RV 18   /* Right Front Vertical Height         */
185 #define BS_OUTPUT_CHANNEL_POS_CV 19   /* Center Front Vertical Height        */
186 #define BS_OUTPUT_CHANNEL_POS_LVR 20  /* Left Surround Vertical Height Rear  */
187 #define BS_OUTPUT_CHANNEL_POS_RVR 21  /* Right Surround Vertical Height Rear */
188 #define BS_OUTPUT_CHANNEL_POS_CVR 22  /* Center Vertical Height Rear         */
189 #define BS_OUTPUT_CHANNEL_POS_LVSS 23 /* Left Vertical Height Side Surround */
190 #define BS_OUTPUT_CHANNEL_POS_RVSS                                             \
191   24                                /* Right Vertical Height Side Surround \ \ \
192                                        */
193 #define BS_OUTPUT_CHANNEL_POS_TS 25 /* Top Center Surround                 */
194 #define BS_OUTPUT_CHANNEL_POS_LFE2 26 /* Low Frequency Enhancement 2 */
195 #define BS_OUTPUT_CHANNEL_POS_LB 27   /* Left Front Vertical Bottom          */
196 #define BS_OUTPUT_CHANNEL_POS_RB 28   /* Right Front Vertical Bottom         */
197 #define BS_OUTPUT_CHANNEL_POS_CB 29   /* Center Front Vertical Bottom        */
198 #define BS_OUTPUT_CHANNEL_POS_LVS 30  /* Left Vertical Height Surround       */
199 #define BS_OUTPUT_CHANNEL_POS_RVS 31  /* Right Vertical Height Surround      */
200 
201 #define BS_MAX_NUM_OUT_CHANNELS (255)
202 
203 #define EXT_COUNT_MAX (2)
204 #define MAX_CHANNEL_COUNT (128)
205 #define SEQUENCE_COUNT_MAX (24)
206 #define PARAM_DRC_TYPE_FF_NODE_COUNT_MAX (9)
207 #define PARAM_DRC_INSTRUCTIONS_COUNT_MAX (8)
208 #define DOWNMIX_ID_COUNT_MAX (8)
209 #define DRC_SET_ID_COUNT_MAX (16)
210 #define EQ_SET_ID_COUNT_MAX (8)
211 #define LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX (4)
212 #define LOUD_EQ_INSTRUCTIONS_COUNT_MAX (8)
213 #define FILTER_ELEMENT_COUNT_MAX (16)
214 #define FILTER_BLOCK_COUNT_MAX (16)
215 #define REAL_ZERO_RADIUS_ONE_COUNT_MAX (14)
216 #define REAL_ZERO_COUNT_MAX (64)
217 #define COMPLEX_ZERO_COUNT_MAX (64)
218 #define REAL_POLE_COUNT_MAX (16)
219 #define COMPLEX_POLE_COUNT_MAX (16)
220 #define FIR_ORDER_MAX (128)
221 #define EQ_NODE_COUNT_MAX (33)
222 #define UNIQUE_SUBBAND_GAIN_COUNT_MAX (16)
223 #define EQ_SUBBAND_GAIN_COUNT_MAX (135)
224 #define EQ_CHANNEL_GROUP_COUNT_MAX (4)
225 #define EQ_FILTER_BLOCK_COUNT_MAX (4)
226 #define EQ_INSTRUCTIONS_COUNT_MAX (8)
227 #define DRC_COEFF_COUNT_MAX (8)
228 #define DOWNMIX_INSTRUCTION_COUNT_MAX (16)
229 #define DRC_INSTRUCTIONS_COUNT_MAX (DOWNMIX_INSTRUCTION_COUNT_MAX + 20)
230 #define BAND_COUNT_MAX (8)
231 
232 #define N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX (512 + 14)
233 #define GAIN_SET_COUNT_MAX SEQUENCE_COUNT_MAX
234 #define SPLIT_CHARACTERISTIC_NODE_COUNT_MAX (4)
235 #define SPLIT_CHARACTERISTIC_COUNT_MAX (8)
236 #define SHAPE_FILTER_COUNT_MAX (8)
237 #define CHANNEL_GROUP_COUNT_MAX SEQUENCE_COUNT_MAX
238 #define DRC_BAND_COUNT_MAX BAND_COUNT_MAX
239 #define SPEAKER_POS_COUNT_MAX (128)
240 #define DOWNMIX_COEFF_COUNT_MAX (32 * 32)
241 #define MAX_AUDIO_PREROLLS 3
242 
243 typedef struct {
244   UINT32 tw_mdct;
245   UINT32 noise_filling;
246   UINT32 stereo_config_index;
247 
248   UINT32 usac_ext_eleme_def_len;
249   UINT32 usac_ext_elem_pld_frag;
250 
251   ia_usac_dec_sbr_config_struct str_usac_sbr_config;
252   ia_usac_dec_mps_config_struct str_usac_mps212_config;
253 
254 } ia_usac_dec_element_config_struct;
255 
256 typedef struct {
257   UWORD32 num_elements;
258   UWORD32 num_config_extensions;
259   UWORD32 usac_element_type[USAC_MAX_ELEMENTS];
260   ia_usac_dec_element_config_struct str_usac_element_config[USAC_MAX_ELEMENTS];
261 
262   WORD32 usac_cfg_ext_info_present[USAC_MAX_CONFIG_EXTENSIONS];
263   WORD32 usac_ext_ele_payload_present[USAC_MAX_ELEMENTS];
264   WORD32 usac_cfg_ext_info_len[USAC_MAX_CONFIG_EXTENSIONS];
265   WORD32 usac_ext_ele_payload_len[USAC_MAX_ELEMENTS];
266   WORD32 usac_ext_gain_payload_len[MAX_AUDIO_PREROLLS + 2];
267   UWORD8 usac_cfg_ext_info_buf[USAC_MAX_CONFIG_EXTENSIONS][768];
268   UWORD8 usac_ext_ele_payload_buf[USAC_MAX_ELEMENTS][768];
269   UWORD8 usac_ext_gain_payload_buf[MAX_AUDIO_PREROLLS * 768];
270   UWORD32 preroll_bytes[MAX_AUDIO_PREROLLS +
271                         2];  // Contain the number of bytes in each preroll
272   WORD32 preroll_counter;    // count the number of prerolls in a frame.
273 
274   WORD32 preroll_flag;
275 
276 } ia_usac_decoder_config_struct;
277 
278 typedef struct {
279   UINT32 usac_sampling_frequency_index;
280   UINT32 usac_sampling_frequency;
281   UINT32 core_sbr_framelength_index;
282   UINT32 channel_configuration_index;
283 
284   UINT32 num_out_channels;
285   UINT32 output_channel_pos[BS_MAX_NUM_OUT_CHANNELS];
286   ia_usac_decoder_config_struct str_usac_dec_config;
287 
288 } ia_usac_config_struct;
289 
290 typedef struct {
291   WORD32 parametric_lim_threshold_present;
292   FLOAT32 parametric_lim_threshold;
293   WORD32 parametric_lim_attack;
294   WORD32 parametric_lim_release_present;
295   WORD32 parametric_lim_release;
296   WORD32 drc_characteristic;
297 
298   WORD32 disable_paramteric_drc;
299 } ia_parametric_drc_lim_struct;
300 typedef struct {
301   WORD32 level_estim_k_weighting_type;
302   WORD32 level_estim_integration_time_present;
303   WORD32 level_estim_integration_time;
304   WORD32 drc_curve_definition_type;
305   WORD32 drc_characteristic;
306   WORD32 node_count;
307   WORD32 node_level[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
308   WORD32 node_gain[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
309   WORD32 drc_gain_smooth_parameters_present;
310   WORD32 gain_smooth_attack_time_slow;
311   WORD32 gain_smooth_release_time_slow;
312   WORD32 gain_smooth_time_fast_present;
313   WORD32 gain_smooth_attack_time_fast;
314   WORD32 gain_smooth_release_time_fast;
315   WORD32 gain_smooth_threshold_present;
316   WORD32 gain_smooth_attack_threshold;
317   WORD32 gain_smooth_rel_threshold;
318   WORD32 gain_smooth_hold_off_count_present;
319   WORD32 gain_smooth_hold_off;
320 
321   WORD32 disable_paramteric_drc;
322 } ia_parametric_drc_type_feed_forward_struct;
323 typedef struct {
324   WORD32 parametric_drc_id;
325   WORD32 parametric_drc_look_ahead_flag;
326   WORD32 parametric_drc_look_ahead;
327   WORD32 parametric_drc_preset_id_present;
328   WORD32 parametric_drc_preset_id;
329   WORD32 parametric_drc_type;
330   WORD32 len_bit_size;
331   ia_parametric_drc_type_feed_forward_struct
332       str_parametric_drc_type_feed_forward;
333   ia_parametric_drc_lim_struct parametric_drc_lim;
334 
335   WORD32 drc_characteristic;
336   WORD32 disable_paramteric_drc;
337 } ia_parametric_drc_instructions_struct;
338 
339 typedef struct {
340   WORD32 parametric_drc_id;
341   WORD32 side_chain_config_type;
342   WORD32 downmix_id;
343   WORD32 level_estim_channel_weight_format;
344   FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
345   WORD32 drc_input_loudness_present;
346   FLOAT32 drc_input_loudness;
347 
348   WORD32 ch_count_from_dwnmix_id;
349 } ia_parametric_drc_gain_set_params_struct;
350 
351 typedef struct {
352   WORD32 drc_location;
353   WORD32 parametric_drc_frame_size_format;
354   WORD32 parametric_drc_frame_size;
355   WORD32 parametric_drc_delay_max_present;
356   WORD32 parametric_drc_delay_max;
357   WORD32 reset_parametric_drc;
358   WORD32 parametric_drc_gain_set_count;
359   ia_parametric_drc_gain_set_params_struct
360       str_parametric_drc_gain_set_params[SEQUENCE_COUNT_MAX];
361 } ia_drc_coeff_parametric_drc_struct;
362 
363 typedef struct {
364   WORD32 loud_eq_set_id;
365   WORD32 drc_location;
366   WORD32 dwnmix_id_count;
367   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
368   WORD32 drc_set_id_count;
369   WORD32 drc_set_id[DRC_SET_ID_COUNT_MAX];
370   WORD32 eq_set_id_count;
371   WORD32 eq_set_id[EQ_SET_ID_COUNT_MAX];
372   WORD32 loudness_after_drc;
373   WORD32 loudness_after_eq;
374   WORD32 loud_eq_gain_sequence_count;
375   WORD32 gain_seq_idx[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
376   WORD32 drc_characteristic_format_is_cicp[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
377   WORD32 drc_characteristic[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
378   WORD32 drc_characteristic_left_index[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
379   WORD32 drc_characteristic_right_index[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
380   WORD32 frequency_range_index[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
381   FLOAT32 loud_eq_scaling[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
382   FLOAT32 loud_eq_offset[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX];
383 } ia_loud_eq_instructions_struct;
384 
385 typedef struct {
386   WORD32 filt_ele_idx;
387   WORD32 filt_ele_gain_flag;
388   FLOAT32 filt_ele_gain;
389 } ia_filt_ele_struct;
390 
391 typedef struct {
392   WORD32 filter_element_count;
393   ia_filt_ele_struct str_filter_element[FILTER_ELEMENT_COUNT_MAX];
394 } ia_filt_block_struct;
395 
396 typedef struct {
397   WORD32 eq_filter_format;
398   WORD32 bs_real_zero_radius_one_count;
399   WORD32 real_zero_count;
400   WORD32 generic_zero_count;
401   WORD32 real_pole_count;
402   WORD32 cmplx_pole_count;
403   WORD32 zero_sign[REAL_ZERO_RADIUS_ONE_COUNT_MAX];
404   FLOAT32 real_zero_radius[REAL_ZERO_COUNT_MAX];
405   FLOAT32 generic_zero_radius[COMPLEX_ZERO_COUNT_MAX];
406   FLOAT32 generic_zero_angle[COMPLEX_ZERO_COUNT_MAX];
407   FLOAT32 real_pole_radius[REAL_POLE_COUNT_MAX];
408   FLOAT32 complex_pole_radius[COMPLEX_POLE_COUNT_MAX];
409   FLOAT32 complex_pole_angle[COMPLEX_POLE_COUNT_MAX];
410   WORD32 fir_filt_order;
411   WORD32 fir_symmetry;
412   FLOAT32 fir_coeff[FIR_ORDER_MAX / 2];
413 } ia_unique_td_filt_element;
414 typedef struct {
415   WORD32 num_eq_nodes;
416   FLOAT32 eq_slope[EQ_NODE_COUNT_MAX];
417   WORD32 eq_freq_delta[EQ_NODE_COUNT_MAX];
418   FLOAT32 eq_gain_initial;
419   FLOAT32 eq_gain_delta[EQ_NODE_COUNT_MAX];
420 } ia_eq_subband_gain_spline_struct;
421 typedef struct {
422   FLOAT32 eq_subband_gain[EQ_SUBBAND_GAIN_COUNT_MAX];
423 } ia_eq_subband_gain_vector;
424 typedef struct {
425   WORD32 eq_delay_max_present;
426   WORD32 eq_delay_max;
427   WORD32 unique_filter_block_count;
428   ia_filt_block_struct str_filter_block[FILTER_BLOCK_COUNT_MAX];
429   WORD32 unique_td_filter_element_count;
430   ia_unique_td_filt_element unique_td_filt_ele[FILTER_ELEMENT_COUNT_MAX];
431   WORD32 unique_eq_subband_gains_count;
432   WORD32 eq_subband_gain_representation;
433   WORD32 eq_subband_gain_format;
434   WORD32 eq_subband_gain_count;
435   ia_eq_subband_gain_spline_struct
436       str_eq_subband_gain_spline[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
437   ia_eq_subband_gain_vector
438       str_eq_subband_gain_vector[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
439 } ia_eq_coeff_struct;
440 typedef struct {
441   WORD32 filter_block_count;
442   WORD32 filter_block_index[EQ_FILTER_BLOCK_COUNT_MAX];
443 } ia_filter_block_refs_struct;
444 typedef struct {
445   WORD32 eq_cascade_gain_present[EQ_CHANNEL_GROUP_COUNT_MAX];
446   FLOAT32 eq_cascade_gain[EQ_CHANNEL_GROUP_COUNT_MAX];
447   ia_filter_block_refs_struct str_filter_block_refs[EQ_CHANNEL_GROUP_COUNT_MAX];
448   WORD32 eq_phase_alignment_present;
449   WORD32 eq_phase_alignment[EQ_CHANNEL_GROUP_COUNT_MAX]
450                            [EQ_CHANNEL_GROUP_COUNT_MAX];
451 } ia_td_filter_cascade_struct;
452 
453 typedef struct {
454   WORD32 eq_set_id;
455   WORD32 eq_set_complexity_level;
456   WORD32 dwnmix_id_count;
457   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
458   WORD32 eq_apply_to_downmix;
459   WORD32 drc_set_id_count;
460   WORD32 drc_set_id[DRC_SET_ID_COUNT_MAX];
461   WORD32 eq_set_purpose;
462   WORD32 depends_on_eq_set_present;
463   WORD32 depends_on_eq_set;
464   WORD32 no_independent_eq_use;
465   WORD32 eq_channel_count;
466   WORD32 eq_ch_group_count;
467   WORD32 eq_ch_group_of_channel[MAX_CHANNEL_COUNT];
468   WORD32 td_filter_cascade_present;
469   ia_td_filter_cascade_struct str_td_filter_cascade;
470   WORD32 subband_gains_present;
471   WORD32 subband_gains_index[EQ_CHANNEL_GROUP_COUNT_MAX];
472   WORD32 eq_transition_duration_present;
473   WORD32 eq_transition_duration;
474 } ia_eq_instructions_struct;
475 
476 typedef struct {
477   WORD32 drc_config_ext_type[EXT_COUNT_MAX];
478   WORD32 ext_bit_size[EXT_COUNT_MAX - 1];
479 
480   WORD32 parametric_drc_present;
481   ia_drc_coeff_parametric_drc_struct str_drc_coeff_param_drc;
482   WORD32 parametric_drc_instructions_count;
483   ia_parametric_drc_instructions_struct
484       str_parametric_drc_instructions[PARAM_DRC_INSTRUCTIONS_COUNT_MAX];
485   WORD32 drc_extension_v1_present;
486   WORD32 loud_eq_instructions_flag;
487   WORD32 loud_eq_instructions_count;
488   ia_loud_eq_instructions_struct
489       loud_eq_instructions[LOUD_EQ_INSTRUCTIONS_COUNT_MAX];
490   WORD32 eq_flag;
491   ia_eq_coeff_struct str_eq_coeff;
492   WORD32 eq_instructions_count;
493   ia_eq_instructions_struct str_eq_instructions[EQ_INSTRUCTIONS_COUNT_MAX];
494 } ia_drc_config_ext;
495 
496 typedef struct {
497   WORD32 drc_location;
498   WORD32 drc_characteristic;
499 } ia_drc_coefficients_basic_struct;
500 
501 typedef struct {
502   WORD32 drc_set_id;
503   WORD32 drc_location;
504   WORD32 dwnmix_id_count;
505   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
506   WORD32 drc_set_effect;
507   WORD32 limiter_peak_target_present;
508   FLOAT32 limiter_peak_target;
509   WORD32 drc_set_target_loudness_present;
510   WORD32 drc_set_target_loudness_value_upper;
511   WORD32 drc_set_target_loudness_value_lower_present;
512   WORD32 drc_set_target_loudness_value_lower;
513 } ia_drc_instructions_basic_struct;
514 
515 typedef struct {
516   WORD32 gain_seq_idx;
517   WORD32 drc_characteristic;
518   WORD32 drc_characteristic_present;
519   WORD32 drc_characteristic_format_is_cicp;
520   WORD32 drc_characteristic_left_index;
521   WORD32 drc_characteristic_right_index;
522   WORD32 crossover_freq_idx;
523   WORD32 start_subband_index;
524 } ia_gain_params_struct;
525 typedef struct {
526   WORD32 size;
527   WORD32 code;
528   WORD32 value;
529 } ia_delta_time_code_table_entry_struct;
530 typedef struct {
531   ia_delta_time_code_table_entry_struct
532       delta_time_code_table[N_DELTA_TIME_CODE_TABLE_ENTRIES_MAX];
533 } ia_tables_struct;
534 
535 typedef struct {
536   WORD32 gain_coding_profile;
537   WORD32 gain_interpolation_type;
538   WORD32 full_frame;
539   WORD32 time_alignment;
540   WORD32 time_delt_min_flag;
541   WORD32 time_delt_min_val;
542   WORD32 band_count;
543   WORD32 drc_band_type;
544   ia_gain_params_struct gain_params[BAND_COUNT_MAX];
545 
546   WORD32 num_gain_max_values;
547   ia_tables_struct str_tables;
548 } ia_gain_set_params_struct;
549 
550 typedef struct {
551   WORD32 characteristic_format;
552   FLOAT32 in_out_ratio;
553   FLOAT32 gain;
554   FLOAT32 exp;
555   WORD32 flip_sign;
556   WORD32 characteristic_node_count;
557   FLOAT32 node_level[SPLIT_CHARACTERISTIC_NODE_COUNT_MAX + 1];
558   FLOAT32 node_gain[SPLIT_CHARACTERISTIC_NODE_COUNT_MAX + 1];
559 } ia_split_drc_characteristic_struct;
560 
561 typedef struct {
562   WORD32 corner_freq_index;
563   WORD32 filter_strength_index;
564 } ia_shape_filter_params_struct;
565 
566 typedef struct {
567   WORD32 lf_cut_filter_present;
568   ia_shape_filter_params_struct str_lf_cut_params;
569   WORD32 lf_boost_filter_present;
570   ia_shape_filter_params_struct str_lf_boost_params;
571   WORD32 hf_cut_filter_present;
572   ia_shape_filter_params_struct str_hf_cut_params;
573   WORD32 hf_boost_filter_present;
574   ia_shape_filter_params_struct str_hf_boost_params;
575 } ia_shape_filter_block_params_struct;
576 
577 typedef struct {
578   WORD32 version;
579   WORD32 drc_location;
580   WORD32 drc_frame_size_present;
581   WORD32 drc_frame_size;
582   WORD32 gain_set_count;
583   ia_gain_set_params_struct gain_set_params[GAIN_SET_COUNT_MAX];
584   WORD32 drc_characteristic_left_present;
585   WORD32 characteristic_left_count;
586   ia_split_drc_characteristic_struct
587       str_split_characteristic_left[SPLIT_CHARACTERISTIC_COUNT_MAX];
588   WORD32 drc_characteristic_right_present;
589   WORD32 characteristic_right_count;
590   ia_split_drc_characteristic_struct
591       str_split_characteristic_right[SPLIT_CHARACTERISTIC_COUNT_MAX];
592   WORD32 shape_filters_present;
593   WORD32 shape_num_filter;
594   ia_shape_filter_block_params_struct
595       str_shape_filter_block_params[SHAPE_FILTER_COUNT_MAX + 1];
596   WORD32 gain_sequence_count;
597   WORD32 gain_set_params_index_for_gain_sequence[SEQUENCE_COUNT_MAX];
598   WORD32 gain_set_count_plus;
599 
600 } ia_uni_drc_coeffs_struct;
601 
602 typedef struct {
603   WORD32 target_characteristic_left_present[DRC_BAND_COUNT_MAX];
604   WORD32 target_characteristic_left_index[DRC_BAND_COUNT_MAX];
605   WORD32 target_characteristic_right_present[DRC_BAND_COUNT_MAX];
606   WORD32 target_characteristic_right_index[DRC_BAND_COUNT_MAX];
607   WORD32 shape_filter_flag;
608   WORD32 shape_filter_idx;
609   WORD32 gain_scaling_flag[BAND_COUNT_MAX];
610   FLOAT32 attn_scaling[BAND_COUNT_MAX];
611   FLOAT32 ampl_scaling[BAND_COUNT_MAX];
612   WORD32 gain_offset_flag[BAND_COUNT_MAX];
613   FLOAT32 gain_offset[BAND_COUNT_MAX];
614 } ia_gain_modifiers_struct;
615 
616 typedef struct {
617   WORD32 ducking_scaling_flag;
618   FLOAT32 ducking_scaling;
619   FLOAT32 ducking_scaling_quantized;
620 } ia_ducking_modifiers_struct;
621 
622 typedef struct {
623   WORD32 drc_set_id;
624   WORD32 drc_set_complexity_level;
625   WORD32 requires_eq;
626   WORD32 drc_apply_to_dwnmix;
627   WORD32 drc_location;
628   WORD32 dwnmix_id_count;
629   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
630   WORD32 depends_on_drc_set_present;
631   WORD32 depends_on_drc_set;
632   WORD32 no_independent_use;
633   WORD32 drc_set_effect;
634   WORD32 gain_set_index[MAX_CHANNEL_COUNT];
635   ia_gain_modifiers_struct
636       str_gain_modifiers_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
637   ia_ducking_modifiers_struct
638       str_ducking_modifiers_for_channel[MAX_CHANNEL_COUNT];
639   WORD32 limiter_peak_target_present;
640   FLOAT32 limiter_peak_target;
641   WORD32 drc_set_target_loudness_present;
642   WORD32 drc_set_target_loudness_value_upper;
643   WORD32 drc_set_target_loudness_value_lower_present;
644   WORD32 drc_set_target_loudness_value_lower;
645 
646   WORD32 audio_num_chan;
647   WORD32 num_drc_ch_groups;
648   WORD32 gain_set_index_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
649   WORD32 band_count_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
650   WORD32 gain_interpolation_type_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
651   WORD32 time_delta_min_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
652   WORD32 time_alignment_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
653   ia_ducking_modifiers_struct
654       str_ducking_modifiers_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
655   WORD32 channel_group_of_ch[MAX_CHANNEL_COUNT];
656   WORD32 num_chan_per_ch_group[CHANNEL_GROUP_COUNT_MAX];
657   WORD32 gain_element_count;
658   WORD32 multiband_audio_sig_count;
659   WORD32 ch_group_parametric_drc_flag[CHANNEL_GROUP_COUNT_MAX];
660   WORD32 gain_set_idx_of_ch_group_parametric_drc[CHANNEL_GROUP_COUNT_MAX];
661   WORD32 parametric_drc_look_ahead_samples[CHANNEL_GROUP_COUNT_MAX];
662   WORD32 parametric_drc_look_ahead_samples_max;
663 } ia_drc_instructions_struct;
664 
665 typedef struct {
666   WORD32 base_channel_count;
667   WORD32 layout_signaling_present;
668   WORD32 defined_layout;
669   WORD32 speaker_position[SPEAKER_POS_COUNT_MAX];
670 } ia_channel_layout_struct;
671 typedef struct {
672   WORD32 downmix_id;
673   WORD32 target_channel_count;
674   WORD32 target_layout;
675   WORD32 downmix_coefficients_present;
676   FLOAT32 downmix_coefficient[DOWNMIX_COEFF_COUNT_MAX];
677 } ia_downmix_instructions_struct;
678 typedef struct ia_drc_config {
679   WORD32 sample_rate_present;
680   WORD32 sampling_rate;
681   WORD32 dwnmix_instructions_count;
682   WORD32 drc_coefficients_drc_count;
683   WORD32 drc_instructions_uni_drc_count;
684   WORD32 drc_instructions_count_plus;
685   WORD32 drc_description_basic_present;
686   WORD32 drc_coefficients_basic_count;
687   WORD32 drc_instructions_basic_count;
688   WORD32 drc_config_ext_present;
689   WORD32 apply_drc;
690   ia_drc_config_ext str_drc_config_ext;
691   ia_drc_coefficients_basic_struct
692       str_drc_coefficients_basic[DRC_COEFF_COUNT_MAX];
693   ia_drc_instructions_basic_struct
694       str_drc_instructions_basic[DRC_INSTRUCTIONS_COUNT_MAX];
695   ia_uni_drc_coeffs_struct
696       str_p_loc_drc_coefficients_uni_drc[DRC_COEFF_COUNT_MAX];
697   ia_drc_instructions_struct
698       str_drc_instruction_str[DRC_INSTRUCTIONS_COUNT_MAX];
699   ia_channel_layout_struct channel_layout;
700   ia_downmix_instructions_struct
701       dwnmix_instructions[DOWNMIX_INSTRUCTION_COUNT_MAX];
702 } ia_drc_config;
703 
704 VOID ixheaacd_conf_default(ia_usac_config_struct *pstr_usac_conf);
705 
706 UWORD32 ixheaacd_sbr_ratio(UWORD32 core_sbr_frame_len_idx);
707 
708 UWORD32 ixheaacd_sbr_params(UWORD32 core_sbr_frame_len_idx,
709                             WORD32 *output_frame_length, WORD32 *block_size,
710                             WORD32 *output_samples, WORD32 *sampling_freq,
711                             UWORD32 *sample_freq_indx);
712 
713 WORD32 ixheaacd_config(ia_bit_buf_struct *bit_buff,
714                        ia_usac_config_struct *pstr_usac_conf, UINT32 *chan, WORD32 ec_flag);
715 
716 #endif /* IXHEAACD_CONFIG_H */
717