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