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