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 IXHEAACD_DRC_DATA_STRUCT_H
21 
22 #define IXHEAACD_DRC_DATA_STRUCT_H
23 
24 #define MAX_DRC_BANDS 16
25 
26 #define MAX_AUDIO_CHANNELS 8
27 
28 #define SBR_QMF_SUB_SAMPLES 64
29 #define SBR_QMF_SUB_BANDS 64
30 
31 typedef enum {
32   UNKNOWN_PAYLOAD = 0,
33   MPEG_DRC_EXT_DATA = 1,
34   DVB_DRC_ANC_DATA = 2
35 
36 } AACDEC_DRC_PAYLOAD_TYPE;
37 
38 #define DVB_ANC_DATA_SYNC_BYTE (0xBC)
39 typedef struct {
40   WORD32 prog_ref_level;
41   WORD16 n_mdct_bands[MAX_DRC_BANDS];
42   WORD16 drc_fac[MAX_DRC_BANDS];
43   WORD16 drc_fac_dvb[MAX_DRC_BANDS];
44   WORD8 drc_exp;
45   UWORD8 short_block;
46   UWORD8 drc_interp_scheme;
47   UWORD8 n_drc_bands;
48   UWORD8 new_prog_ref_level;
49   UWORD8 new_drc_fac;
50   UWORD8 prev_interp_scheme;
51   WORD32 drc_factors_sbr[SBR_QMF_SUB_SAMPLES][SBR_QMF_SUB_BANDS];
52 } ixheaac_drc_data_struct;
53 
54 typedef struct {
55   UWORD8 b_channel_on[MAX_AUDIO_CHANNELS];
56   UWORD8 prog_ref_level_present;
57   UWORD8 prog_ref_level;
58   UWORD8 drc_num_bands;
59   UWORD8 drc_band_top[MAX_DRC_BANDS];
60   WORD8 dyn_rng_dlbl[MAX_DRC_BANDS];
61   WORD8 dyn_rng_dlbl_dvb[MAX_DRC_BANDS];
62   WORD8 max_dyn_rng_dlbl;
63   UWORD8 drc_interpolation_scheme;
64   WORD8 drc_data_type;
65 } ixheaac_drc_bs_data_struct;
66 
67 typedef struct {
68   ixheaac_drc_bs_data_struct str_drc_bs_data[MAX_BS_ELEMENT];
69   ixheaac_drc_data_struct str_drc_channel_data[MAX_BS_ELEMENT];
70   WORD16 drc_ref_level;
71   WORD16 drc_def_level;
72   UWORD8 drc_channel_next_index[MAX_BS_ELEMENT];
73   UWORD8 sbr_allowed;
74   UWORD8 sbr_found;
75   UWORD8 drc_element_found;
76   UWORD8 max_audio_channels;
77   UWORD8 length_history;
78   UWORD8 num_drc_elements;
79   WORD32 is_longblock[MAX_BS_ELEMENT];
80   WORD32 state;
81   WORD32 target_ref_level;
82   WORD32 prog_ref_level;
83   WORD32 cut_factor;
84   WORD32 boost_factor;
85   FLAG drc_dig_norm;
86   FLAG drc_on;
87   FLAG dvb_anc_data_present;
88   WORD32 dvb_anc_data_pos;
89   WORD32 pres_mode;
90   WORD32 heavy_mode;
91 } ia_drc_dec_struct;
92 
93 #endif
94