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_ROM_H
21 #define IMPD_DRC_ROM_H
22 #define MAX_NUM_QMF_BANDS 128
23 
24 #define NUM_GAIN_TBL_PROF_0_1_ENTRIES 25
25 #define NUM_GAIN_TBL_PROF_2_ENTRIES 49
26 #define NUM_SLOPE_TBL_ENTRIES 15
27 
28 extern const FLOAT32 samp_rate_tbl[13][12];
29 
30 extern const ia_delta_gain_code_table_struct
31     ia_drc_gain_tbls_prof_0_1[NUM_GAIN_TBL_PROF_0_1_ENTRIES];
32 
33 extern const ia_delta_gain_code_table_struct
34     ia_drc_gain_tbls_prof_2[NUM_GAIN_TBL_PROF_2_ENTRIES];
35 
36 extern const FLOAT32 channel_weight[];
37 
38 extern const FLOAT32 dwnmix_coeff_v1[];
39 extern const FLOAT32 eq_slope_tbl[];
40 
41 extern const FLOAT32 eq_gain_delta_tbl[];
42 
43 extern const FLOAT32 zero_pole_radius_tbl[];
44 extern const FLOAT32 zero_pole_angle_tbl[];
45 
46 extern const FLOAT32 shape_filt_lf_y1_bound_tbl[][3];
47 extern const FLOAT32 shape_filt_hf_y1_bound_tbl[][3];
48 
49 extern const FLOAT32 shape_filt_lf_gain_offset_tbl[][3];
50 
51 extern const FLOAT32 shape_filt_hf_gain_offset_tbl[][3];
52 
53 extern const FLOAT32 shape_filt_lf_radius_tbl[];
54 
55 extern const FLOAT32 shape_filt_hf_radius_tbl[];
56 
57 extern const FLOAT32 shape_filt_cutoff_freq_norm_hf_tbl[];
58 
59 extern const ia_cicp_sigmoid_characteristic_param_struct
60     pstr_cicp_sigmoid_characteristic_param[];
61 
62 extern const ia_slope_code_table_struct
63     slope_code_tbl_entries_by_size[NUM_SLOPE_TBL_ENTRIES];
64 
65 extern const FLOAT32 dwnmix_coeff[];
66 
67 extern const FLOAT32 dwnmix_coeff_lfe[];
68 
69 extern const WORD32 drc_characteristic_order_default[][3];
70 
71 extern const WORD32 measurement_system_default_tbl[];
72 
73 extern const WORD32 measurement_system_bs1770_3_tbl[];
74 extern const WORD32 measurement_system_user_tbl[];
75 extern const WORD32 measurement_system_expert_tbl[];
76 extern const WORD32 measurement_system_rms_a_tbl[];
77 extern const WORD32 measurement_system_rms_b_tbl[];
78 extern const WORD32 measurement_system_rms_c_tbl[];
79 extern const WORD32 measurement_system_rms_d_tbl[];
80 extern const WORD32 measurement_system_rms_e_tbl[];
81 extern const WORD32 measurement_method_prog_loudness_tbl[];
82 extern const WORD32 measurement_method_peak_loudness_tbl[];
83 
84 #define MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL 3
85 
86 typedef struct {
87   WORD32 target_config_request_type;
88   WORD32 num_downmix_id_requests;
89   WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS_LOCAL];
90   WORD32 requested_target_layout;
91   WORD32 requested_target_ch_count;
92 } ia_loc_sys_interface_struct;
93 
94 extern const ia_loc_sys_interface_struct loc_sys_interface[];
95 
96 typedef struct {
97   WORD32 loudness_normalization_on;
98   FLOAT32 target_loudness;
99 } ia_loc_loudness_norm_ctrl_interface_struct;
100 
101 extern const ia_loc_loudness_norm_ctrl_interface_struct
102     loc_loudness_norm_ctrl_interface[];
103 
104 typedef struct {
105   WORD32 album_mode;
106   WORD32 peak_limiter;
107   WORD32 loudness_deviation_max;
108   WORD32 loudness_measurement_method;
109   WORD32 loudness_measurement_system;
110   WORD32 loudness_measurement_pre_proc;
111   WORD32 device_cut_off_frequency;
112   FLOAT32 loudness_norm_gain_db_max;
113   FLOAT32 loudness_norm_gain_modification_db;
114   FLOAT32 output_peak_level_max;
115 } ia_loc_loudness_norm_param_interface_struct;
116 
117 extern const ia_loc_loudness_norm_param_interface_struct
118     loc_loudness_norm_param_interface[];
119 
120 #define MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL 3
121 typedef struct {
122   WORD32 dynamic_range_control_on;
123   WORD32 num_drc_feature_requests;
124   WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS_LOCAL];
125   WORD32 requested_dyn_rng_measurement_type;
126   WORD32 requested_dyn_range_is_single_val_flag;
127   FLOAT32 requested_dyn_range_value;
128   FLOAT32 requested_dyn_range_min_val;
129   FLOAT32 requested_dyn_range_max_val;
130   WORD32 requested_drc_characteristic;
131 } ia_loc_drc_interface_struct;
132 
133 extern const ia_loc_drc_interface_struct loc_dyn_range_ctrl_interface[];
134 
135 #define MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL 5
136 typedef struct {
137   WORD32 requested_num_drc_effects;
138   WORD32 desired_num_drc_effects_of_requested;
139   WORD32 requested_drc_effect_type[MAX_NUM_DRC_EFFECT_TYPE_REQUESTS_LOCAL];
140 } ia_loc_requested_drc_effect_struct;
141 
142 extern const ia_loc_requested_drc_effect_struct
143     loc_requested_drc_effect_type_str[];
144 
145 typedef struct {
146   FLOAT32 compress;
147   FLOAT32 boost;
148   WORD32 drc_characteristic_target;
149 } ia_loc_drc_parameter_interface_struct;
150 
151 extern const ia_loc_drc_parameter_interface_struct
152     loc_drc_parameter_interface[];
153 
154 extern const FLOAT32 f_bands_nrm_QMF71[71];
155 extern const FLOAT32 f_bands_nrm_QMF64[64];
156 extern const FLOAT32 f_bands_nrm_STFT256[257];
157 
158 extern const FLOAT64 qmf_filter_coeff[640];
159 
160 extern const ia_filter_bank_params_struct
161     normal_cross_freq[FILTER_BANK_PARAMETER_COUNT];
162 #endif
163