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 /****************************************************************************/ 23*15dc779aSAndroid Build Coastguard Worker /* structure definitions */ 24*15dc779aSAndroid Build Coastguard Worker /****************************************************************************/ 25*15dc779aSAndroid Build Coastguard Worker /* enhaacplus_enc configuration */ 26*15dc779aSAndroid Build Coastguard Worker typedef struct { 27*15dc779aSAndroid Build Coastguard Worker WORD32 i_channels; 28*15dc779aSAndroid Build Coastguard Worker WORD32 i_native_channels; 29*15dc779aSAndroid Build Coastguard Worker WORD32 i_n_memtabs; 30*15dc779aSAndroid Build Coastguard Worker WORD32 sample_rate; 31*15dc779aSAndroid Build Coastguard Worker WORD32 native_sample_rate; 32*15dc779aSAndroid Build Coastguard Worker WORD32 i_channels_mode; 33*15dc779aSAndroid Build Coastguard Worker WORD32 aot; 34*15dc779aSAndroid Build Coastguard Worker WORD32 i_channels_mask; 35*15dc779aSAndroid Build Coastguard Worker WORD32 i_num_coupling_chan; 36*15dc779aSAndroid Build Coastguard Worker WORD32 element_type; 37*15dc779aSAndroid Build Coastguard Worker WORD32 element_slot; 38*15dc779aSAndroid Build Coastguard Worker WORD32 num_bs_elements; 39*15dc779aSAndroid Build Coastguard Worker WORD32 element_instance_tag; 40*15dc779aSAndroid Build Coastguard Worker /* Add config params here */ 41*15dc779aSAndroid Build Coastguard Worker WORD32 aac_classic; 42*15dc779aSAndroid Build Coastguard Worker WORD32 use_parametric_stereo; 43*15dc779aSAndroid Build Coastguard Worker WORD32 chmode_nchannels; 44*15dc779aSAndroid Build Coastguard Worker WORD32 chmode; 45*15dc779aSAndroid Build Coastguard Worker WORD32 firstframe; 46*15dc779aSAndroid Build Coastguard Worker WORD32 adts_flag; 47*15dc779aSAndroid Build Coastguard Worker WORD32 esbr_flag; 48*15dc779aSAndroid Build Coastguard Worker WORD32 init_success; 49*15dc779aSAndroid Build Coastguard Worker WORD32 silence_marker; 50*15dc779aSAndroid Build Coastguard Worker WORD32 frame_count; 51*15dc779aSAndroid Build Coastguard Worker FLAG write_program_config_element; 52*15dc779aSAndroid Build Coastguard Worker iaace_config aac_config; 53*15dc779aSAndroid Build Coastguard Worker ixheaace_config_ancillary pstr_ancillary; 54*15dc779aSAndroid Build Coastguard Worker WORD32 mps_tree_config; 55*15dc779aSAndroid Build Coastguard Worker WORD32 use_mps; 56*15dc779aSAndroid Build Coastguard Worker WORD32 eldsbr_found; 57*15dc779aSAndroid Build Coastguard Worker WORD32 ccfl_idx; 58*15dc779aSAndroid Build Coastguard Worker UWORD32 ui_pcm_wd_sz; 59*15dc779aSAndroid Build Coastguard Worker WORD32 frame_length; 60*15dc779aSAndroid Build Coastguard Worker ia_usac_encoder_config_struct usac_config; 61*15dc779aSAndroid Build Coastguard Worker } ixheaace_config_struct; 62*15dc779aSAndroid Build Coastguard Worker 63*15dc779aSAndroid Build Coastguard Worker typedef struct ixheaace_state_struct { 64*15dc779aSAndroid Build Coastguard Worker // The first AACENC_BLOCKSIZE*2 elements are the same as that of the encoder i/p buffer. 65*15dc779aSAndroid Build Coastguard Worker // The usage of input buffer as scratch is avoided here 66*15dc779aSAndroid Build Coastguard Worker FLOAT32 *inp_delay; 67*15dc779aSAndroid Build Coastguard Worker FLOAT32 *time_signal_mps; 68*15dc779aSAndroid Build Coastguard Worker FLOAT32 *time_signal; 69*15dc779aSAndroid Build Coastguard Worker UWORD8 *mps_bs; 70*15dc779aSAndroid Build Coastguard Worker ixheaace_config_struct *pstr_config[MAXIMUM_BS_ELE]; 71*15dc779aSAndroid Build Coastguard Worker WORD32 aot; 72*15dc779aSAndroid Build Coastguard Worker WORD32 mps_enable; 73*15dc779aSAndroid Build Coastguard Worker WORD32 mps_tree_config; 74*15dc779aSAndroid Build Coastguard Worker WORD32 i_out_bytes; 75*15dc779aSAndroid Build Coastguard Worker UWORD32 ui_in_bytes; 76*15dc779aSAndroid Build Coastguard Worker UWORD32 ui_input_over; 77*15dc779aSAndroid Build Coastguard Worker UWORD32 ui_init_done; 78*15dc779aSAndroid Build Coastguard Worker /* other state structure variables */ 79*15dc779aSAndroid Build Coastguard Worker WORD32 downsample[MAXIMUM_BS_ELE]; 80*15dc779aSAndroid Build Coastguard Worker WORD32 buffer_offset; 81*15dc779aSAndroid Build Coastguard Worker iexheaac_encoder_str *aac_enc_pers_mem[MAXIMUM_BS_ELE]; 82*15dc779aSAndroid Build Coastguard Worker VOID *temp_buff_aac; 83*15dc779aSAndroid Build Coastguard Worker ixheaace_bit_buf bit_stream; 84*15dc779aSAndroid Build Coastguard Worker ixheaace_bit_buf_handle pstr_bit_stream_handle; 85*15dc779aSAndroid Build Coastguard Worker struct ixheaace_str_sbr_enc *spectral_band_replication_enc_pers_mem[MAXIMUM_BS_ELE]; 86*15dc779aSAndroid Build Coastguard Worker VOID *temp_buff_sbr; 87*15dc779aSAndroid Build Coastguard Worker VOID *ptr_temp_buff_resamp; 88*15dc779aSAndroid Build Coastguard Worker ixheaace_iir21_resampler down_sampler[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 89*15dc779aSAndroid Build Coastguard Worker ixheaace_iir_sos_resampler down_samp_sos[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 90*15dc779aSAndroid Build Coastguard Worker ixheaace_iir_sos_resampler up_sampler[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 91*15dc779aSAndroid Build Coastguard Worker ixheaace_iir21_resampler hbe_down_sampler[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 92*15dc779aSAndroid Build Coastguard Worker ixheaace_iir_sos_resampler hbe_down_samp_sos[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 93*15dc779aSAndroid Build Coastguard Worker ixheaace_iir_sos_resampler hbe_up_sampler[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 94*15dc779aSAndroid Build Coastguard Worker UWORD8 num_anc_data_bytes[MAXIMUM_BS_ELE][IXHEAACE_MAX_CH_IN_BS_ELE]; 95*15dc779aSAndroid Build Coastguard Worker UWORD8 anc_data_bytes[MAXIMUM_BS_ELE][IXHEAACE_MAX_PAYLOAD_SIZE]; 96*15dc779aSAndroid Build Coastguard Worker WORD32 total_fill_bits; 97*15dc779aSAndroid Build Coastguard Worker int *scratch_addr; 98*15dc779aSAndroid Build Coastguard Worker char flag_error; 99*15dc779aSAndroid Build Coastguard Worker FLOAT32 **ptr_in_buf; 100*15dc779aSAndroid Build Coastguard Worker FLOAT32 **pp_drc_in_buf; 101*15dc779aSAndroid Build Coastguard Worker FLOAT32 *mps_scratch; 102*15dc779aSAndroid Build Coastguard Worker ixheaace_audio_specific_config_struct audio_specific_config; 103*15dc779aSAndroid Build Coastguard Worker ia_usac_data_struct str_usac_enc_data; 104*15dc779aSAndroid Build Coastguard Worker ia_bit_buf_struct str_bit_buf; 105*15dc779aSAndroid Build Coastguard Worker ixheaace_mps_212_memory_struct *mps_pers_mem; 106*15dc779aSAndroid Build Coastguard Worker ixheaace_mps_515_memory_struct *mps_515_pers_mem; 107*15dc779aSAndroid Build Coastguard Worker WORD32 is_quant_spec_zero; 108*15dc779aSAndroid Build Coastguard Worker WORD32 is_gain_limited; 109*15dc779aSAndroid Build Coastguard Worker WORD32 i_out_bits; 110*15dc779aSAndroid Build Coastguard Worker VOID *loudness_handle; 111*15dc779aSAndroid Build Coastguard Worker } ixheaace_state_struct; 112*15dc779aSAndroid Build Coastguard Worker 113*15dc779aSAndroid Build Coastguard Worker typedef struct ixheaace_api_struct { 114*15dc779aSAndroid Build Coastguard Worker /* pointer to the state structure */ 115*15dc779aSAndroid Build Coastguard Worker ixheaace_state_struct *pstr_state; 116*15dc779aSAndroid Build Coastguard Worker ixheaace_config_struct config[MAXIMUM_BS_ELE]; 117*15dc779aSAndroid Build Coastguard Worker /* the mem tables */ 118*15dc779aSAndroid Build Coastguard Worker ixheaace_mem_info_struct *pstr_mem_info; 119*15dc779aSAndroid Build Coastguard Worker /* the mem pointers */ 120*15dc779aSAndroid Build Coastguard Worker pVOID *pp_mem; 121*15dc779aSAndroid Build Coastguard Worker /* the table structs */ 122*15dc779aSAndroid Build Coastguard Worker ixheaace_aac_tables pstr_aac_tabs; 123*15dc779aSAndroid Build Coastguard Worker ixheaace_comm_tables common_tabs; 124*15dc779aSAndroid Build Coastguard Worker ixheaace_str_sbr_tabs spectral_band_replication_tabs; 125*15dc779aSAndroid Build Coastguard Worker WORD32 usac_en; 126*15dc779aSAndroid Build Coastguard Worker VOID *pstr_mps_212_enc; 127*15dc779aSAndroid Build Coastguard Worker VOID *pstr_mps_515_enc; 128*15dc779aSAndroid Build Coastguard Worker } ixheaace_api_struct; 129