xref: /aosp_15_r20/external/libxaac/encoder/iusace_psy_utils.h (revision 15dc779a375ca8b5125643b829a8aa4b70d7f451)
1*15dc779aSAndroid Build Coastguard Worker /******************************************************************************
2*15dc779aSAndroid Build Coastguard Worker  *                                                                            *
3*15dc779aSAndroid Build Coastguard Worker  * Copyright (C) 2023 The Android Open Source Project
4*15dc779aSAndroid Build Coastguard Worker  *
5*15dc779aSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
6*15dc779aSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
7*15dc779aSAndroid Build Coastguard Worker  * You may obtain a copy of the License at:
8*15dc779aSAndroid Build Coastguard Worker  *
9*15dc779aSAndroid Build Coastguard Worker  * http://www.apache.org/licenses/LICENSE-2.0
10*15dc779aSAndroid Build Coastguard Worker  *
11*15dc779aSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
12*15dc779aSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
13*15dc779aSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*15dc779aSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
15*15dc779aSAndroid Build Coastguard Worker  * limitations under the License.
16*15dc779aSAndroid Build Coastguard Worker  *
17*15dc779aSAndroid Build Coastguard Worker  *****************************************************************************
18*15dc779aSAndroid Build Coastguard Worker  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19*15dc779aSAndroid Build Coastguard Worker  */
20*15dc779aSAndroid Build Coastguard Worker 
21*15dc779aSAndroid Build Coastguard Worker #pragma once
22*15dc779aSAndroid Build Coastguard Worker typedef struct {
23*15dc779aSAndroid Build Coastguard Worker   WORD32 sample_rate;
24*15dc779aSAndroid Build Coastguard Worker   WORD32 num_sfb_long;
25*15dc779aSAndroid Build Coastguard Worker   WORD32 num_sfb_short;
26*15dc779aSAndroid Build Coastguard Worker   const WORD16 *cb_offset_long;
27*15dc779aSAndroid Build Coastguard Worker   const WORD16 *cb_offset_short;
28*15dc779aSAndroid Build Coastguard Worker   WORD32 sfb_width_long[MAX_SFB_LONG];
29*15dc779aSAndroid Build Coastguard Worker   WORD32 sfb_width_short[MAX_SFB_SHORT];
30*15dc779aSAndroid Build Coastguard Worker 
31*15dc779aSAndroid Build Coastguard Worker } ia_sfb_info_struct;
32*15dc779aSAndroid Build Coastguard Worker 
33*15dc779aSAndroid Build Coastguard Worker VOID iusace_psy_long_config_init(WORD32 bit_rate, WORD32 sample_rate, WORD32 band_width,
34*15dc779aSAndroid Build Coastguard Worker                                  ia_psy_mod_long_config_struct *pstr_psy_config, WORD32 ccfl);
35*15dc779aSAndroid Build Coastguard Worker VOID iusace_psy_short_config_init(WORD32 bit_rate, WORD32 sample_rate, WORD32 band_width,
36*15dc779aSAndroid Build Coastguard Worker                                   ia_psy_mod_short_config_struct *pstr_psy_config, WORD32 ccfl);
37*15dc779aSAndroid Build Coastguard Worker VOID iusace_calc_band_energy(const FLOAT64 *ptr_spec_coeffs, const WORD32 *band_offset,
38*15dc779aSAndroid Build Coastguard Worker                              const WORD32 num_bands, FLOAT32 *ptr_band_energy, WORD32 sfb_count);
39*15dc779aSAndroid Build Coastguard Worker VOID iusace_find_max_spreading(const WORD32 sfb_count, const FLOAT32 *ptr_mask_low_fac,
40*15dc779aSAndroid Build Coastguard Worker                                const FLOAT32 *ptr_mask_high_fac, FLOAT32 *ptr_spreaded_enegry);
41*15dc779aSAndroid Build Coastguard Worker VOID iusace_pre_echo_control(FLOAT32 *ptr_thr_nm1, WORD32 sfb_count, FLOAT32 max_allowed_inc_fac,
42*15dc779aSAndroid Build Coastguard Worker                              FLOAT32 min_remaining_thr_fac, FLOAT32 *ptr_threshold);
43*15dc779aSAndroid Build Coastguard Worker 
44*15dc779aSAndroid Build Coastguard Worker IA_ERRORCODE iusace_sfb_params_init(WORD32 sample_rate, WORD32 frame_len, WORD32 *ptr_sfb_width,
45*15dc779aSAndroid Build Coastguard Worker                                     WORD32 *num_sfb, WORD32 win_seq);
46*15dc779aSAndroid Build Coastguard Worker 
47*15dc779aSAndroid Build Coastguard Worker WORD32 iusace_map_sample_rate(WORD32 sample_rate);
48