impd_drc_uni_gain_dec.h revision 4908247643e9e97852e847c00bfe7c4259279538
1/******************************************************************************
2 *
3 * Copyright (C) 2015 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_UNI_GAIN_DEC_H
21#define IMPD_DRC_UNI_GAIN_DEC_H
22
23
24
25
26
27#ifdef __cplusplus
28extern "C"
29{
30#endif
31
32typedef struct {
33    ia_node_struct str_node;
34    ia_node_struct prev_node;
35    FLOAT32 lpcm_gains[2 * AUDIO_CODEC_FRAME_SIZE_MAX + MAX_SIGNAL_DELAY];
36} ia_interp_buf_struct;
37
38typedef struct {
39#if DRC_GAIN_DEBUG_FILE
40    FILE* f_gain_debug;
41#endif
42    WORD32 buf_interpolation_count;
43    ia_interp_buf_struct* buf_interpolation;
44} ia_gain_buffer_struct;
45
46typedef struct {
47    ia_gain_buffer_struct pstr_gain_buf[SEL_DRC_COUNT];
48} ia_drc_gain_buffers_struct;
49
50typedef struct {
51    WORD32    gain_interpolation_type;
52    WORD32    gain_modification_flag;
53    WORD32    ducking_flag;
54    WORD32    clipping_flag;
55    ia_ducking_modifiers_struct* pstr_ducking_modifiers;
56    ia_gain_modifiers_struct* pstr_gain_modifiers;
57    WORD32    limiter_peak_target_present;
58    FLOAT32  limiter_peak_target;
59    FLOAT32  loudness_normalization_gain_db;
60    WORD32    delta_tmin;
61    WORD32    characteristic_index;
62    FLOAT32  compress;
63    FLOAT32  boost;
64} ia_interp_params_struct;
65
66
67typedef struct {
68    WORD32 drc_instructions_index;
69    WORD32 drc_coeff_idx;
70    WORD32 dwnmix_instructions_index;
71} ia_sel_drc_struct;
72
73typedef struct {
74    WORD32 sample_rate;
75    WORD32 delta_tmin_default;
76    WORD32 drc_frame_size;
77    WORD32 delay_mode;
78    WORD32 sub_band_domain_mode;
79    WORD32 gain_delay_samples;
80    WORD32 audio_delay_samples;
81    WORD32 drc_set_counter;
82    WORD32 multiband_sel_drc_idx;
83
84    ia_sel_drc_struct sel_drc_array[SEL_DRC_COUNT];
85
86} ia_drc_params_struct;
87
88WORD32
89impd_gain_buf_init(WORD32 index,
90               WORD32 gain_element_count,
91               WORD32 drc_frame_size,
92               ia_gain_buffer_struct* pstr_gain_buf);
93
94WORD32
95impd_advance_buf(WORD32 drc_frame_size,
96              ia_gain_buffer_struct* pstr_gain_buf);
97
98
99WORD32
100impd_map_gain (
101         FLOAT32 gain_in_db,
102         FLOAT32* gain_out_db);
103
104WORD32
105impd_conv_to_linear_domain (ia_interp_params_struct* interp_params_str,
106          WORD32     drc_band,
107          FLOAT32   loc_db_gain,
108          FLOAT32   in_param_db_slope,
109          FLOAT32*        out_param_lin_gain,
110          FLOAT32*        out_param_lin_slope);
111
112WORD32
113impd_interpolate_drc_gain(ia_interp_params_struct* interp_params_str,
114                   WORD32    drc_band,
115                   WORD32    gain_step_tdomain,
116                   FLOAT32  gain0,
117                   FLOAT32  gain1,
118                   FLOAT32  slope0,
119                   FLOAT32  slope1,
120                   FLOAT32* result);
121
122WORD32
123impd_concatenate_segments(WORD32 drc_frame_size,
124                    WORD32 drc_band,
125                    ia_interp_params_struct* interp_params_str,
126                    ia_spline_nodes_struct* str_spline_nodes,
127                    ia_interp_buf_struct* buf_interpolation);
128
129
130
131
132
133#ifdef __cplusplus
134}
135#endif
136#endif
137