xref: /aosp_15_r20/external/libxaac/encoder/ixheaace_mps_structure.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 typedef struct {
23   WORD32 num_param_bands;
24   WORD32 quant_mode;
25   UWORD8 b_use_coarse_quant;
26   UWORD8 b_ld_mode;
27   UWORD32 sample_rate;
28   UWORD32 frame_time_slots;
29   UWORD32 independency_factor;
30   WORD32 time_alignment;
31 
32 } ixheaace_mps_space_enc_setup, *ixheaace_mps_pstr_spece_enc_setup;
33 
34 typedef struct {
35   UWORD8 b_enc_mode_212;
36   UWORD8 max_hybrid_in_static_slots;
37   WORD32 max_sampling_rate;
38   WORD32 max_analysis_length_time_slots;
39   WORD32 max_hybrid_bands;
40   WORD32 max_qmf_bands;
41   WORD32 max_ch_in;
42   WORD32 max_frame_time_slots;
43   WORD32 max_frame_length;
44   WORD32 max_ch_out;
45   WORD32 max_ch_tot_out;
46 } ixheaace_mps_enc_config_setup, *ixheaace_mps_pstr_enc_config_setup;
47 
48 struct ixheaace_mps_space_structure {
49   ixheaace_mps_space_enc_setup user;
50   ixheaace_mps_pstr_enc_config_setup setup;
51   ixheaace_mps_pstr_frame_win h_frame_window;
52   WORD32 n_samples_valid;
53   WORD32 num_param_bands;
54   UWORD8 b_enc_mode_212_only;
55 
56   UWORD8 use_frame_keep;
57   UWORD32 independency_factor;
58   UWORD32 num_sample_rate;
59   UWORD8 n_input_channels;
60   UWORD8 n_output_channels;
61   WORD32 num_frame_time_slots;
62   UWORD8 num_qmf_bands;
63   UWORD8 num_hybrid_bands;
64   UWORD32 n_frame_length;
65 
66   WORD32 n_samples_next;
67   WORD32 num_analysis_length_time_slots;
68   WORD32 n_analysis_lookahead_time_slots;
69   WORD32 n_update_hybrid_position_time_slots;
70   WORD32 *pn_output_bits;
71   WORD32 n_input_delay;
72   WORD32 n_output_buffer_delay;
73   WORD32 n_surround_analysis_buffer_delay;
74   WORD32 n_bitstream_delay_buffer;
75   WORD32 n_bitstream_buffer_read;
76   WORD32 n_bitstream_buffer_write;
77   WORD32 num_discard_out_frames;
78   WORD32 avoid_keep;
79 
80   UWORD8 use_coarse_quant_cld;
81   UWORD8 use_coarse_quant_icc;
82   UWORD8 use_coarse_quant_cpc;
83   UWORD8 use_coarse_quant_arb_dmx;
84   WORD32 quant_mode;
85   WORD32 core_coder_delay;
86   WORD32 time_alignment;
87 
88   WORD32 independency_count;
89   WORD32 independency_flag;
90   WORD32 pp_tr_curr_pos[IXHEAACE_MPS_MAX_INPUT_CHANNELS][MAX_NUM_TRANS];
91   WORD32 tr_prev_pos[MAX_NUM_PARAMS];
92 
93   ixheaace_mps_frame_win_list frame_win_list;
94   ixheaace_mps_spatial_frame save_frame;
95 
96   ixheaace_mps_space_tree_setup space_tree_setup;
97   ixheaace_mps_space_ssc_buf ssc_buf;
98 
99   FLOAT32 *ptr_frame_window_ana[MAX_NUM_PARAMS];
100 
101   ixheaace_mps_pstr_qmf_filter_bank *pstr_qmf_filter_in;
102   ixheaace_mps_pstr_dc_filter pstr_dc_filter[IXHEAACE_MPS_MAX_INPUT_CHANNELS];
103   ixheaace_mps_pstr_onset_detect pstr_onset_detect[IXHEAACE_MPS_MAX_INPUT_CHANNELS];
104   ixheaace_mps_pstr_space_tree pstr_space_tree;
105   ixheaace_mps_pstr_bsf_instance pstr_bitstream_formatter;
106   ixheaace_mps_pstr_static_gain_config pstr_static_gain_config;
107   ixheaace_mps_pstr_static_gain pstr_static_gain;
108   ixheaace_mps_pstr_delay pstr_delay;
109   ixheaace_mps_pstr_enhanced_time_domain_dmx pstr_enhanced_time_dmx;
110 
111   FLOAT32 time_signal_in[2][MPS_MAX_FRAME_LENGTH + MAX_DELAY_SURROUND_ANALYSIS];
112   FLOAT32 time_signal_delay_in[2][MAX_DELAY_SURROUND_ANALYSIS];
113 
114   ixheaace_cmplx_str cmplx_hybrid_in[IXHEAACE_MPS_MAX_INPUT_CHANNELS][MAX_ANA_TIME_SLOT]
115                                     [MAX_HYBRID_BAND];
116   ixheaace_cmplx_str cmplx_hybrid_in_static[MAX_SPACE_TREE_CHANNELS][MAX_HYBRID_STATIC_SLOT]
117                                            [MAX_HYBRID_BAND];
118   UWORD8 bit_stream_delay_buffer[MAX_BITSTREAM_DELAY][MAX_MPEGS_BYTES];
119   UWORD8 *ptr_parameter_band_2_hybrid_band_offset;
120 };
121