xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_sbr_noise_floor_est.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 
23 #define IXHEAACE_NF_SMOOTHING_LENGTH (4)
24 
25 typedef struct {
26   FLOAT32 prev_noise_lvls[IXHEAACE_NF_SMOOTHING_LENGTH][MAXIMUM_NUM_NOISE_VALUES];
27   WORD32 s_freq_qmf_band_tbl[MAXIMUM_NUM_NOISE_VALUES + 1];
28   WORD32 maxi_levl_fix;
29   FLOAT32 weight_fac;
30   FLOAT32 max_level;
31   WORD32 num_of_noise_bands;
32   WORD32 noise_groups;
33   const FLOAT32 *ptr_smooth_filter;
34   ixheaace_invf_mode thr_offset;
35 } ixheaace_str_noise_flr_est_sbr;
36 
37 typedef ixheaace_str_noise_flr_est_sbr *ixheaace_pstr_noise_flr_est_sbr;
38 
39 VOID ixheaace_sbr_noise_floor_estimate_qmf(
40     ixheaace_pstr_noise_flr_est_sbr pstr_noise_floor_est_sbr,
41     const ixheaace_str_frame_info_sbr *ptr_frame_info, FLOAT32 *ptr_noise_lvls,
42     FLOAT32 **ptr_quota_orig, WORD8 *ptr_idx_vx, WORD32 missing_harmonics_flag,
43     WORD32 start_index, WORD32 transient_flag, ixheaace_invf_mode *ptr_inv_filt_levels,
44     WORD32 is_ld_sbr);
45 
46 IA_ERRORCODE
47 ixheaace_create_sbr_noise_floor_estimate(ixheaace_pstr_noise_flr_est_sbr pstr_noise_floor_est_sbr,
48                                          WORD32 ana_max_level, const UWORD8 *ptr_freq_band_tab,
49                                          WORD32 num_scf, WORD32 noise_groups,
50                                          UWORD32 use_speech_config,
51                                          ixheaace_str_qmf_tabs *ptr_qmf_tab);
52 
53 IA_ERRORCODE
54 ixheaace_reset_sbr_noise_floor_estimate(ixheaace_pstr_noise_flr_est_sbr pstr_noise_floor_est_sbr,
55                                         const UWORD8 *ptr_freq_band_tab, WORD32 num_scf);
56