Home | History | Annotate | Download | only in decoder
      1 /******************************************************************************
      2  *                                                                            *
      3  * Copyright (C) 2018 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 #ifndef IXHEAACD_AACDEC_H
     21 #define IXHEAACD_AACDEC_H
     22 
     23 #define AAC_DEC_OK IA_ENHAACPLUS_DEC_API_NONFATAL_NO_ERROR
     24 
     25 #define IA_ENHAACPDEC_NUM_MEMTABS (4)
     26 #define IA_MPS_DEC_NUM_MEMTABS (4)
     27 
     28 #define FRAME_SIZE 1024
     29 
     30 #define ADTS_BSFORMAT 2
     31 #define LOAS_BSFORMAT 3
     32 
     33 typedef struct ia_aac_decoder_struct {
     34   FLAG frame_status;
     35   WORD32 byte_align_bits;
     36   ia_aac_dec_sbr_bitstream_struct *pstr_sbr_bitstream;
     37   ia_aac_dec_channel_info_struct *pstr_aac_dec_ch_info[CHANNELS];
     38 
     39   ia_aac_dec_channel_info *ptr_aac_dec_static_channel_info[CHANNELS];
     40 
     41   ia_aac_dec_overlap_info *pstr_aac_dec_overlap_info[CHANNELS];
     42   ia_pns_rand_vec_struct *pstr_pns_rand_vec_data;
     43   void *p_ind_channel_info;
     44   WORD32 block_number;
     45   WORD16 sampling_rate_index;
     46   WORD32 sampling_rate;
     47   WORD32 samples_per_frame;
     48   WORD16 channels;
     49   WORD8 num_swb_window[2];
     50   ia_aac_dec_tables_struct *pstr_aac_tables;
     51   ixheaacd_misc_tables *pstr_common_tables;
     52 } ia_aac_decoder_struct;
     53 
     54 struct ia_aac_persistent_struct {
     55   WORD32 *overlap_buffer;
     56   ia_aac_dec_overlap_info str_aac_dec_overlap_info[CHANNELS];
     57   ia_pns_rand_vec_struct str_pns_rand_vec_data;
     58   struct ia_aac_decoder_struct str_aac_decoder;
     59   WORD8 *sbr_payload_buffer;
     60 
     61   ia_aac_dec_channel_info *ptr_aac_dec_static_channel_info[CHANNELS];
     62   WORD16 *ltp_buf[CHANNELS];
     63 };
     64 
     65 typedef struct {
     66   VOID *base_scr_8k;
     67   VOID *extra_scr_4k[4];
     68 
     69   WORD32 *in_data;
     70   WORD32 *out_data;
     71 
     72 } ia_aac_dec_scratch_struct;
     73 
     74 WORD16 ixheaacd_individual_ch_stream(
     75     ia_bit_buf_struct *it_bit_buff, ia_aac_decoder_struct *aac_dec_handle,
     76     WORD32 num_ch, WORD32 frame_size, WORD32 total_channels, WORD32 object_type,
     77     ia_eld_specific_config_struct eld_specific_config, WORD32 ele_type);
     78 
     79 VOID ixheaacd_huff_tables_create(ia_aac_dec_tables_struct *);
     80 
     81 WORD32 ixheaacd_set_aac_persistent_buffers(VOID *aac_persistent_mem_v,
     82                                            WORD32 channels);
     83 
     84 VOID ixheaacd_huffman_decode(WORD32 it_bit_buff, WORD16 *h_index, WORD16 *len,
     85                              const UWORD16 *input_table,
     86                              const UWORD32 *idx_table);
     87 
     88 #endif /* #ifndef IXHEAACD_AACDEC_H */
     89