xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_interface.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 enum { MS_NONE = 0, MS_SOME = 1, MS_ALL = 2 };
23 
24 enum { MS_ON = 1 };
25 
26 typedef struct {
27   WORD32 ms_digest; /* 0 = no MS; 1 = some MS, 2 = all MS */
28   WORD32 ms_mask[MAXIMUM_GROUPED_SCALE_FACTOR_BAND];
29 } ixheaace_tools_info;
30 
31 typedef struct {
32   WORD32 sfb_count;
33   WORD32 sfb_per_group;
34   WORD32 max_sfb_per_grp;
35   WORD32 window_sequence;
36   WORD32 window_shape;
37   WORD32 grouping_mask;
38   WORD32 sfb_offsets[MAXIMUM_GROUPED_SCALE_FACTOR_BAND + 1];
39   FLOAT32 *ptr_sfb_energy;
40   FLOAT32 *ptr_sfb_spread_energy;
41   FLOAT32 *ptr_sfb_thr;
42   FLOAT32 *ptr_spec_coeffs;
43   FLOAT32 sfb_sum_ms_energy;
44   FLOAT32 sfb_sum_lr_energy;
45   FLOAT32 pe;
46   FLOAT32 sfb_min_snr[MAXIMUM_GROUPED_SCALE_FACTOR_BAND];
47   WORD32 ms_digest; /* 0 = no MS; 1 = some MS, 2 = all MS */
48   WORD32 ms_used[MAXIMUM_GROUPED_SCALE_FACTOR_BAND];
49   ixheaace_temporal_noise_shaping_params tns_info;
50 } ixheaace_psy_out_channel;
51 
52 typedef struct {
53   ixheaace_tools_info tools_info;
54   FLOAT32 weight_ms_lr_pe_ratio;
55 } ixheaace_psy_out_element;
56 
57 typedef struct {
58   /* information shared by both channels  */
59   ixheaace_psy_out_element psy_out_element;
60   /* information specific to each channel */
61   ixheaace_psy_out_channel *psy_out_ch[IXHEAACE_MAX_CH_IN_BS_ELE];
62 } ixheaace_psy_out;
63 
64 VOID ia_enhaacplus_enc_build_interface(
65     FLOAT32 *ptr_grouped_mdct_spec, ixheaace_sfb_energy *ptr_grouped_sfb_thres,
66     ixheaace_sfb_energy *ptr_grouped_sfb_nrg, ixheaace_sfb_energy *ptr_grouped_sfb_spreaded_nrg,
67     const ixheaace_sfb_energy_sum sfb_nrg_sum_lr, const ixheaace_sfb_energy_sum sfb_nrg_sum_ms,
68     const WORD32 win_seq, const WORD32 win_shape, const WORD32 grouped_sfb_cnt,
69     const WORD32 *ptr_grouped_sfb_offset, const WORD32 max_sfb_per_grp,
70     const FLOAT32 *ptr_grouped_sfb_min_snr, const WORD32 total_groups_cnt,
71     const WORD32 *ptr_group_len, ixheaace_psy_out_channel *ptr_psy_out_ch);
72