• 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 IXHEAACD_MPS_DECOR_H
21 #define IXHEAACD_MPS_DECOR_H
22 
23 #define DECOR_ALPHA (0.8f)
24 #define ONE_MINUS_DECOR_ALPHA (1 - DECOR_ALPHA)
25 #define DECOR_GAMMA (1.5f)
26 
27 #define DUCK_ALPHA (26214)
28 #define DUCK_GAMMA (24576)
29 #define DUCK_ONEMINUSALPHA (6554)
30 
31 enum {
32   REVERB_BAND_0 = 0,
33   REVERB_BAND_1 = 1,
34   REVERB_BAND_2 = 2,
35   REVERB_BAND_3 = 3
36 };
37 
38 enum { DECOR_CONFIG_0 = 0, DECOR_CONFIG_1 = 1, DECOR_CONFIG_2 = 2 };
39 
40 struct ia_mps_dec_ducker_interface {
41   VOID(*apply)
42   (ia_mps_dec_ducker_interface *const self, WORD32 const time_slots,
43    WORD32 const *input_real, WORD32 const *input_imag, WORD32 *output_real,
44    WORD32 *output_imag, ia_mps_dec_mps_tables_struct *ia_mps_dec_mps_table_ptr,
45    VOID *scratch);
46 };
47 
48 typedef struct {
49   WORD32 hybrid_bands;
50   WORD32 parameter_bands;
51   WORD32 alpha;
52   WORD32 one_minus_alpha;
53   WORD32 gamma;
54   WORD32 abs_thr;
55   WORD16 qalpha;
56   WORD16 qgamma;
57   WORD32 smooth_direct_nrg[MAX_PARAMETER_BANDS];
58   WORD32 smooth_reverb_nrg[MAX_PARAMETER_BANDS];
59   WORD16 q_smooth_direct_nrg[MAX_PARAMETER_BANDS];
60   WORD16 q_smooth_reverb_nrg[MAX_PARAMETER_BANDS];
61 } ia_mps_dec_duck_instance_struct;
62 
63 VOID ixheaacd_decorr_apply(ia_heaac_mps_state_struct *pstr_mps_state, WORD32 length,
64                            WORD32 *input_real, WORD32 *input_imag,
65                            WORD32 *output_real, WORD32 *output_imag,
66                            WORD32 index);
67 
68 WORD32 ixheaacd_decorr_create(
69     ia_mps_dec_decorr_dec_handle hDecorrDec, WORD32 subbands, WORD32 seed,
70     WORD32 dec_type, WORD32 decorr_config,
71     ia_mps_dec_mps_tables_struct *ia_mps_dec_mps_table);
72 
73 IA_ERRORCODE ixheaacd_mps_decor_init(ia_mps_decor_struct *, WORD32, WORD32, WORD32);
74 
75 VOID ixheaacd_mps_decor_apply(
76     ia_mps_decor_struct *self,
77     ia_cmplx_flt_struct in[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
78     ia_cmplx_flt_struct out[MAX_TIME_SLOTS][MAX_HYBRID_BANDS_MPS],
79     WORD32 length, WORD32 res_bands, WORD32 ldmps_present);
80 
81 #endif /* IXHEAACD_MPS_DECOR_H */
82