xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_tns_func.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 IA_ERRORCODE
23*15dc779aSAndroid Build Coastguard Worker ia_enhaacplus_enc_init_tns_configuration(WORD32 bit_rate, WORD32 sample_rate, WORD32 channels,
24*15dc779aSAndroid Build Coastguard Worker                                          ixheaace_temporal_noise_shaping_config *pstr_tns_config,
25*15dc779aSAndroid Build Coastguard Worker                                          ixheaace_psy_configuration_long *pstr_psy_config,
26*15dc779aSAndroid Build Coastguard Worker                                          WORD32 active,
27*15dc779aSAndroid Build Coastguard Worker                                          ixheaace_temporal_noise_shaping_tables *pstr_tns_tab,
28*15dc779aSAndroid Build Coastguard Worker                                          WORD32 frame_len_long, WORD32 aot);
29*15dc779aSAndroid Build Coastguard Worker 
30*15dc779aSAndroid Build Coastguard Worker IA_ERRORCODE ia_enhaacplus_enc_init_tns_configuration_short(
31*15dc779aSAndroid Build Coastguard Worker     WORD32 bit_rate, WORD32 sample_rate, WORD32 channels,
32*15dc779aSAndroid Build Coastguard Worker     ixheaace_temporal_noise_shaping_config *pstr_tns_config,
33*15dc779aSAndroid Build Coastguard Worker     ixheaace_psy_configuration_short *pstr_psy_config, WORD32 active,
34*15dc779aSAndroid Build Coastguard Worker     ixheaace_temporal_noise_shaping_tables *pstr_tns_tab, WORD32 frame_len_long, WORD32 aot);
35*15dc779aSAndroid Build Coastguard Worker 
36*15dc779aSAndroid Build Coastguard Worker IA_ERRORCODE ia_enhaacplus_enc_tns_detect(ixheaace_temporal_noise_shaping_data *pstr_tns_data,
37*15dc779aSAndroid Build Coastguard Worker                                           ixheaace_temporal_noise_shaping_config tns_config,
38*15dc779aSAndroid Build Coastguard Worker                                           FLOAT32 *ptr_scratch_tns, const WORD32 *ptr_sfb_offset,
39*15dc779aSAndroid Build Coastguard Worker                                           FLOAT32 *ptr_spectrum, WORD32 sub_blk_num,
40*15dc779aSAndroid Build Coastguard Worker                                           WORD32 block_type, WORD32 aot, FLOAT32 *ptr_sfb_energy,
41*15dc779aSAndroid Build Coastguard Worker                                           FLOAT32 *ptr_shared_buffer1, WORD32 long_frame_len);
42*15dc779aSAndroid Build Coastguard Worker 
43*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_tns_sync(ixheaace_temporal_noise_shaping_data *pstr_tns_data_dst,
44*15dc779aSAndroid Build Coastguard Worker                                 const ixheaace_temporal_noise_shaping_data *pstr_tns_data_src,
45*15dc779aSAndroid Build Coastguard Worker                                 const ixheaace_temporal_noise_shaping_config tns_config,
46*15dc779aSAndroid Build Coastguard Worker                                 const WORD32 sub_blk_num, const WORD32 block_type);
47*15dc779aSAndroid Build Coastguard Worker 
48*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_tns_encode(ixheaace_temporal_noise_shaping_params *pstr_tns_info,
49*15dc779aSAndroid Build Coastguard Worker                                     ixheaace_temporal_noise_shaping_data *pstr_tns_data,
50*15dc779aSAndroid Build Coastguard Worker                                     WORD32 num_sfb,
51*15dc779aSAndroid Build Coastguard Worker                                     ixheaace_temporal_noise_shaping_config tns_config,
52*15dc779aSAndroid Build Coastguard Worker                                     WORD32 lowpass_line, FLOAT32 *ptr_spectrum,
53*15dc779aSAndroid Build Coastguard Worker                                     WORD32 sub_blk_num, WORD32 block_type,
54*15dc779aSAndroid Build Coastguard Worker                                     ixheaace_temporal_noise_shaping_tables *pstr_tns_tab);
55*15dc779aSAndroid Build Coastguard Worker 
56*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_apply_tns_mult_table_to_ratios(WORD32 startCb, WORD32 stopCb,
57*15dc779aSAndroid Build Coastguard Worker                                                       FLOAT32 *thresholds);
58*15dc779aSAndroid Build Coastguard Worker 
59*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_calc_weighted_spectrum(FLOAT32 *ptr_spectrum, FLOAT32 *ptr_weighted_spec,
60*15dc779aSAndroid Build Coastguard Worker                                               FLOAT32 *ptr_sfb_energy,
61*15dc779aSAndroid Build Coastguard Worker                                               const WORD32 *ptr_sfb_offset, WORD32 lpc_start_line,
62*15dc779aSAndroid Build Coastguard Worker                                               WORD32 lpc_stop_line, WORD32 lpc_start_band,
63*15dc779aSAndroid Build Coastguard Worker                                               WORD32 lpc_stop_band, FLOAT32 *ptr_shared_buffer1,
64*15dc779aSAndroid Build Coastguard Worker                                               WORD32 aot);
65*15dc779aSAndroid Build Coastguard Worker 
66*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_auto_correlation(const FLOAT32 *ptr_input, FLOAT32 *ptr_corr,
67*15dc779aSAndroid Build Coastguard Worker                                         WORD32 samples, WORD32 corr_coeff);
68*15dc779aSAndroid Build Coastguard Worker 
69*15dc779aSAndroid Build Coastguard Worker VOID ia_enhaacplus_enc_analysis_filter_lattice(const FLOAT32 *ptr_signal, WORD32 num_lines,
70*15dc779aSAndroid Build Coastguard Worker                                                const FLOAT32 *ptr_par_coeff, WORD32 order,
71*15dc779aSAndroid Build Coastguard Worker                                                FLOAT32 *ptr_output);
72