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