• 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 SBR_EXTENSION 13
26 #define SBR_EXTENSION_CRC 14
27 
28 #define MAXNRELEMENTS 1
29 #define MAXNRSBRCHANNELS 2
30 #define MAXSBRBYTES 1024
31 
32 #define SBRDEC_OK 0
33 
34 typedef enum {
35   SBR_ID_SCE = 0,
36   SBR_ID_CPE,
37   SBR_ID_CCE = 2,
38   SBR_ID_LCS,
39   SBR_ID_LFE,
40   SBR_ID_DSE,
41   SBR_ID_PCE,
42   SBR_ID_FIL,
43   SBR_ID_END
44 } SBR_ELEMENT_ID;
45 
46 typedef struct {
47   WORD32 sbr_ele_id;
48   WORD32 extension_type;
49   WORD32 size_payload;
50   WORD8 *ptr_sbr_data;
51 } ia_sbr_element_stream_struct;
52 
53 typedef struct {
54   WORD16 no_elements;
55   ia_sbr_element_stream_struct str_sbr_ele[MAXNRELEMENTS];
56 } ia_aac_dec_sbr_bitstream_struct;
57 typedef enum { UNKNOWN_SBR = 0, ORIG_SBR, PVC_SBR } SBR_TYPE_ID;
58 
59 typedef struct ia_sbr_dec_inst_struct *ia_handle_sbr_dec_inst_struct;
60 
61 typedef struct {
62   VOID *ptr_work_buf_core;
63   VOID *ptr_work_buf;
64   VOID *extra_scr_1k[2];
65 } ia_sbr_scr_struct;
66 
67 IA_ERRORCODE ixheaacd_applysbr(
68     ia_handle_sbr_dec_inst_struct self,
69     ia_aac_dec_sbr_bitstream_struct *p_sbr_bit_stream, WORD16 *core_sample_buf,
70     WORD16 *codec_num_channels, FLAG frame_status, FLAG down_samp_flag,
71     FLAG down_mix_flag, ia_sbr_scr_struct *sbr_scratch_struct, WORD32 ps_enable,
72     WORD32 ch_fac, WORD32 slot_element, ia_bit_buf_struct *it_bit_buff,
73     ia_drc_dec_struct *pstr_drc_dec, WORD eld_sbr_flag, WORD audio_object_type);
74 
75 WORD32 ixheaacd_getsize_sbr_persistent();
76 
77 VOID ixheaacd_set_sbr_persistent_buffers(VOID *aac_persistent_mem_v,
78                                          WORD32 *persistent_used,
79                                          WORD32 channels, WORD32 ps_enable);
80 
81 #endif
82