xref: /aosp_15_r20/external/libxaac/encoder/drc_src/impd_drc_uni_drc.h (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
1 /******************************************************************************
2  *                                                                            *
3  * Copyright (C) 2023 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 
21 #pragma once
22 /* Defines for bitstream payload */
23 #define METHOD_DEFINITION_UNKNOWN_OTHER 0
24 #define METHOD_DEFINITION_PROGRAM_LOUDNESS 1
25 #define METHOD_DEFINITION_ANCHOR_LOUDNESS 2
26 #define METHOD_DEFINITION_MAX_OF_LOUDNESS_RANGE 3
27 #define METHOD_DEFINITION_MOMENTARY_LOUDNESS_MAX 4
28 #define METHOD_DEFINITION_SHORT_TERM_LOUDNESS_MAX 5
29 #define METHOD_DEFINITION_LOUDNESS_RANGE 6
30 #define METHOD_DEFINITION_MIXING_LEVEL 7
31 #define METHOD_DEFINITION_ROOM_TYPE 8
32 #define METHOD_DEFINITION_SHORT_TERM_LOUDNESS 9
33 
34 #define MEASUREMENT_SYSTEM_BS_1770_3 2
35 
36 #define EFFECT_BIT_NONE (-1) /* this effect bit is virtual */
37 #define EFFECT_BIT_DUCK_OTHER 0x0400
38 #define EFFECT_BIT_DUCK_SELF 0x0800
39 
40 #define GAIN_CODING_PROFILE_REGULAR 0
41 #define GAIN_CODING_PROFILE_FADING 1
42 #define GAIN_CODING_PROFILE_CLIPPING 2
43 #define GAIN_CODING_PROFILE_CONSTANT 3
44 
45 #define GAIN_INTERPOLATION_TYPE_SPLINE 0
46 #define GAIN_INTERPOLATION_TYPE_LINEAR 1
47 
48 #define LOUDNESS_NORMALIZATION_GAIN_MAX_DEFAULT 1000 /* infinity as default */
49 #define GAIN_SET_COUNT_MAX 8                         /* reduced size */
50 
51 #define LEFT_SIDE 0
52 #define RIGHT_SIDE 1
53 #define SPLIT_CHARACTERISTIC_COUNT_MAX 8
54 #define SPLIT_CHARACTERISTIC_MAX_NODE_COUNT 4 /* one side of characteristic */
55 
56 #define GAINFORMAT_QMF32 0x1
57 #define GAINFORMAT_QMFHYBRID39 0x2
58 #define GAINFORMAT_QMF64 0x3
59 #define GAINFORMAT_QMFHYBRID71 0x4
60 #define GAINFORMAT_QMF128 0x5
61 #define GAINFORMAT_QMFHYBRID135 0x6
62 #define GAINFORMAT_UNIFORM 0x7
63 
64 #define DRC_INPUT_LOUDNESS_TARGET (-31.0f) /* dB */
65 
66 #define SHAPE_FILTER_COUNT_MAX 8
67 
68 #define SHAPE_FILTER_DRC_GAIN_MAX_MINUS_ONE 1583.8931924611f /* 10^3.2 - 1 */
69 
70 #define DOWNMIX_INSTRUCTIONS_COUNT_MAX 8       /* reduced size */
71 #define DRC_COEFFICIENTS_UNIDRC_V1_COUNT_MAX 2 /* reduced size */
72 #define DRC_INSTRUCTIONS_UNIDRC_V1_COUNT_MAX 8 /* reduced size */
73 #define SPLIT_CHARACTERISTIC_COUNT_MAX 8       /* reduced size */
74 #define SHAPE_FILTER_COUNT_MAX 8               /* reduced size */
75 #define ADDITIONAL_DOWNMIX_ID_COUNT_MAX MAX_ADDITIONAL_DOWNMIX_ID
76 #define MAX_TARGET_LAYOUT_COUNT 127
77 #define ADDITIONAL_DRC_SET_ID_COUNT_MAX 16
78 #define ADDITIONAL_EQ_SET_ID_COUNT_MAX 8
79 #define LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT 4
80 #define FILTER_ELEMENT_COUNT_MAX 16 /* reduced size */
81 #define REAL_ZERO_RADIUS_ONE_COUNT_MAX 14
82 #define REAL_ZERO_COUNT_MAX 64
83 #define COMPLEX_ZERO_COUNT_MAX 64
84 #define REAL_POLE_COUNT_MAX 16
85 #define COMPLEX_POLE_COUNT_MAX 16
86 #define FIR_ORDER_MAX 128
87 #define EQ_MAX_NODE_COUNT 33
88 #define EQ_SUBBAND_GAIN_COUNT_MAX 135
89 #define UNIQUE_SUBBAND_GAIN_COUNT_MAX 16 /* reduced size */
90 #define FILTER_BLOCK_COUNT_MAX 16
91 #define FILTER_ELEMENT_COUNT_MAX 16      /* reduced size */
92 #define UNIQUE_SUBBAND_GAINS_COUNT_MAX 8 /* reduced size */
93 #define EQ_MAX_CHANNEL_GROUP_COUNT 4     /* reduced size */
94 #define EQ_FILTER_BLOCK_COUNT_MAX 4      /* reduced size */
95 #define LOUD_EQ_INSTRUCTIONS_COUNT_MAX 8 /* reduced size */
96 #define EQ_INSTRUCTIONS_COUNT_MAX 8
97 
98 #define DRC_COMPLEXITY_LEVEL_MAX 15
99 #define EQ_COMPLEXITY_LEVEL_MAX 15
100 #define COMPLEXITY_W_SUBBAND_EQ 2.5f
101 #define COMPLEXITY_W_FIR 0.4f
102 #define COMPLEXITY_W_IIR 5.0f
103 #define COMPLEXITY_W_MOD_TIME 1.0f
104 #define COMPLEXITY_W_MOD_SUBBAND 2.0f
105 #define COMPLEXITY_W_LAP 2.0f
106 #define COMPLEXITY_W_SHAPE 6.0f
107 #define COMPLEXITY_W_SPLINE 5.0f
108 #define COMPLEXITY_W_LINEAR 2.5f
109 #define COMPLEXITY_W_PARAM_DRC_FILT 5.0f
110 #define COMPLEXITY_W_PARAM_DRC_SUBBAND 5.0f
111 #define COMPLEXITY_W_PARAM_LIM_FILT 4.5f
112 #define COMPLEXITY_W_PARAM_DRC_ATTACK 136.0f
113 
114 #define MAX_DRC_SET_ID (63)
115 #define MAX_DRC_LOCATION (4)
116 #define MIN_DRC_TARGET_LOUDNESS (-63)
117 #define MAX_ATTENUATION_SCALING (1.875f)
118 #define MAX_AMPLIFICATION_SCALING (1.875f)
119 #define MIN_DRC_GAIN_OFFSET (-8.0f)
120 #define MAX_DRC_GAIN_OFFSET (8.0f)
121 #define MIN_LIMITER_PEAK_TARGET (-31.875f)
122 #define MAX_GAIN_CODING_PROFILE (3)
123 #define MAX_DRC_CHARACTERISTIC_VALUE (11)
124 #define MAX_CROSSOVER_FREQ_INDEX (15)
125 #define MIN_SAMPLE_PEAK_LEVEL (-107.0f)
126 #define MAX_SAMPLE_PEAK_LEVEL (20.0f)
127 #define MIN_TRUE_PEAK_LEVEL (-107.0f)
128 #define MAX_TRUE_PEAK_LEVEL (20.0f)
129 #define MAX_MEASUREMENT_SYSTEM_TYPE (11)
130 #define MAX_RELIABILITY_TYPE (3)
131 #define MAX_METHOD_DEFINITION_TYPE (9)
132 #define MIN_METHOD_VALUE (-116.0f)
133 #define MAX_METHOD_VALUE (121.0f)
134 #define MAX_FLT_VAL_DB (770.6367883810890080451095799195f)
135 #define DEFAULT_METHOD_VALUE (-31.0f)
136 #define DEFAULT_SAMPLE_PEAK_VALUE (-31.0f)
137 
138 typedef struct {
139   WORD32 level_estim_k_weighting_type;
140   WORD32 level_estim_integration_time_present;
141   WORD32 level_estim_integration_time;
142   WORD32 drc_curve_definition_type;
143   WORD32 drc_characteristic;
144   WORD32 node_count;
145   WORD32 node_level[MAX_PARAM_DRC_TYPE_FF_NODE_COUNT];
146   WORD32 node_gain[MAX_PARAM_DRC_TYPE_FF_NODE_COUNT];
147   WORD32 drc_gain_smooth_parameters_present;
148   WORD32 gain_smooth_attack_time_slow;
149   WORD32 gain_smooth_release_time_slow;
150   WORD32 gain_smooth_time_fast_present;
151   WORD32 gain_smooth_attack_time_fast;
152   WORD32 gain_smooth_release_time_fast;
153   WORD32 gain_smooth_threshold_present;
154   WORD32 gain_smooth_attack_threshold;
155   WORD32 gain_smooth_release_threshold;
156   WORD32 gain_smooth_hold_off_count_present;
157   WORD32 gain_smooth_hold_off;
158   WORD32 disable_paramtric_drc;
159 } ia_drc_parametric_drc_type_feed_forward_struct;
160 
161 typedef struct {
162   WORD32 parametric_lim_threshold_present;
163   FLOAT32 parametric_lim_threshold;
164   WORD32 parametric_lim_attack;
165   WORD32 parametric_lim_release_present;
166   WORD32 parametric_lim_release;
167   WORD32 drc_characteristic;
168   WORD32 disable_paramtric_drc;
169 } ia_drc_parametric_drc_type_lim_struct;
170 
171 typedef struct {
172   WORD32 parametric_drc_id;
173   WORD32 parametric_drc_look_ahead_present;
174   WORD32 parametric_drc_look_ahead;
175   WORD32 parametric_drc_preset_id_present;
176   WORD32 parametric_drc_preset_id;
177   WORD32 parametric_drc_type;
178   WORD32 len_bit_size;
179   ia_drc_parametric_drc_type_feed_forward_struct str_parametric_drc_type_feed_forward;
180   ia_drc_parametric_drc_type_lim_struct str_parametric_drc_type_lim;
181   WORD32 disable_paramtric_drc;
182 } ia_drc_parametric_drc_instructions_struct;
183 
184 typedef struct {
185   WORD32 parametric_drc_id;
186   WORD32 side_chain_config_type;
187   WORD32 downmix_id;
188   WORD32 level_estim_channel_weight_format;
189   FLOAT32 level_estim_channel_weight[MAX_CHANNEL_COUNT];
190   WORD32 drc_input_loudness_present;
191   FLOAT32 drc_input_loudness;
192 
193   /* derived data */
194   WORD32 channel_count_drom_downmix_id;
195 } ia_drc_parametric_drc_gain_set_params_struct;
196 
197 typedef struct {
198   WORD32 drc_location;
199   WORD32 parametric_drc_frame_size_format;
200   WORD32 parametric_drc_frame_size;
201   WORD32 parametric_drc_delay_max_present;
202   WORD32 parametric_drc_delay_max;
203   WORD32 reset_parametric_drc;
204   WORD32 parametric_drc_gain_set_count;
205   ia_drc_parametric_drc_gain_set_params_struct parametric_drc_gain_set_params[MAX_SEQUENCE_COUNT];
206 } ia_drc_coeff_parametric_drc_struct;
207 
208 typedef struct {
209   WORD32 base_ch_count;
210   WORD32 layout_signaling_present;
211   WORD32 defined_layout;
212   WORD32 speaker_position[MAX_SPEAKER_POS_COUNT];
213 } ia_drc_channel_layout_struct;
214 
215 typedef struct {
216   WORD32 downmix_id;
217   WORD32 target_ch_count;
218   WORD32 target_layout;
219   WORD32 downmix_coefficients_present;
220   FLOAT32 downmix_coeff[MAX_DOWNMIX_COEFF_COUNT];
221 } ia_drc_downmix_instructions_struct;
222 
223 typedef struct {
224   FLOAT32 x;
225   FLOAT32 y;
226 } ia_drc_gain_points_struct;
227 
228 typedef struct {
229   WORD32 gain_sequence_index;
230   WORD32 drc_characteristic_present;
231   WORD32 drc_characteristic_format_is_cicp;
232   WORD32 drc_characteristic;
233   WORD32 drc_characteristic_left_index;
234   WORD32 drc_characteristic_right_index;
235   WORD32 crossover_freq_index;
236   WORD32 start_sub_band_index;
237   WORD32 nb_points;
238   FLOAT32 width;
239   FLOAT32 attack;
240   FLOAT32 decay;
241   ia_drc_gain_points_struct gain_points[MAX_GAIN_POINTS];
242 } ia_drc_gain_params_struct;
243 
244 typedef struct {
245   WORD32 ducking_scaling_present;
246   FLOAT32 ducking_scaling;
247   FLOAT32 ducking_scaling_quantized;
248 } ia_drc_ducking_modifiers_struct;
249 
250 typedef struct {
251   WORD32 target_characteristic_left_present[MAX_BAND_COUNT];
252   WORD32 target_characteristic_left_index[MAX_BAND_COUNT];
253   WORD32 target_characteristic_right_present[MAX_BAND_COUNT];
254   WORD32 target_characteristic_right_index[MAX_BAND_COUNT];
255   WORD32 shape_filter_present;
256   WORD32 shape_filter_index;
257 
258   WORD32 gain_scaling_present[MAX_BAND_COUNT];
259   FLOAT32 attenuation_scaling[MAX_BAND_COUNT];
260   FLOAT32 amplification_scaling[MAX_BAND_COUNT];
261   WORD32 gain_offset_present[MAX_BAND_COUNT];
262   FLOAT32 gain_offset[MAX_BAND_COUNT];
263 
264 } ia_drc_gain_modifiers_struct;
265 
266 typedef struct {
267   WORD32 gain_coding_profile;
268   WORD32 gain_interpolation_type;
269   WORD32 full_frame;
270   WORD32 time_alignment;
271   WORD32 time_delta_min_present;
272   WORD32 delta_tmin;
273   WORD32 band_count;
274   WORD32 drc_band_type;
275   ia_drc_gain_params_struct gain_params[MAX_BAND_COUNT];
276 } ia_drc_gain_set_params_struct;
277 
278 typedef struct {
279   WORD32 characteristic_format;
280   WORD32 bs_gain;
281   WORD32 bs_io_ratio;
282   WORD32 bs_exp;
283   WORD32 flip_sign;
284   WORD32 characteristic_node_count;
285   FLOAT32 node_level[SPLIT_CHARACTERISTIC_MAX_NODE_COUNT + 1];
286   FLOAT32 node_gain[SPLIT_CHARACTERISTIC_MAX_NODE_COUNT + 1];
287 } ia_drc_split_drc_characteristic_struct;
288 
289 typedef struct {
290   WORD32 corner_freq_index;
291   WORD32 filter_strength_index;
292 } ia_drc_shape_filter_params_struct;
293 
294 typedef struct {
295   WORD32 lf_cut_filter_present;
296   ia_drc_shape_filter_params_struct str_lf_cut_params;
297   WORD32 lf_boost_filter_present;
298   ia_drc_shape_filter_params_struct str_lf_boost_params;
299   WORD32 hf_cut_filter_present;
300   ia_drc_shape_filter_params_struct str_hf_cut_params;
301   WORD32 hf_boost_filter_present;
302   ia_drc_shape_filter_params_struct str_hf_boost_params;
303 } ia_drc_shape_filter_block_params_struct;
304 
305 typedef struct {
306   WORD32 drc_location;
307   WORD32 drc_characteristic;
308 } ia_drc_coefficients_basic_struct;
309 
310 typedef struct {
311   WORD32 drc_location;
312   WORD32 drc_frame_size_present;
313   WORD32 drc_frame_size;
314   WORD32 drc_characteristic_left_present;
315   WORD32 characteristic_left_count;
316   ia_drc_split_drc_characteristic_struct
317       str_split_characteristic_left[SPLIT_CHARACTERISTIC_COUNT_MAX + 1];
318   WORD32 drc_characteristic_right_present;
319   WORD32 characteristic_right_count;
320   ia_drc_split_drc_characteristic_struct
321       str_split_characteristic_right[SPLIT_CHARACTERISTIC_COUNT_MAX];
322   WORD32 shape_filters_present;
323   WORD32 shape_filter_count;
324   ia_drc_shape_filter_block_params_struct
325       str_shape_filter_block_params[SHAPE_FILTER_COUNT_MAX + 1];
326   WORD32 gain_sequence_count;
327   WORD32 gain_set_count;
328   ia_drc_gain_set_params_struct str_gain_set_params[GAIN_SET_COUNT_MAX];
329 } ia_drc_coefficients_uni_drc_struct;
330 
331 typedef struct {
332   WORD32 drc_set_id;
333   WORD32 drc_location;
334   WORD32 downmix_id;
335   WORD32 additional_downmix_id_present;
336   WORD32 additional_downmix_id_count;
337   WORD32 additional_downmix_id[MAX_ADDITIONAL_DOWNMIX_ID];
338   WORD32 drc_set_effect;
339   WORD32 limiter_peak_target_present;
340   FLOAT32 limiter_peak_target;
341   WORD32 drc_set_target_loudness_present;
342   WORD32 drc_set_target_loudness_value_upper;
343   WORD32 drc_set_target_loudness_value_lower_present;
344   WORD32 drc_set_target_loudness_value_lower;
345 } ia_drc_instructions_basic_struct;
346 
347 typedef struct {
348   WORD32 drc_set_id;
349   WORD32 drc_set_complexity_level;
350   WORD32 drc_apply_to_downmix;
351   WORD32 requires_eq;
352   WORD32 downmix_id_present;
353   WORD32 drc_location;
354   WORD32 downmix_id;
355   WORD32 additional_downmix_id_present;
356   WORD32 additional_downmix_id_count;
357   WORD32 additional_downmix_id[MAX_ADDITIONAL_DOWNMIX_ID];
358   WORD32 depends_on_drc_set_present;
359   WORD32 depends_on_drc_set;
360   WORD32 no_independent_use;
361   WORD32 drc_set_effect;
362   WORD32 gain_set_index[MAX_CHANNEL_COUNT];
363   ia_drc_gain_modifiers_struct str_gain_modifiers[MAX_CHANNEL_GROUP_COUNT];
364   ia_drc_ducking_modifiers_struct str_ducking_modifiers_for_channel[MAX_CHANNEL_COUNT];
365   WORD32 limiter_peak_target_present;
366   FLOAT32 limiter_peak_target;
367   WORD32 drc_set_target_loudness_present;
368   WORD32 drc_set_target_loudness_value_upper;
369   WORD32 drc_set_target_loudness_value_lower_present;
370   WORD32 drc_set_target_loudness_value_lower;
371   WORD32 drc_instructions_type;
372   WORD32 mae_group_id;
373   WORD32 mae_group_preset_id;
374 
375   WORD32 drc_channel_count;
376   WORD32 num_drc_channel_groups;
377   WORD32 gain_set_index_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
378   WORD32 band_count_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
379   WORD32 gain_coding_profile_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
380   WORD32 gain_interpolation_type_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
381   WORD32 time_delta_min_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
382   WORD32 time_alignment_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
383   ia_drc_ducking_modifiers_struct
384       str_ducking_modifiers_for_channel_group[MAX_CHANNEL_GROUP_COUNT];
385   WORD32 channel_group_for_channel[MAX_CHANNEL_COUNT];
386   WORD32 num_channels_per_channel_group[MAX_CHANNEL_GROUP_COUNT];
387   WORD32 gain_element_count;
388   WORD32 multiband_audio_signal_count;
389   WORD32 channel_group_is_parametric_drc[MAX_CHANNEL_GROUP_COUNT];
390   WORD32 gain_set_idx_for_ch_group_parametric_drc[MAX_CHANNEL_GROUP_COUNT];
391 } ia_drc_instructions_uni_drc;
392 
393 typedef struct {
394   WORD32 method_definition;
395   FLOAT32 method_value;
396   WORD32 measurement_system;
397   WORD32 reliability;
398 } ia_drc_loudness_measure_struct;
399 
400 typedef struct {
401   WORD32 drc_set_id;
402   WORD32 eq_set_id;
403   WORD32 downmix_id;
404   WORD32 sample_peak_level_present;
405   FLOAT32 sample_peak_level;
406   WORD32 true_peak_level_present;
407   FLOAT32 true_peak_level;
408   WORD32 true_peak_level_measurement_system;
409   WORD32 true_peak_level_reliability;
410   WORD32 measurement_count;
411   ia_drc_loudness_measure_struct str_loudness_measure[MAX_MEASUREMENT_COUNT];
412   WORD32 loudness_info_type;
413   WORD32 mae_group_id;
414   WORD32 mae_group_preset_id;
415 } ia_drc_loudness_info_struct;
416 
417 typedef struct {
418   WORD32 loud_eq_set_id;
419   WORD32 drc_location;
420   WORD32 downmix_id_present;
421   WORD32 downmix_id;
422   WORD32 additional_downmix_id_present;
423   WORD32 additional_downmix_id_count;
424   WORD32 additional_downmix_id[ADDITIONAL_DOWNMIX_ID_COUNT_MAX];
425   WORD32 drc_set_id_present;
426   WORD32 drc_set_id;
427   WORD32 additional_drc_set_id_present;
428   WORD32 additional_drc_set_id_count;
429   WORD32 additional_drc_set_id[ADDITIONAL_DRC_SET_ID_COUNT_MAX];
430   WORD32 eq_set_id_present;
431   WORD32 eq_set_id;
432   WORD32 additional_eq_set_id_present;
433   WORD32 additional_eq_set_id_count;
434   WORD32 additional_eq_set_id[ADDITIONAL_EQ_SET_ID_COUNT_MAX];
435   WORD32 loudness_after_drc;
436   WORD32 loudness_after_eq;
437   WORD32 loud_eq_gain_sequence_count;
438   WORD32 gain_sequence_index[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
439   WORD32 drc_characteristic_format_is_cicp[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
440   WORD32 drc_characteristic[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
441   WORD32 drc_characteristic_left_index[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
442   WORD32 drc_characteristic_right_index[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
443   WORD32 frequency_range_index[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
444   FLOAT32 loud_eq_scaling[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
445   FLOAT32 loud_eq_offset[LOUD_EQ_GAIN_MAX_SEQUENCE_COUNT];
446 } ia_drc_loud_eq_instructions_struct;
447 
448 typedef struct {
449   WORD32 filter_element_index;
450   WORD32 filter_element_gain_present;
451   FLOAT32 filter_element_gain;
452 } ia_drc_filter_element_struct;
453 
454 typedef struct {
455   WORD32 filter_element_count;
456   ia_drc_filter_element_struct filter_element[FILTER_ELEMENT_COUNT_MAX];
457 } ia_drc_filter_block_struct;
458 
459 typedef struct {
460   WORD32 eq_filter_format;
461   WORD32 real_zero_radius_one_count;
462   WORD32 real_zero_count;
463   WORD32 generic_zero_count;
464   WORD32 real_pole_count;
465   WORD32 complex_pole_count;
466   FLOAT32 zero_sign[REAL_ZERO_RADIUS_ONE_COUNT_MAX];
467   FLOAT32 real_zero_radius[REAL_ZERO_COUNT_MAX];
468   FLOAT32 generic_zero_radius[COMPLEX_ZERO_COUNT_MAX];
469   FLOAT32 generic_zero_angle[COMPLEX_ZERO_COUNT_MAX];
470   FLOAT32 real_pole_radius[REAL_POLE_COUNT_MAX];
471   FLOAT32 complex_pole_radius[COMPLEX_POLE_COUNT_MAX];
472   FLOAT32 complex_pole_angle[COMPLEX_POLE_COUNT_MAX];
473   WORD32 fir_filter_order;
474   WORD32 fir_symmetry;
475   FLOAT32 fir_coefficient[FIR_ORDER_MAX / 2];
476 } ia_drc_unique_td_filter_element_struct;
477 
478 typedef struct {
479   WORD32 n_eq_nodes;
480   FLOAT32 eq_slope[EQ_MAX_NODE_COUNT];
481   WORD32 eq_freq_delta[EQ_MAX_NODE_COUNT];
482   FLOAT32 eq_gain_initial;
483   FLOAT32 eq_gain_delta[EQ_MAX_NODE_COUNT];
484 } ia_drc_eq_subband_gain_spline_struct;
485 
486 typedef struct {
487   WORD32 eq_subband_gain[EQ_SUBBAND_GAIN_COUNT_MAX];
488 } ia_drc_eq_subband_gain_vector_struct;
489 
490 typedef struct {
491   WORD32 eq_delay_max_present;
492   WORD32 eq_delay_max;
493   WORD32 unique_filter_block_count;
494   ia_drc_filter_block_struct str_filter_block[FILTER_BLOCK_COUNT_MAX];
495   WORD32 unique_td_filter_element_count;
496   ia_drc_unique_td_filter_element_struct str_unique_td_filter_element[FILTER_ELEMENT_COUNT_MAX];
497   WORD32 unique_eq_subband_gains_count;
498   WORD32 eq_subband_gain_representation;
499   WORD32 eq_subband_gain_format;
500   WORD32 eq_subband_gain_count;
501   ia_drc_eq_subband_gain_spline_struct str_eq_subband_gain_spline[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
502   ia_drc_eq_subband_gain_vector_struct str_eq_subband_gain_vector[UNIQUE_SUBBAND_GAIN_COUNT_MAX];
503 } ia_drc_eq_coefficients_struct;
504 
505 typedef struct {
506   WORD32 filter_block_count;
507   WORD32 filter_block_index[EQ_FILTER_BLOCK_COUNT_MAX];
508 } ia_drc_filter_block_refs_struct;
509 
510 typedef struct {
511   WORD32 eq_cascade_gain_present[EQ_MAX_CHANNEL_GROUP_COUNT];
512   WORD32 eq_cascade_gain[EQ_MAX_CHANNEL_GROUP_COUNT];
513   ia_drc_filter_block_refs_struct str_filter_block_refs[EQ_MAX_CHANNEL_GROUP_COUNT];
514   WORD32 eq_phase_alignment_present;
515   WORD32 eq_phase_alignment[EQ_MAX_CHANNEL_GROUP_COUNT][EQ_MAX_CHANNEL_GROUP_COUNT];
516 } ia_drc_td_filter_cascade_struct;
517 
518 typedef struct {
519   WORD32 eq_set_id;
520   WORD32 eq_set_complexity_level;
521   WORD32 downmix_id_present;
522   WORD32 downmix_id;
523   WORD32 eq_apply_to_downmix;
524   WORD32 additional_downmix_id_present;
525   WORD32 additional_downmix_id_count;
526   WORD32 additional_downmix_id[ADDITIONAL_DOWNMIX_ID_COUNT_MAX];
527   WORD32 drc_set_id;
528   WORD32 additional_drc_set_id_present;
529   WORD32 additional_drc_set_id_count;
530   WORD32 additional_drc_set_id[ADDITIONAL_DRC_SET_ID_COUNT_MAX];
531   WORD32 eq_set_purpose;
532   WORD32 depends_on_eq_set_present;
533   WORD32 depends_on_eq_set;
534   WORD32 no_independent_eq_use;
535   WORD32 eq_channel_count;
536   WORD32 eq_channel_group_count;
537   WORD32 eq_channel_group_for_channel[MAX_CHANNEL_COUNT];
538   WORD32 td_filter_cascade_present;
539   ia_drc_td_filter_cascade_struct str_td_filter_cascade;
540   WORD32 subband_gains_present;
541   WORD32 subband_gains_index[EQ_MAX_CHANNEL_GROUP_COUNT];
542   WORD32 eq_transition_duration_present;
543   FLOAT32 eq_transition_duration;
544 } ia_drc_eq_instructions_struct;
545 
546 typedef struct {
547   WORD32 uni_drc_config_ext_type[MAX_EXT_COUNT];
548   WORD32 ext_bit_size[MAX_EXT_COUNT - 1];
549   /* UNIDRC_CONF_EXT_PARAM_DRC */
550   WORD32 parametric_drc_present;
551   ia_drc_coeff_parametric_drc_struct str_drc_coeff_parametric_drc;
552   WORD32 parametric_drc_instructions_count;
553   ia_drc_parametric_drc_instructions_struct
554       str_parametric_drc_instructions[MAX_PARAM_DRC_INSTRUCTIONS_COUNT];
555 
556   /* UNIDRC_CONF_EXT_V1 */
557   WORD32 drc_extension_v1_present;
558   WORD32 downmix_instructions_v1_present;
559   WORD32 downmix_instructions_v1_count;
560   ia_drc_downmix_instructions_struct str_downmix_instructions_v1[DOWNMIX_INSTRUCTIONS_COUNT_MAX];
561   WORD32 drc_coeffs_and_instructions_uni_drc_v1_present;
562   WORD32 drc_coefficients_uni_drc_v1_count;
563   ia_drc_coefficients_uni_drc_struct
564       str_drc_coefficients_uni_drc_v1[DRC_COEFFICIENTS_UNIDRC_V1_COUNT_MAX];
565   WORD32 drc_instructions_uni_drc_v1_count;
566   ia_drc_instructions_uni_drc
567       str_drc_instructions_uni_drc_v1[DRC_INSTRUCTIONS_UNIDRC_V1_COUNT_MAX];
568   WORD32 loud_eq_instructions_present;
569   WORD32 loud_eq_instructions_count;
570   ia_drc_loud_eq_instructions_struct str_loud_eq_instructions[LOUD_EQ_INSTRUCTIONS_COUNT_MAX];
571   WORD32 eq_present;
572   ia_drc_eq_coefficients_struct str_eq_coefficients;
573   WORD32 eq_instructions_count;
574   ia_drc_eq_instructions_struct str_eq_instructions[EQ_INSTRUCTIONS_COUNT_MAX];
575 } ia_drc_uni_drc_config_ext_struct;
576 
577 typedef struct {
578   WORD32 sample_rate_present;
579   WORD32 sample_rate;
580   WORD32 downmix_instructions_count;
581   WORD32 drc_coefficients_uni_drc_count;
582   WORD32 drc_instructions_uni_drc_count;
583   WORD32 drc_instructions_count_plus;
584   WORD32 drc_description_basic_present;
585   WORD32 drc_coefficients_basic_count;
586   WORD32 drc_instructions_basic_count;
587   WORD32 uni_drc_config_ext_present;
588   ia_drc_uni_drc_config_ext_struct str_uni_drc_config_ext;
589   ia_drc_coefficients_basic_struct str_drc_coefficients_basic[MAX_DRC_COEFF_COUNT];
590   ia_drc_instructions_basic_struct str_drc_instructions_basic[MAX_DRC_INSTRUCTIONS_BASIC_COUNT];
591   ia_drc_coefficients_uni_drc_struct str_drc_coefficients_uni_drc[MAX_DRC_COEFF_COUNT];
592   ia_drc_instructions_uni_drc str_drc_instructions_uni_drc[MAX_DRC_INSTRUCTIONS_COUNT];
593   ia_drc_channel_layout_struct str_channel_layout;
594   ia_drc_downmix_instructions_struct str_downmix_instructions[MAX_DOWNMIX_INSTRUCTION_COUNT];
595   WORD32 loudness_info_set_present;
596 } ia_drc_uni_drc_config_struct;
597 
598 typedef struct {
599   WORD32 loudness_info_v1_album_count;
600   WORD32 loudness_info_v1_count;
601   ia_drc_loudness_info_struct str_loudness_info_v1_album[MAX_LOUDNESS_INFO_COUNT];
602   ia_drc_loudness_info_struct str_loudness_info_v1[MAX_LOUDNESS_INFO_COUNT];
603 } ia_drc_loudness_info_set_ext_eq_struct;
604 
605 typedef struct {
606   WORD32 loudness_info_set_ext_type[MAX_EXT_COUNT];
607   WORD32 ext_bit_size[MAX_EXT_COUNT - 1];
608   ia_drc_loudness_info_set_ext_eq_struct str_loudness_info_set_ext_eq;
609 } ia_drc_loudness_info_set_extension_struct;
610 
611 typedef struct {
612   WORD32 loudness_info_album_count;
613   WORD32 loudness_info_count;
614   WORD32 loudness_info_set_ext_present;
615   ia_drc_loudness_info_struct str_loudness_info_album[MAX_LOUDNESS_INFO_COUNT];
616   ia_drc_loudness_info_struct str_loudness_info[MAX_LOUDNESS_INFO_COUNT];
617   ia_drc_loudness_info_set_extension_struct str_loudness_info_set_extension;
618 } ia_drc_loudness_info_set_struct;
619 
620 typedef struct {
621   WORD32 uni_drc_gain_ext_present;
622   WORD32 uni_drc_gain_ext_type[MAX_EXT_COUNT];
623   WORD32 ext_bit_size[MAX_EXT_COUNT - 1];
624 } ia_drc_uni_drc_gain_ext_struct;
625