• 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 IMPD_DRC_SECLECTION_PROCESS_H
21 #define IMPD_DRC_SECLECTION_PROCESS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26 
27 #define EFFECT_TYPE_REQUESTED_NONE 0
28 #define EFFECT_TYPE_REQUESTED_NIGHT 1
29 #define EFFECT_TYPE_REQUESTED_NOISY 2
30 #define EFFECT_TYPE_REQUESTED_LIMITED 3
31 #define EFFECT_TYPE_REQUESTED_LOWLEVEL 4
32 #define EFFECT_TYPE_REQUESTED_DIALOG 5
33 #define EFFECT_TYPE_REQUESTED_GENERAL_COMPR 6
34 #define EFFECT_TYPE_REQUESTED_EXPAND 7
35 #define EFFECT_TYPE_REQUESTED_ARTISTIC 8
36 #define EFFECT_TYPE_REQUESTED_COUNT 9
37 
38 #define MATCH_EFFECT_TYPE 0
39 #define MATCH_DYNAMIC_RANGE 1
40 #define MATCH_DRC_CHARACTERISTIC 2
41 
42 typedef struct ia_drc_sel_proc_params_struct {
43   WORD32 base_channel_count;
44   WORD32 base_layout;
45   WORD32 target_config_request_type;
46   WORD32 num_downmix_id_requests;
47   WORD32 requested_dwnmix_id[MAX_NUM_DOWNMIX_ID_REQUESTS];
48   WORD32 requested_target_layout;
49   WORD32 requested_target_ch_count;
50   WORD32 target_ch_count_prelim;
51 
52   WORD32 loudness_normalization_on;
53   FLOAT32 target_loudness;
54   WORD32 album_mode;
55   WORD32 peak_limiter;
56   WORD32 loudness_deviation_max;
57   WORD32 loudness_measurement_method;
58   WORD32 loudness_measurement_system;
59   WORD32 loudness_measurement_pre_proc;
60   WORD32 device_cut_off_frequency;
61   FLOAT32 loudness_norm_gain_db_max;
62   FLOAT32 loudness_norm_gain_modification_db;
63   FLOAT32 output_peak_level_max;
64 
65   WORD32 num_bands_supported;
66   WORD32 dynamic_range_control_on;
67   WORD32 num_drc_feature_requests;
68   WORD32 drc_feature_req_type[MAX_NUM_DRC_FEATURE_REQUESTS];
69   WORD32 requested_num_drc_effects[MAX_NUM_DRC_FEATURE_REQUESTS];
70   WORD32 desired_num_drc_effects_of_requested[MAX_NUM_DRC_FEATURE_REQUESTS];
71   WORD32 requested_drc_effect_type[MAX_NUM_DRC_FEATURE_REQUESTS]
72                                   [MAX_NUM_DRC_EFFECT_TYPE_REQUESTS];
73   WORD32 requested_dyn_range_measur_type[MAX_NUM_DRC_FEATURE_REQUESTS];
74   WORD32 requested_dyn_range_range_flag[MAX_NUM_DRC_FEATURE_REQUESTS];
75   FLOAT32 requested_dyn_range_value[MAX_NUM_DRC_FEATURE_REQUESTS];
76   FLOAT32 requested_dyn_range_min_val[MAX_NUM_DRC_FEATURE_REQUESTS];
77   FLOAT32 requested_dyn_range_max_val[MAX_NUM_DRC_FEATURE_REQUESTS];
78   WORD32 requested_drc_characteristic[MAX_NUM_DRC_FEATURE_REQUESTS];
79 
80   WORD32 loudness_eq_request;
81   FLOAT32 sensitivity;
82   FLOAT32 playback_gain;
83   WORD32 eq_set_purpose_request;
84 
85   FLOAT32 boost;
86   FLOAT32 compress;
87   WORD32 drc_characteristic_target;
88 } ia_drc_sel_proc_params_struct;
89 
90 typedef struct ia_drc_sel_pro_struct {
91   WORD32 first_frame;
92   WORD32 drc_config_flag;
93   WORD32 loudness_info_set_flag;
94   WORD32 sel_proc_request_flag;
95   WORD32 subband_domain_mode;
96   WORD32 eq_inst_index[SUB_EQ_COUNT];
97   WORD32 drc_instructions_index[SUB_DRC_COUNT];
98 
99   ia_drc_sel_proc_params_struct uni_drc_sel_proc_params;
100 
101   ia_drc_config drc_config;
102   ia_drc_loudness_info_set_struct loudness_info_set;
103 
104   WORD32 drc_inst_index_sel;
105   WORD32 drc_coef_index_sel;
106   WORD32 downmix_inst_index_sel;
107 
108   WORD32 drc_set_id_valid_flag[DRC_INSTRUCTIONS_COUNT_MAX];
109   WORD32 eq_set_id_valid_flag[EQ_INSTRUCTIONS_COUNT_MAX];
110 
111   WORD32 eq_inst_index_sel;
112   WORD32 loud_eq_inst_index_sel;
113 
114   FLOAT32 compl_level_supported_total;
115 
116   ia_drc_sel_proc_output_struct uni_drc_sel_proc_output;
117 
118 } ia_drc_sel_pro_struct;
119 
120 WORD32 impd_map_target_config_req_downmix_id(
121     ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
122     ia_drc_config* pstr_drc_config);
123 
124 VOID impd_sel_downmix_matrix(ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
125                              ia_drc_config* pstr_drc_config);
126 
127 WORD32
128 impd_find_drc_instructions_uni_drc(
129     ia_drc_config* drc_config, WORD32 drc_set_id_requested,
130     ia_drc_instructions_struct** str_drc_instruction_str);
131 WORD32
132 impd_find_eq_instructions(ia_drc_config* drc_config, WORD32 eq_set_id_requested,
133                           ia_eq_instructions_struct** str_eq_instructions);
134 WORD32
135 impd_find_downmix(ia_drc_config* drc_config, WORD32 requested_dwnmix_id,
136                   ia_downmix_instructions_struct** dwnmix_instructions);
137 
138 WORD32
139 impd_find_eq_set_no_compression(ia_drc_config* pstr_drc_config,
140                                 WORD32 requested_dwnmix_id,
141                                 WORD32* no_compression_eq_cnt,
142                                 WORD32* no_compression_eq_id);
143 WORD32
144 impd_match_eq_set(ia_drc_config* drc_config, WORD32 downmix_id,
145                   WORD32 drc_set_id, WORD32* eq_set_id_valid_flag,
146                   WORD32* matching_eq_set_cnt, WORD32* matching_eq_set_idx);
147 
148 WORD32
149 impd_select_loud_eq(ia_drc_config* pstr_drc_config, WORD32 requested_dwnmix_id,
150                     WORD32 drc_set_id_requested, WORD32 eq_set_id_requested,
151                     WORD32* loud_eq_id_selected);
152 
153 WORD32
154 impd_drc_uni_selction_proc_init(
155     ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
156     ia_drc_sel_proc_params_struct* pstr_drc_sel_proc_params_struct,
157     ia_drc_interface_struct* pstr_drc_interface, WORD32 sub_band_domain_mode);
158 
159 WORD32
160 impd_drc_uni_sel_proc_process(
161     ia_drc_sel_pro_struct* pstr_drc_uni_sel_proc,
162     ia_drc_config* pstr_drc_config,
163     ia_drc_loudness_info_set_struct* pstr_loudness_info,
164     ia_drc_sel_proc_output_struct* hia_drc_sel_proc_output_struct);
165 
166 WORD32
167 impd_find_loud_eq_instructions_idx_for_id(ia_drc_config* drc_config,
168                                           WORD32 loud_eq_set_id_requested,
169                                           WORD32* instructions_idx);
170 
171 #ifdef __cplusplus
172 }
173 #endif /* __cplusplus */
174 
175 #endif
176