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