• 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_SBRDECODER_H
21 #define IXHEAACD_SBRDECODER_H
22 
23 #define EXT_DYNAMIC_RANGE 11
24 
25 #define EXT_SAC_DATA 12
26 #define SBR_EXTENSION 13
27 #define SBR_EXTENSION_CRC 14
28 
29 #define MAXNRELEMENTS 1
30 #define MAXNRSBRCHANNELS 2
31 #define MAXSBRBYTES 1024
32 
33 #define SBRDEC_OK 0
34 
35 typedef enum {
36   SBR_ID_SCE = 0,
37   SBR_ID_CPE,
38   SBR_ID_CCE = 2,
39   SBR_ID_LCS,
40   SBR_ID_LFE,
41   SBR_ID_DSE,
42   SBR_ID_PCE,
43   SBR_ID_FIL,
44   SBR_ID_END
45 } SBR_ELEMENT_ID;
46 
47 typedef struct {
48   WORD32 sbr_ele_id;
49   WORD32 extension_type;
50   WORD32 size_payload;
51   WORD8 *ptr_sbr_data;
52   WORD8 *ptr_prev_sbr_data;
53   WORD32 prev_size_payload;
54   WORD32 frame_error_flag[2];
55   WORD32 use_frame_slot;
56   WORD32 prev_sbr_ele_id;
57   WORD32 prev_extension_type;
58   WORD32 size_payload_old;
59   WORD8 sbr_prev_data[MAXSBRBYTES];
60 } ia_sbr_element_stream_struct;
61 
62 typedef struct {
63   WORD16 no_elements;
64   ia_sbr_element_stream_struct str_sbr_ele[MAXNRELEMENTS];
65 } ia_aac_dec_sbr_bitstream_struct;
66 typedef enum { UNKNOWN_SBR = 0, ORIG_SBR, PVC_SBR } SBR_TYPE_ID;
67 
68 typedef struct ia_sbr_dec_inst_struct *ia_handle_sbr_dec_inst_struct;
69 
70 typedef struct {
71   VOID *ptr_work_buf_core;
72   VOID *ptr_work_buf;
73   VOID *extra_scr_1k[2];
74 } ia_sbr_scr_struct;
75 
76 IA_ERRORCODE ixheaacd_applysbr(
77     ia_handle_sbr_dec_inst_struct self, ia_aac_dec_sbr_bitstream_struct *p_sbr_bit_stream,
78     WORD16 *core_sample_buf, WORD16 *codec_num_channels, FLAG frame_status, FLAG down_samp_flag,
79     FLAG down_mix_flag, ia_sbr_scr_struct *sbr_scratch_struct, WORD32 ps_enable, WORD32 ch_fac,
80     WORD32 slot_element, ia_bit_buf_struct *it_bit_buff, ia_drc_dec_struct *pstr_drc_dec,
81     WORD eld_sbr_flag, WORD audio_object_type, WORD32 init_flag, WORD32 ldmps_present,
82     WORD32 frame_size, WORD32 heaac_mps_present, WORD32 ec_flag, FLAG first_frame);
83 
84 IA_ERRORCODE ixheaacd_parse_sbr(ia_handle_sbr_dec_inst_struct self,
85                                 ia_aac_dec_sbr_bitstream_struct *p_sbr_bit_stream,
86                                 WORD16 *codec_num_channels, FLAG frame_status,
87                                 ia_sbr_scr_struct *sbr_scratch_struct,
88                                 ia_bit_buf_struct *it_bit_buff, WORD32 audio_object_type);
89 
90 WORD32 ixheaacd_getsize_sbr_persistent();
91 
92 VOID ixheaacd_set_sbr_persistent_buffers(VOID *aac_persistent_mem_v,
93                                          WORD32 *persistent_used,
94                                          WORD32 channels, WORD32 ps_enable);
95 
96 #endif /* IXHEAACD_SBRDECODER_H */
97