Home | History | Annotate | Download | only in drc_src
      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 IMPD_DRC_STURCT_H
     21 #define IMPD_DRC_STURCT_H
     22 
     23 #ifdef __cplusplus
     24 extern "C" {
     25 #endif
     26 
     27 #define METHOD_DEFINITION_UNKNOWN_OTHER 0
     28 #define METHOD_DEFINITION_PROGRAM_LOUDNESS 1
     29 #define METHOD_DEFINITION_ANCHOR_LOUDNESS 2
     30 #define METHOD_DEFINITION_MAX_OF_LOUDNESS_RANGE 3
     31 #define METHOD_DEFINITION_MOMENTARY_LOUDNESS_MAX 4
     32 #define METHOD_DEFINITION_SHORT_TERM_LOUDNESS_MAX 5
     33 #define METHOD_DEFINITION_LOUDNESS_RANGE 6
     34 #define METHOD_DEFINITION_MIXING_LEVEL 7
     35 #define METHOD_DEFINITION_ROOM_TYPE 8
     36 #define METHOD_DEFINITION_SHORT_TERM_LOUDNESS 9
     37 
     38 #define MEASUREMENT_SYSTEM_UNKNOWN_OTHER 0
     39 #define MEASUREMENT_SYSTEM_EBU_R_128 1
     40 #define MEASUREMENT_SYSTEM_BS_1770_4 2
     41 #define MEASUREMENT_SYSTEM_BS_1770_3 MEASUREMENT_SYSTEM_BS_1770_4
     42 #define MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING 3
     43 #define MEASUREMENT_SYSTEM_BS_1770_3_PRE_PROCESSING \
     44   MEASUREMENT_SYSTEM_BS_1770_4_PRE_PROCESSING
     45 #define MEASUREMENT_SYSTEM_USER 4
     46 #define MEASUREMENT_SYSTEM_EXPERT_PANEL 5
     47 #define MEASUREMENT_SYSTEM_BS_1771_1 6
     48 #define MEASUREMENT_SYSTEM_RESERVED_A 7
     49 #define MEASUREMENT_SYSTEM_RESERVED_B 8
     50 #define MEASUREMENT_SYSTEM_RESERVED_C 9
     51 #define MEASUREMENT_SYSTEM_RESERVED_D 10
     52 #define MEASUREMENT_SYSTEM_RESERVED_E 11
     53 
     54 #define RELIABILITY_UKNOWN 0
     55 #define RELIABILITY_UNVERIFIED 1
     56 #define RELIABILITY_CEILING 2
     57 #define RELIABILITY_ACCURATE 3
     58 
     59 #define EFFECT_BIT_COUNT 12
     60 
     61 #define EFFECT_BIT_NONE (-1)
     62 #define EFFECT_BIT_NIGHT 0x0001
     63 #define EFFECT_BIT_NOISY 0x0002
     64 #define EFFECT_BIT_LIMITED 0x0004
     65 #define EFFECT_BIT_LOWLEVEL 0x0008
     66 #define EFFECT_BIT_DIALOG 0x0010
     67 #define EFFECT_BIT_GENERAL_COMPR 0x0020
     68 #define EFFECT_BIT_EXPAND 0x0040
     69 #define EFFECT_BIT_ARTISTIC 0x0080
     70 #define EFFECT_BIT_CLIPPING 0x0100
     71 #define EFFECT_BIT_FADE 0x0200
     72 #define EFFECT_BIT_DUCK_OTHER 0x0400
     73 #define EFFECT_BIT_DUCK_SELF 0x0800
     74 
     75 #define GAIN_CODING_PROFILE_REGULAR 0
     76 #define GAIN_CODING_PROFILE_FADING 1
     77 #define GAIN_CODING_PROFILE_CLIPPING 2
     78 #define GAIN_CODING_PROFILE_CONSTANT 3
     79 #define GAIN_CODING_PROFILE_DUCKING GAIN_CODING_PROFILE_CLIPPING
     80 
     81 #define GAIN_INTERPOLATION_TYPE_SPLINE 0
     82 #define GAIN_INTERPOLATION_TYPE_LINEAR 1
     83 
     84 #define USER_METHOD_DEFINITION_DEFAULT 0
     85 #define USER_METHOD_DEFINITION_PROGRAM_LOUDNESS 1
     86 #define USER_METHOD_DEFINITION_ANCHOR_LOUDNESS 2
     87 
     88 #define USER_MEASUREMENT_SYSTEM_DEFAULT 0
     89 #define USER_MEASUREMENT_SYSTEM_BS_1770_4 1
     90 #define USER_MEASUREMENT_SYSTEM_BS_1770_3 USER_MEASUREMENT_SYSTEM_BS_1770_4
     91 #define USER_MEASUREMENT_SYSTEM_USER 2
     92 #define USER_MEASUREMENT_SYSTEM_EXPERT_PANEL 3
     93 #define USER_MEASUREMENT_SYSTEM_RESERVED_A 4
     94 #define USER_MEASUREMENT_SYSTEM_RESERVED_B 5
     95 #define USER_MEASUREMENT_SYSTEM_RESERVED_C 6
     96 #define USER_MEASUREMENT_SYSTEM_RESERVED_D 7
     97 #define USER_MEASUREMENT_SYSTEM_RESERVED_E 8
     98 
     99 #define USER_LOUDNESS_PREPROCESSING_DEFAULT 0
    100 #define USER_LOUDNESS_PREPROCESSING_OFF 1
    101 #define USER_LOUDNESS_PREPROCESSING_HIGHPASS 2
    102 
    103 #define LOUDNESS_DEVIATION_MAX_DEFAULT 63
    104 #define LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT 1000
    105 
    106 #define SHORT_TERM_LOUDNESS_TO_AVG 0
    107 #define MOMENTARY_LOUDNESS_TO_AVG 1
    108 #define TOP_OF_LOUDNESS_RANGE_TO_AVG 2
    109 
    110 #define DRC_COMPLEXITY_LEVEL_MAX 0xF
    111 #define EQ_COMPLEXITY_LEVEL_MAX 0xF
    112 #define COMPLEXITY_LEVEL_SUPPORTED_TOTAL 20.0f
    113 
    114 #define COMPLEXITY_W_SUBBAND_EQ 2.5f
    115 #define COMPLEXITY_W_FIR 0.4f
    116 #define COMPLEXITY_W_IIR 5.0f
    117 #define COMPLEXITY_W_MOD_TIME 1.0f
    118 #define COMPLEXITY_W_MOD_SUBBAND 2.0f
    119 #define COMPLEXITY_W_LAP 2.0f
    120 #define COMPLEXITY_W_SHAPE 6.0f
    121 #define COMPLEXITY_W_SPLINE 5.0f
    122 #define COMPLEXITY_W_LINEAR 2.5f
    123 #define COMPLEXITY_W_PARAM_DRC_FILT 5.0f
    124 #define COMPLEXITY_W_PARAM_DRC_SUBBAND 5.0f
    125 #define COMPLEXITY_W_PARAM_LIM_FILT 4.5f
    126 #define COMPLEXITY_W_PARAM_DRC_ATTACK 136.0f
    127 
    128 #define LEFT_SIDE 0
    129 #define RIGHT_SIDE 1
    130 
    131 #define CHARACTERISTIC_SIGMOID 0
    132 #define CHARACTERISTIC_NODES 1
    133 #define CHARACTERISTIC_PASS_THRU 2
    134 
    135 #define GAINFORMAT_QMF32 0x1
    136 #define GAINFORMAT_QMFHYBRID39 0x2
    137 #define GAINFORMAT_QMF64 0x3
    138 #define GAINFORMAT_QMFHYBRID71 0x4
    139 #define GAINFORMAT_QMF128 0x5
    140 #define GAINFORMAT_QMFHYBRID135 0x6
    141 #define GAINFORMAT_UNIFORM 0x7
    142 
    143 #define DRC_INPUT_LOUDNESS_TARGET (-31.0f)
    144 
    145 #define SHAPE_FILTER_TYPE_OFF 0
    146 #define SHAPE_FILTER_TYPE_LF_CUT 1
    147 #define SHAPE_FILTER_TYPE_LF_BOOST 2
    148 #define SHAPE_FILTER_TYPE_HF_CUT 3
    149 #define SHAPE_FILTER_TYPE_HF_BOOST 4
    150 
    151 #define SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE 1583.8931924611f
    152 
    153 typedef struct {
    154   WORD32 type;
    155   FLOAT32 gain_offset;
    156   FLOAT32 y1_bound;
    157   FLOAT32 warped_gain_max;
    158   FLOAT32 factor;
    159   FLOAT32 coeff_sum;
    160   FLOAT32 partial_coeff_sum;
    161   FLOAT32 g_norm;
    162   FLOAT32 a1;
    163   FLOAT32 a2;
    164   FLOAT32 b1;
    165   FLOAT32 b2;
    166   FLOAT32 audio_in_state_1[MAX_CHANNEL_COUNT];
    167   FLOAT32 audio_in_state_2[MAX_CHANNEL_COUNT];
    168   FLOAT32 audio_out_state_1[MAX_CHANNEL_COUNT];
    169   FLOAT32 audio_out_state_2[MAX_CHANNEL_COUNT];
    170 } ia_shape_filter_struct;
    171 
    172 typedef struct {
    173   WORD32 shape_flter_block_flag;
    174   FLOAT32 drc_gain_last;
    175   ia_shape_filter_struct shape_filter[4];
    176 } shape_filter_block;
    177 
    178 typedef struct {
    179   WORD32 level_estim_k_weighting_type;
    180   WORD32 level_estim_integration_time_present;
    181   WORD32 level_estim_integration_time;
    182   WORD32 drc_curve_definition_type;
    183   WORD32 drc_characteristic;
    184   WORD32 node_count;
    185   WORD32 node_level[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
    186   WORD32 node_gain[PARAM_DRC_TYPE_FF_NODE_COUNT_MAX];
    187   WORD32 drc_gain_smooth_parameters_present;
    188   WORD32 gain_smooth_attack_time_slow;
    189   WORD32 gain_smooth_release_time_slow;
    190   WORD32 gain_smooth_time_fast_present;
    191   WORD32 gain_smooth_attack_time_fast;
    192   WORD32 gain_smooth_release_time_fast;
    193   WORD32 gain_smooth_threshold_present;
    194   WORD32 gain_smooth_attack_threshold;
    195   WORD32 gain_smooth_rel_threshold;
    196   WORD32 gain_smooth_hold_off_count_present;
    197   WORD32 gain_smooth_hold_off;
    198 
    199   WORD32 disable_paramteric_drc;
    200 } ia_parametric_drc_type_feed_forward_struct;
    201 
    202 typedef struct {
    203   WORD32 parametric_lim_threshold_present;
    204   FLOAT32 parametric_lim_threshold;
    205   WORD32 parametric_lim_attack;
    206   WORD32 parametric_lim_release_present;
    207   WORD32 parametric_lim_release;
    208   WORD32 drc_characteristic;
    209 
    210   WORD32 disable_paramteric_drc;
    211 } ia_parametric_drc_lim_struct;
    212 
    213 typedef struct {
    214   WORD32 parametric_drc_id;
    215   WORD32 parametric_drc_look_ahead_flag;
    216   WORD32 parametric_drc_look_ahead;
    217   WORD32 parametric_drc_preset_id_present;
    218   WORD32 parametric_drc_preset_id;
    219   WORD32 parametric_drc_type;
    220   WORD32 len_bit_size;
    221   ia_parametric_drc_type_feed_forward_struct
    222       str_parametric_drc_type_feed_forward;
    223   ia_parametric_drc_lim_struct parametric_drc_lim;
    224 
    225   WORD32 drc_characteristic;
    226   WORD32 disable_paramteric_drc;
    227 } ia_parametric_drc_instructions_struct;
    228 
    229 typedef struct {
    230   WORD32 parametric_drc_id;
    231   WORD32 side_chain_config_type;
    232   WORD32 downmix_id;
    233   WORD32 level_estim_channel_weight_format;
    234   FLOAT32 level_estim_ch_weight[MAX_CHANNEL_COUNT];
    235   WORD32 drc_input_loudness_present;
    236   FLOAT32 drc_input_loudness;
    237 
    238   WORD32 ch_count_from_dwnmix_id;
    239 } ia_parametric_drc_gain_set_params_struct;
    240 
    241 typedef struct {
    242   WORD32 drc_location;
    243   WORD32 parametric_drc_frame_size_format;
    244   WORD32 parametric_drc_frame_size;
    245   WORD32 parametric_drc_delay_max_present;
    246   WORD32 parametric_drc_delay_max;
    247   WORD32 reset_parametric_drc;
    248   WORD32 parametric_drc_gain_set_count;
    249   ia_parametric_drc_gain_set_params_struct
    250       str_parametric_drc_gain_set_params[SEQUENCE_COUNT_MAX];
    251 } ia_drc_coeff_parametric_drc_struct;
    252 
    253 typedef struct {
    254   WORD32 base_channel_count;
    255   WORD32 layout_signaling_present;
    256   WORD32 defined_layout;
    257   WORD32 speaker_position[SPEAKER_POS_COUNT_MAX];
    258 } ia_channel_layout_struct;
    259 
    260 typedef struct {
    261   WORD32 downmix_id;
    262   WORD32 target_channel_count;
    263   WORD32 target_layout;
    264   WORD32 downmix_coefficients_present;
    265   FLOAT32 downmix_coefficient[DOWNMIX_COEFF_COUNT_MAX];
    266 } ia_downmix_instructions_struct;
    267 
    268 typedef struct {
    269   WORD32 gain_seq_idx;
    270   WORD32 drc_characteristic;
    271   WORD32 drc_characteristic_present;
    272   WORD32 drc_characteristic_format_is_cicp;
    273   WORD32 drc_characteristic_left_index;
    274   WORD32 drc_characteristic_right_index;
    275   WORD32 crossover_freq_idx;
    276   WORD32 start_subband_index;
    277 } ia_gain_params_struct;
    278 
    279 typedef struct {
    280   WORD32 ducking_scaling_flag;
    281   FLOAT32 ducking_scaling;
    282   FLOAT32 ducking_scaling_quantized;
    283 } ia_ducking_modifiers_struct;
    284 
    285 typedef struct {
    286   WORD32 target_characteristic_left_present[DRC_BAND_COUNT_MAX];
    287   WORD32 target_characteristic_left_index[DRC_BAND_COUNT_MAX];
    288   WORD32 target_characteristic_right_present[DRC_BAND_COUNT_MAX];
    289   WORD32 target_characteristic_right_index[DRC_BAND_COUNT_MAX];
    290   WORD32 shape_filter_flag;
    291   WORD32 shape_filter_idx;
    292   WORD32 gain_scaling_flag[BAND_COUNT_MAX];
    293   FLOAT32 attn_scaling[BAND_COUNT_MAX];
    294   FLOAT32 ampl_scaling[BAND_COUNT_MAX];
    295   WORD32 gain_offset_flag[BAND_COUNT_MAX];
    296   FLOAT32 gain_offset[BAND_COUNT_MAX];
    297 } ia_gain_modifiers_struct;
    298 
    299 typedef struct {
    300   WORD32 gain_coding_profile;
    301   WORD32 gain_interpolation_type;
    302   WORD32 full_frame;
    303   WORD32 time_alignment;
    304   WORD32 time_delt_min_flag;
    305   WORD32 time_delt_min_val;
    306   WORD32 band_count;
    307   WORD32 drc_band_type;
    308   ia_gain_params_struct gain_params[BAND_COUNT_MAX];
    309 
    310   WORD32 num_gain_max_values;
    311   ia_tables_struct str_tables;
    312 } ia_gain_set_params_struct;
    313 
    314 #define SPLIT_CHARACTERISTIC_NODE_COUNT_MAX 4
    315 typedef struct {
    316   WORD32 characteristic_format;
    317   FLOAT32 in_out_ratio;
    318   FLOAT32 gain;
    319   FLOAT32 exp;
    320   WORD32 flip_sign;
    321   WORD32 characteristic_node_count;
    322   FLOAT32 node_level[SPLIT_CHARACTERISTIC_NODE_COUNT_MAX + 1];
    323   FLOAT32 node_gain[SPLIT_CHARACTERISTIC_NODE_COUNT_MAX + 1];
    324 } ia_split_drc_characteristic_struct;
    325 
    326 typedef struct {
    327   WORD32 corner_freq_index;
    328   WORD32 filter_strength_index;
    329 } ia_shape_filter_params_struct;
    330 
    331 typedef struct {
    332   WORD32 lf_cut_filter_present;
    333   ia_shape_filter_params_struct str_lf_cut_params;
    334   WORD32 lf_boost_filter_present;
    335   ia_shape_filter_params_struct str_lf_boost_params;
    336   WORD32 hf_cut_filter_present;
    337   ia_shape_filter_params_struct str_hfCutParams;
    338   WORD32 hf_boost_filter_present;
    339   ia_shape_filter_params_struct str_hf_boost_params;
    340 } ia_shape_filter_block_params_struct;
    341 
    342 typedef struct {
    343   WORD32 drc_location;
    344   WORD32 drc_characteristic;
    345 } ia_drc_coefficients_basic_struct;
    346 
    347 typedef struct {
    348   WORD32 version;
    349   WORD32 drc_location;
    350   WORD32 drc_frame_size_present;
    351   WORD32 drc_frame_size;
    352   WORD32 gain_set_count;
    353   ia_gain_set_params_struct gain_set_params[GAIN_SET_COUNT_MAX];
    354   WORD32 drc_characteristic_left_present;
    355   WORD32 characteristic_left_count;
    356   ia_split_drc_characteristic_struct
    357       str_split_characteristic_left[SPLIT_CHARACTERISTIC_COUNT_MAX];
    358   WORD32 drc_characteristic_right_present;
    359   WORD32 characteristic_right_count;
    360   ia_split_drc_characteristic_struct
    361       str_split_characteristic_right[SPLIT_CHARACTERISTIC_COUNT_MAX];
    362   WORD32 shape_filters_present;
    363   WORD32 shape_num_filter;
    364   ia_shape_filter_block_params_struct
    365       str_shape_filter_block_params[SHAPE_FILTER_COUNT_MAX + 1];
    366   WORD32 gain_sequence_count;
    367   WORD32 gain_set_params_index_for_gain_sequence[SEQUENCE_COUNT_MAX];
    368   WORD32 gain_set_count_plus;
    369 
    370 } ia_uni_drc_coeffs_struct;
    371 
    372 typedef struct {
    373   WORD32 drc_set_id;
    374   WORD32 drc_location;
    375   WORD32 dwnmix_id_count;
    376   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
    377   WORD32 drc_set_effect;
    378   WORD32 limiter_peak_target_present;
    379   FLOAT32 limiter_peak_target;
    380   WORD32 drc_set_target_loudness_present;
    381   WORD32 drc_set_target_loudness_value_upper;
    382   WORD32 drc_set_target_loudness_value_lower_present;
    383   WORD32 drc_set_target_loudness_value_lower;
    384 } ia_drc_instructions_basic_struct;
    385 
    386 typedef struct {
    387   WORD32 drc_set_id;
    388   WORD32 drc_set_complexity_level;
    389   WORD32 requires_eq;
    390   WORD32 drc_apply_to_dwnmix;
    391   WORD32 drc_location;
    392   WORD32 dwnmix_id_count;
    393   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
    394   WORD32 depends_on_drc_set_present;
    395   WORD32 depends_on_drc_set;
    396   WORD32 no_independent_use;
    397   WORD32 drc_set_effect;
    398   WORD32 gain_set_index[MAX_CHANNEL_COUNT];
    399   ia_gain_modifiers_struct
    400       str_gain_modifiers_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
    401   ia_ducking_modifiers_struct
    402       str_ducking_modifiers_for_channel[MAX_CHANNEL_COUNT];
    403   WORD32 limiter_peak_target_present;
    404   FLOAT32 limiter_peak_target;
    405   WORD32 drc_set_target_loudness_present;
    406   WORD32 drc_set_target_loudness_value_upper;
    407   WORD32 drc_set_target_loudness_value_lower_present;
    408   WORD32 drc_set_target_loudness_value_lower;
    409 
    410   WORD32 audio_num_chan;
    411   WORD32 num_drc_ch_groups;
    412   WORD32 gain_set_index_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
    413   WORD32 band_count_of_ch_group[CHANNEL_GROUP_COUNT_MAX];
    414   WORD32 gain_interpolation_type_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
    415   WORD32 time_delta_min_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
    416   WORD32 time_alignment_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
    417   ia_ducking_modifiers_struct
    418       str_ducking_modifiers_for_channel_group[CHANNEL_GROUP_COUNT_MAX];
    419   WORD32 channel_group_of_ch[MAX_CHANNEL_COUNT];
    420   WORD32 num_chan_per_ch_group[CHANNEL_GROUP_COUNT_MAX];
    421   WORD32 gain_element_count;
    422   WORD32 multiband_audio_sig_count;
    423   WORD32 ch_group_parametric_drc_flag[CHANNEL_GROUP_COUNT_MAX];
    424   WORD32 gain_set_idx_of_ch_group_parametric_drc[CHANNEL_GROUP_COUNT_MAX];
    425   WORD32 parametric_drc_look_ahead_samples[CHANNEL_GROUP_COUNT_MAX];
    426   WORD32 parametric_drc_look_ahead_samples_max;
    427 } ia_drc_instructions_struct;
    428 
    429 typedef struct {
    430   WORD32 method_def;
    431   FLOAT32 method_val;
    432   WORD32 measurement_system;
    433   WORD32 reliability; /* Parsed but unused */
    434 } ia_loudness_measure_struct;
    435 
    436 typedef struct {
    437   WORD32 drc_set_id;
    438   WORD32 eq_set_id;
    439   WORD32 downmix_id;
    440   WORD32 sample_peak_level_present;
    441   FLOAT32 sample_peak_level;
    442   WORD32 true_peak_level_present;
    443   FLOAT32 true_peak_level;
    444   WORD32 true_peak_level_measurement_system; /* Parsed but unused */
    445   WORD32 true_peak_level_reliability;        /* Parsed but unused */
    446   WORD32 measurement_count;
    447   ia_loudness_measure_struct loudness_measure[MEASUREMENT_COUNT_MAX];
    448 } ia_loudness_info_struct;
    449 
    450 typedef struct {
    451   WORD32 loud_eq_set_id;
    452   WORD32 drc_location;
    453   WORD32 dwnmix_id_count;
    454   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
    455   WORD32 drc_set_id_count;
    456   WORD32 drc_set_id[DRC_SET_ID_COUNT_MAX];
    457   WORD32 eq_set_id_count;
    458   WORD32 eq_set_id[EQ_SET_ID_COUNT_MAX];
    459   WORD32 loudness_after_drc;                            /* Parsed but unused */
    460   WORD32 loudness_after_eq;                             /* Parsed but unused */
    461   WORD32 loud_eq_gain_sequence_count;                   /* Parsed but unused */
    462   WORD32 gain_seq_idx[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    463   WORD32 drc_characteristic_format_is_cicp
    464       [LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    465   WORD32 drc_characteristic[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but
    466                                                                  unused */
    467   WORD32 drc_characteristic_left_index
    468       [LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    469   WORD32 drc_characteristic_right_index
    470       [LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    471   WORD32 frequency_range_index[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but
    472                                                                     unused */
    473   FLOAT32
    474   loud_eq_scaling[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    475   FLOAT32
    476   loud_eq_offset[LOUD_EQ_GAIN_SEQUENCE_COUNT_MAX]; /* Parsed but unused */
    477 } ia_loud_eq_instructions_struct;
    478 
    479 typedef struct {
    480   WORD32 filt_ele_idx;
    481   WORD32 filt_ele_gain_flag;
    482   FLOAT32 filt_ele_gain;
    483 } ia_filt_ele_struct;
    484 
    485 typedef struct {
    486   WORD32 filter_element_count;
    487   ia_filt_ele_struct str_filter_element[FILTER_ELEMENT_COUNT_MAX];
    488 } ia_filt_block_struct;
    489 
    490 typedef struct {
    491   WORD32 eq_filter_format;
    492   WORD32 bs_real_zero_radius_one_count;
    493   WORD32 real_zero_count;
    494   WORD32 generic_zero_count;
    495   WORD32 real_pole_count;
    496   WORD32 cmplx_pole_count;
    497   WORD32 zero_sign[REAL_ZERO_RADIUS_ONE_COUNT_MAX];
    498   FLOAT32 real_zero_radius[REAL_ZERO_COUNT_MAX];
    499   FLOAT32 generic_zero_radius[COMPLEX_ZERO_COUNT_MAX];
    500   FLOAT32 generic_zero_angle[COMPLEX_ZERO_COUNT_MAX];
    501   FLOAT32 real_pole_radius[REAL_POLE_COUNT_MAX];
    502   FLOAT32 complex_pole_radius[COMPLEX_POLE_COUNT_MAX];
    503   FLOAT32 complex_pole_angle[COMPLEX_POLE_COUNT_MAX];
    504   WORD32 fir_filt_order;
    505   WORD32 fir_symmetry;
    506   FLOAT32 fir_coeff[FIR_ORDER_MAX / 2];
    507 } ia_unique_td_filt_element;
    508 
    509 typedef struct {
    510   WORD32 num_eq_nodes;
    511   FLOAT32 eq_slope[EQ_NODE_COUNT_MAX];
    512   WORD32 eq_freq_delta[EQ_NODE_COUNT_MAX];
    513   FLOAT32 eq_gain_initial;
    514   FLOAT32 eq_gain_delta[EQ_NODE_COUNT_MAX];
    515 } ia_eq_subband_gain_spline_struct;
    516 
    517 typedef struct {
    518   FLOAT32 eq_subband_gain[EQ_SUBBAND_GAIN_COUNT_MAX];
    519 } ia_eq_subband_gain_vector;
    520 
    521 typedef struct {
    522   WORD32 eq_delay_max_present;
    523   WORD32 eq_delay_max;
    524   WORD32 unique_filter_block_count;
    525   ia_filt_block_struct str_filter_block[FILTER_BLOCK_COUNT_MAX];
    526   WORD32 unique_td_filter_element_count;
    527   ia_unique_td_filt_element unique_td_filt_ele[FILTER_ELEMENT_COUNT_MAX];
    528   WORD32 unique_eq_subband_gains_count;
    529   WORD32 eq_subband_gain_representation;
    530   WORD32 eq_subband_gain_format;
    531   WORD32 eq_subband_gain_count;
    532   ia_eq_subband_gain_spline_struct
    533       str_eq_subband_gain_spline[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
    534   ia_eq_subband_gain_vector
    535       str_eq_subband_gain_vector[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
    536 } ia_eq_coeff_struct;
    537 
    538 typedef struct {
    539   WORD32 filter_block_count;
    540   WORD32 filter_block_index[EQ_FILTER_BLOCK_COUNT_MAX];
    541 } ia_filter_block_refs_struct;
    542 
    543 typedef struct {
    544   WORD32 eq_cascade_gain_present[EQ_CHANNEL_GROUP_COUNT_MAX];
    545   FLOAT32 eq_cascade_gain[EQ_CHANNEL_GROUP_COUNT_MAX];
    546   ia_filter_block_refs_struct str_filter_block_refs[EQ_CHANNEL_GROUP_COUNT_MAX];
    547   WORD32 eq_phase_alignment_present;
    548   WORD32 eq_phase_alignment[EQ_CHANNEL_GROUP_COUNT_MAX]
    549                            [EQ_CHANNEL_GROUP_COUNT_MAX];
    550 } ia_td_filter_cascade_struct;
    551 
    552 typedef struct {
    553   WORD32 eq_set_id;
    554   WORD32 eq_set_complexity_level;
    555   WORD32 dwnmix_id_count;
    556   WORD32 downmix_id[DOWNMIX_ID_COUNT_MAX];
    557   WORD32 eq_apply_to_downmix;
    558   WORD32 drc_set_id_count;
    559   WORD32 drc_set_id[DRC_SET_ID_COUNT_MAX];
    560   WORD32 eq_set_purpose;
    561   WORD32 depends_on_eq_set_present;
    562   WORD32 depends_on_eq_set;
    563   WORD32 no_independent_eq_use;
    564   WORD32 eq_channel_count;
    565   WORD32 eq_ch_group_count;
    566   WORD32 eq_ch_group_of_channel[MAX_CHANNEL_COUNT];
    567   WORD32 td_filter_cascade_present;
    568   ia_td_filter_cascade_struct str_td_filter_cascade;
    569   WORD32 subband_gains_present;
    570   WORD32 subband_gains_index[EQ_CHANNEL_GROUP_COUNT_MAX];
    571   WORD32 eq_transition_duration_present;
    572   WORD32 eq_transition_duration;
    573 } ia_eq_instructions_struct;
    574 
    575 typedef struct {
    576   WORD32 drc_config_ext_type[EXT_COUNT_MAX];
    577   WORD32 ext_bit_size[EXT_COUNT_MAX - 1];
    578 
    579   WORD32 parametric_drc_present;
    580   ia_drc_coeff_parametric_drc_struct str_drc_coeff_param_drc;
    581   WORD32 parametric_drc_instructions_count;
    582   ia_parametric_drc_instructions_struct
    583       str_parametric_drc_instructions[PARAM_DRC_INSTRUCTIONS_COUNT_MAX];
    584   WORD32 drc_extension_v1_present;
    585   WORD32 loud_eq_instructions_flag;
    586   WORD32 loud_eq_instructions_count;
    587   ia_loud_eq_instructions_struct
    588       loud_eq_instructions[LOUD_EQ_INSTRUCTIONS_COUNT_MAX];
    589   WORD32 eq_flag;
    590   ia_eq_coeff_struct str_eq_coeff;
    591   WORD32 eq_instructions_count;
    592   ia_eq_instructions_struct str_eq_instructions[EQ_INSTRUCTIONS_COUNT_MAX];
    593 } ia_drc_config_ext;
    594 
    595 typedef struct ia_drc_config {
    596   WORD32 sample_rate_present;
    597   WORD32 sampling_rate;
    598   WORD32 dwnmix_instructions_count;
    599   WORD32 drc_coefficients_drc_count;
    600   WORD32 drc_instructions_uni_drc_count;
    601   WORD32 drc_instructions_count_plus;
    602   WORD32 drc_description_basic_present;
    603   WORD32 drc_coefficients_basic_count;
    604   WORD32 drc_instructions_basic_count;
    605   WORD32 drc_config_ext_present;
    606   WORD32 apply_drc;
    607   ia_drc_config_ext str_drc_config_ext;
    608   ia_drc_coefficients_basic_struct
    609       str_drc_coefficients_basic[DRC_COEFF_COUNT_MAX];
    610   ia_drc_instructions_basic_struct
    611       str_drc_instructions_basic[DRC_INSTRUCTIONS_COUNT_MAX];
    612   ia_uni_drc_coeffs_struct
    613       str_p_loc_drc_coefficients_uni_drc[DRC_COEFF_COUNT_MAX];
    614   ia_drc_instructions_struct
    615       str_drc_instruction_str[DRC_INSTRUCTIONS_COUNT_MAX];
    616   ia_channel_layout_struct channel_layout;
    617   ia_downmix_instructions_struct
    618       dwnmix_instructions[DOWNMIX_INSTRUCTION_COUNT_MAX];
    619 } ia_drc_config;
    620 
    621 typedef struct {
    622   WORD32 loudness_info_set_ext_type[EXT_COUNT_MAX];
    623   WORD32 ext_bit_size[EXT_COUNT_MAX - 1];
    624 } ia_loudness_info_set_ext_struct;
    625 
    626 typedef struct ia_drc_loudness_info_set_struct {
    627   WORD32 loudness_info_album_count;
    628   WORD32 loudness_info_count;
    629   WORD32 loudness_info_set_ext_present;
    630   ia_loudness_info_struct str_loudness_info_album[LOUDNESS_INFO_COUNT_MAX];
    631   ia_loudness_info_struct loudness_info[LOUDNESS_INFO_COUNT_MAX];
    632   ia_loudness_info_set_ext_struct str_loudness_info_set_ext;
    633 } ia_drc_loudness_info_set_struct;
    634 
    635 typedef struct {
    636   FLOAT32 loc_db_gain;
    637   FLOAT32 slope;
    638   WORD32 time;
    639 } ia_node_struct;
    640 
    641 typedef struct {
    642   WORD32 drc_gain_coding_mode;
    643   WORD32 num_nodes;
    644   ia_node_struct str_node[NODE_COUNT_MAX];
    645 } ia_spline_nodes_struct;
    646 
    647 typedef struct {
    648   ia_spline_nodes_struct str_spline_nodes[1];
    649 } ia_drc_gain_sequence_struct;
    650 
    651 typedef struct {
    652   WORD32 uni_drc_gain_ext_type[EXT_COUNT_MAX];
    653   WORD32 ext_bit_size[EXT_COUNT_MAX - 1];
    654 } ia_uni_drc_gain_ext_struct;
    655 
    656 typedef struct ia_drc_gain_struct {
    657   WORD32 num_drc_gain_sequences;
    658   ia_drc_gain_sequence_struct drc_gain_sequence[SEQUENCE_COUNT_MAX];
    659   WORD32 uni_drc_gain_ext_flag;
    660   ia_uni_drc_gain_ext_struct uni_drc_gain_ext;
    661 } ia_drc_gain_struct;
    662 
    663 typedef struct {
    664   WORD32 delta_tmin_default;
    665   WORD32 drc_frame_size;
    666   WORD32 num_gain_values_max_default;
    667   WORD32 delay_mode;
    668   WORD32 lfe_channel_map_count;
    669   WORD32 lfe_channel_map[MAX_CHANNEL_COUNT];
    670 } ia_drc_params_bs_dec_struct;
    671 
    672 typedef struct ia_drc_bits_dec_struct {
    673   ia_tables_struct tables_default;
    674   ia_drc_params_bs_dec_struct ia_drc_params_struct;
    675 
    676 } ia_drc_bits_dec_struct;
    677 
    678 #ifdef __cplusplus
    679 }
    680 #endif
    681 #endif
    682