1 /*
2  * Copyright (c) 2006-2020 Cadence Design Systems, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 
25 #ifndef __XA_AAC_DEC_API_H__
26 #define __XA_AAC_DEC_API_H__
27 
28 /* aac_dec-specific configuration parameters */
29 enum xa_config_param_aac_dec {
30   XA_AACDEC_CONFIG_PARAM_BDOWNSAMPLE          = 0,    /* Applicable only for aac*plus* libraries */
31   XA_AACDEC_CONFIG_PARAM_BBITSTREAMDOWNMIX    = 1,    /* Applicable only for aac*plus* libraries */
32   XA_AACDEC_CONFIG_PARAM_EXTERNAL_SAMPLERATE  = 2,
33 #define XA_AACDEC_CONFIG_PARAM_EXTERNALSAMPLINGRATE XA_AACDEC_CONFIG_PARAM_EXTERNAL_SAMPLERATE // Renamed, maintained for backward comapatible
34   XA_AACDEC_CONFIG_PARAM_EXTERNALBSFORMAT     = 3,
35   XA_AACDEC_CONFIG_PARAM_TO_STEREO            = 4,
36   XA_AACDEC_CONFIG_PARAM_OUT_SAMPLERATE       = 5,
37 #define  XA_AACDEC_CONFIG_PARAM_SAMP_FREQ           XA_AACDEC_CONFIG_PARAM_OUT_SAMPLERATE // Renamed, maintained for backward comapatible
38   XA_AACDEC_CONFIG_PARAM_NUM_CHANNELS         = 6,
39   XA_AACDEC_CONFIG_PARAM_PCM_WDSZ             = 7,
40   XA_AACDEC_CONFIG_PARAM_SBR_TYPE             = 8,
41   XA_AACDEC_CONFIG_PARAM_AAC_SAMPLERATE       = 9,
42   XA_AACDEC_CONFIG_PARAM_DATA_RATE            = 10,
43   XA_AACDEC_CONFIG_PARAM_OUTNCHANS            = 11,
44   XA_AACDEC_CONFIG_PARAM_CHANROUTING          = 12,
45   XA_AACDEC_CONFIG_PARAM_SBR_SIGNALING        = 13,    /* Applicable only for aac*plus* libraries */
46   XA_AACDEC_CONFIG_PARAM_CHANMAP              = 14,
47   XA_AACDEC_CONFIG_PARAM_ACMOD                = 15,
48   XA_AACDEC_CONFIG_PARAM_AAC_FORMAT           = 16,
49   XA_AACDEC_CONFIG_PARAM_ZERO_UNUSED_CHANS    = 17,
50   XA_AACDEC_CONFIG_PARAM_DECODELAYERS         = 18,   /* Depricated, no more implemented */
51   XA_AACDEC_CONFIG_PARAM_EXTERNALCHCONFIG     = 19,   /* Depricated, no more implemented */
52   XA_AACDEC_CONFIG_PARAM_RAW_AU_SIDEINFO      = 20,   /* For DAB-plus only */
53   XA_AACDEC_CONFIG_PARAM_EXTERNALBITRATE      = 21,   /* For DAB-plus only */
54   XA_AACDEC_CONFIG_PARAM_PAD_SIZE             = 22,   /* For DAB-plus only */
55   XA_AACDEC_CONFIG_PARAM_PAD_PTR              = 23,   /* For DAB-plus only */
56   XA_AACDEC_CONFIG_PARAM_MPEGSURR_PRESENT     = 24,   /* For DAB-plus only */
57   XA_AACDEC_CONFIG_PARAM_METADATASTRUCT_PTR   = 25,   /* Only if Audio MetaData support is present for the library */
58   XA_AACDEC_CONFIG_PARAM_ASCONFIGSTRUCT_PTR   = 26,   /* Only if Audio MetaData support is present for the library */
59   XA_AACDEC_CONFIG_PARAM_LIMITBANDWIDTH       = 27,   /* Depricated, no more implemented */
60   XA_AACDEC_CONFIG_PARAM_PCE_STATUS           = 28,   /* for Loas build only */
61   XA_AACDEC_CONFIG_PARAM_DWNMIX_METADATA      = 29,   /* for Loas build only */
62   XA_AACDEC_CONFIG_PARAM_MPEG_ID              = 30,   /* Applicable only for adts streams */
63   XA_AACDEC_CONFIG_PARAM_DWNMIX_LEVEL_DVB     = 31    /* for Loas build only */
64   /* DRC and PRL information as per ISO/IEC 14496.3 */
65   /* PRL Parametbers */
66   ,XA_AACDEC_CONFIG_PARAM_ENABLE_APPLY_PRL     = 32     /* for Loas build only */
67   ,XA_AACDEC_CONFIG_PARAM_TARGET_LEVEL         = 33     /* for Loas build only */
68   ,XA_AACDEC_CONFIG_PARAM_PROG_REF_LEVEL       = 34     /* for Loas build only */
69   /* DRC Parametbers */
70   ,XA_AACDEC_CONFIG_PARAM_ENABLE_APPLY_DRC     = 35     /* for Loas build only */
71   ,XA_AACDEC_CONFIG_PARAM_DRC_COMPRESS_FAC     = 36     /* for Loas build only */
72   ,XA_AACDEC_CONFIG_PARAM_DRC_BOOST_FAC        = 37     /* for Loas build only */
73   ,XA_AACDEC_CONFIG_PARAM_DRC_EXT_PRESENT      = 38
74   ,XA_AACDEC_CONFIG_PARAM_ORIGINAL_OR_COPY     = 39     /* for ADTS and ADIF files only */
75   ,XA_AACDEC_CONFIG_PARAM_COPYRIGHT_ID_PTR     = 40     /* for ADTS and ADIF files only */
76   ,XA_AACDEC_CONFIG_PARAM_PARSED_DRC_INFO      = 41     /* applicable only for aacmch* builds */
77   ,XA_AACDEC_CONFIG_PARAM_INPUT_BITOFFSET      = 42
78   ,XA_AACDEC_CONFIG_PARAM_ENABLE_FRAME_BY_FRAME_DECODE      = 43
79   ,XA_AACDEC_CONFIG_PARAM_CONCEALMENT_FADE_OUT_FRAMES       = 44
80   ,XA_AACDEC_CONFIG_PARAM_CONCEALMENT_MUTE_RELEASE_FRAMES   = 45
81   ,XA_AACDEC_CONFIG_PARAM_CONCEALMENT_FADE_IN_FRAMES        = 46
82   ,XA_AACDEC_CONFIG_PARAM_MPEG4_AMENDMENT4_ENABLE           = 47
83   ,XA_AACDEC_CONFIG_PARAM_CHANNEL_CONFIG_INFO_FROM_PCE      = 48
84   ,XA_AACDEC_CONFIG_PARAM_RESET_STATE_ON_SYNC_LOSS_ERROR    = 49
85 };
86 
87 /* Types of channel modes (acmod) */
88 /*
89 ======================================================================================
90 Acro.   Expansion                   MPEG2/4 CH. Mapping        MPEG4 AMD.4 CH. Mapping
91 =======================================================================================
92 CF      Center Front                CF        ->  C             CF    -> C
93 LF      Left Front                  LF or LCF ->  L             LF    -> L
94 RF      Right Front                 RF or RCF ->  R             RF    -> R
95 LCF     Left Center Front           LS or LOF ->  l             LS    -> l
96 RCF     Right Center Front          RS or ROF ->  r             RS    -> r
97 rs      Rear Surround               rs        ->  Cs            rc    -> Cs
98 LSR     Left Surround Rear          LSR       ->  Sbl           rsl   -> Sbl
99 RSR     Right Surround Rear         RSR       ->  Rsr           rsr   -> Rsr
100 LOF     Left Outside Front          LFE       ->  LFE           LFE   -> LFE
101 ROF     Right Outside Front                                     LFC   -> Sbl
102 LFE     Low Frequency Effects                                   RFC   -> Sbr
103 rc      Rear Center                                             LFVH  -> Sbl
104 rsl     Rear Surround Left                                      RFVH  -> Sbr
105 rsr     Rear Surround Right
106 LFVH    Left Front Vertical Height
107 RFVH    Right Front Vertical Height
108 LFC     Left Front Center
109 RFC     Right Front Center
110 =======================================================================================
111 */
112 
113 typedef enum {
114     //Input Channel Map Enum                        Tensilica Convention (used for routing)         MPEG2/4                                         MPEG4 AMD. 4
115     XA_AACDEC_CHANNELMODE_UNDEFINED = 0,            // undefined
116     XA_AACDEC_CHANNELMODE_MONO = 1,                 // mono (1/0 )                                  CF (1)                                          == SAME ==
117     XA_AACDEC_CHANNELMODE_PARAMETRIC_STEREO = 2,    // parametric stereo (aacPlus v2 only)          LF, RF (2)                                      == SAME ==
118     XA_AACDEC_CHANNELMODE_DUAL_CHANNEL = 3,         // dual mono (1/0 + 1/0)
119     XA_AACDEC_CHANNELMODE_STEREO = 4,               // stereo (2/0)                                 LF, RF (2)                                      == SAME ==
120     XA_AACDEC_CHANNELMODE_3_CHANNEL_FRONT = 5,      // C, L, R (3/0)                                CF, LF, RF (3)                                  == SAME ==
121     XA_AACDEC_CHANNELMODE_3_CHANNEL_SURR = 6,       // L, R, l (2/1)
122     XA_AACDEC_CHANNELMODE_4_CHANNEL_2SURR = 7,      // L, R, l, r (2/2)
123     XA_AACDEC_CHANNELMODE_4_CHANNEL_1SURR = 8,      // C, L R, Cs (3/0/1)                           CF, LF, RF, rs (4)                              CF, LF, RF, rc (4)
124     XA_AACDEC_CHANNELMODE_5_CHANNEL = 9,            //  C, L, R, l, r (3/2)                         CF, LF, RF, LSR, RSR (5)                        CF, LF, RF, LS, RS (5)
125     XA_AACDEC_CHANNELMODE_6_CHANNEL = 10,           // C, L, R, l, r, Cs (3/2/1)
126     XA_AACDEC_CHANNELMODE_7_CHANNEL = 11,           // C, L, R, l, r, Sbl, Sbr (3/2/2)
127     XA_AACDEC_CHANNELMODE_7_CHANNEL_FRONT = 11,     // C, Sbl, Sbr, L, R, l, r (3/2/2)
128     XA_AACDEC_CHANNELMODE_7_CHANNEL_BACK = 20,      // C, L, R, l, r, Sbl, Sbr (3/2/2)
129     XA_AACDEC_CHANNELMODE_7_CHANNEL_TOP = 21,       // C, L, R, l, r, Sbl, Sbr (3/2/2)
130     XA_AACDEC_CHANNELMODE_2_1_STEREO = 12,          // L, R, LFE (2/0.1)
131     XA_AACDEC_CHANNELMODE_3_1_CHANNEL_FRONT = 13,   // C, L, R, LFE (3/0.1)
132     XA_AACDEC_CHANNELMODE_3_1_CHANNEL_SURR = 14,    // L, R, Cs, LFE (2/0/1.1)
133     XA_AACDEC_CHANNELMODE_4_1_CHANNEL_2SURR = 15,   // L, R, Ls, Rs, LFE (2/2.1)
134     XA_AACDEC_CHANNELMODE_4_1_CHANNEL_1SURR = 16,   // C, L, R, Cs, LFE (3/0/1.1)
135     XA_AACDEC_CHANNELMODE_5_1_CHANNEL = 17,         // C, L, R, l, r, LFE (5.1 mode)                CF, LF, RF, LSR, RSR, LFE (6)                   CF, LF, RF, LS, RS, LFE (6)
136     XA_AACDEC_CHANNELMODE_6_1_CHANNEL = 18,         // C, L, R, l, r, Cs, LFE (3/2/1.1)             NA                                              CF, LF, RF, LS, RS, rc, LFE (11)
137     XA_AACDEC_CHANNELMODE_7_1_CHANNEL = 19,         // C, L, R, l, r, Sbl, Sbr, LFE (7.1 mode)      CF, LCF, RCF, LOF, ROF, LSR, RSR, LFE (7)       NA
138     XA_AACDEC_CHANNELMODE_7_1_CHANNEL_FRONT = 19,   // C, Sbl, Sbr, L, R, l, r, LFE (7.1 mode)      NA                                              CF, LFC, RFC, LF, RF, LS, RS, LFE (7)
139     XA_AACDEC_CHANNELMODE_7_1_CHANNEL_BACK = 22,    // C, L, R, l, r, Sbl, Sbr, LFE (7.1 mode)      NA                                              CF, LF, RF, LS, RS, rsl, rsr, LFE (12)
140     XA_AACDEC_CHANNELMODE_7_1_CHANNEL_TOP = 23,     // C, L, R, l, r, LFE, Sbl, Sbr (7.1 mode)      NA                                              CF, LF, RF, LS, RS, LFE, LFVH, RFVH(14)
141 
142 } XA_AACDEC_CHANNELMODE;
143 
144 /* Types of bitstreams */
145 typedef enum {
146   /* The bitstream type has not (yet) been successfully determined. */
147   XA_AACDEC_EBITSTREAM_TYPE_UNKNOWN = 0,
148   /* ADIF is an unsynced, unframed format. Errors in the bitstream cannot always
149      be detected, and when they occur, no further parsing is possible. Avoid ADIF at
150      all costs. */
151   XA_AACDEC_EBITSTREAM_TYPE_AAC_ADIF = 1,
152   /* ADTS is a simple synced framing format similar to MPEG layer-3. */
153   XA_AACDEC_EBITSTREAM_TYPE_AAC_ADTS = 2,
154   /* LATM, with in-band config. This format cannot be detected by the library;
155      it needs to be signaled explicitely. */
156   XA_AACDEC_EBITSTREAM_TYPE_AAC_LATM = 3,
157   /* LATM, with out of band config. This format is not supported. */
158   XA_AACDEC_EBITSTREAM_TYPE_AAC_LATM_OUTOFBAND_CONFIG = 4,
159   /* Low overhead audio stream. */
160   XA_AACDEC_EBITSTREAM_TYPE_AAC_LOAS = 5,
161 
162   /* Raw bitstream. This format cannot be detected by the library;
163      it needs to be signaled explicitly. */
164   XA_AACDEC_EBITSTREAM_TYPE_AAC_RAW = 6,
165 
166   /* Raw DAB+ bitstream. It needs sideInfo for every frame for error recovery */
167   XA_AACDEC_EBITSTREAM_TYPE_DABPLUS_RAW_SIDEINFO = 8,
168 
169   /* DAB+ audio superframe bitstream */
170   XA_AACDEC_EBITSTREAM_TYPE_DABPLUS = 9
171 
172 } XA_AACDEC_EBITSTREAM_TYPE;
173 
174 /* commands */
175 #include "xa_apicmd_standards.h"
176 
177 /* error codes */
178 #include "xa_error_standards.h"
179 
180 #define XA_CODEC_AAC_DEC 3
181 
182 /* aac_dec-specific error codes */
183 /*****************************************************************************/
184 /* Class 0: API Errors                                                       */
185 /*****************************************************************************/
186 /* Non Fatal Errors */
187 enum xa_error_nonfatal_api_aac_dec {
188   XA_AACDEC_API_NONFATAL_CMD_TYPE_NOT_SUPPORTED = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_AAC_DEC, 0),
189   XA_AACDEC_API_NONFATAL_INVALID_API_SEQ        = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_api, XA_CODEC_AAC_DEC, 1)
190 };
191 
192 enum xa_error_fatal_api_aac_dec {
193   XA_AACDEC_API_FATAL_INVALID_API_SEQ        = XA_ERROR_CODE(xa_severity_fatal, xa_class_api, XA_CODEC_AAC_DEC, 4)
194 };
195 
196 /* Fatal Errors */
197 /* (none) */
198 
199 /*****************************************************************************/
200 /* Class 1: Configuration Errors                                             */
201 /*****************************************************************************/
202 /* Nonfatal Errors */
203 enum xa_error_nonfatal_config_aac_dec {
204   XA_AACDEC_CONFIG_NONFATAL_PARAMS_NOT_SET                      = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 0),
205   XA_AACDEC_CONFIG_NONFATAL_DATA_RATE_NOT_SET                   = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 1),
206   XA_AACDEC_CONFIG_NONFATAL_PARTIAL_CHANROUTING                 = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 2)
207   ,XA_AACDEC_CONFIG_NONFATAL_INVALID_GEN_STRM_POS               = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 3)
208   ,XA_AACDEC_CONFIG_NONFATAL_CPID_NOT_PRESENT                   = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 4)
209   ,XA_AACDEC_CONFIG_NONFATAL_INVALID_PRL_PARAMS                 = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 5)
210   ,XA_AACDEC_CONFIG_NONFATAL_INVALID_DRC_PARAMS                 = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 6)
211   ,XA_AACDEC_CONFIG_NONFATAL_INVALID_PARAM_VALUE                = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_config, XA_CODEC_AAC_DEC, 7)
212 };
213 /* Fatal Errors */
214 enum xa_error_fatal_config_aac_dec {
215   XA_AACDEC_CONFIG_FATAL_INVALID_BDOWNSAMPLE          = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 0),
216   XA_AACDEC_CONFIG_FATAL_INVALID_BBITSTREAMDOWNMIX    = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 1),
217   XA_AACDEC_CONFIG_FATAL_INVALID_EXTERNALSAMPLINGRATE = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 2),
218   XA_AACDEC_CONFIG_FATAL_INVALID_EXTERNALBSFORMAT     = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 3),
219   XA_AACDEC_CONFIG_FATAL_INVALID_TO_STEREO            = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 4),
220   XA_AACDEC_CONFIG_FATAL_INVALID_OUTNCHANS            = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 5),
221   XA_AACDEC_CONFIG_FATAL_INVALID_SBR_SIGNALING        = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 6),
222   XA_AACDEC_CONFIG_FATAL_INVALID_CHANROUTING          = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 7),
223   XA_AACDEC_CONFIG_FATAL_INVALID_PCM_WDSZ             = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 8),
224   XA_AACDEC_CONFIG_FATAL_INVALID_ZERO_UNUSED_CHANS    = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 9),
225   /* Code For Invalid Number of input channels */
226   XA_AACDEC_CONFIG_FATAL_INVALID_EXTERNALCHCONFIG    = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 10), // Depricated, no more implemented
227   XA_AACDEC_CONFIG_FATAL_INVALID_DECODELAYERS        = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 11), // Depricated, no more implemented
228   XA_AACDEC_CONFIG_FATAL_INVALID_EXTERNALBITRATE     = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 12),
229   XA_AACDEC_CONFIG_FATAL_INVALID_CONCEALMENT_PARAM   = XA_ERROR_CODE(xa_severity_fatal, xa_class_config, XA_CODEC_AAC_DEC, 13)
230 };
231 /*****************************************************************************/
232 /* Class 2: Execution Class Errors                                           */
233 /*****************************************************************************/
234 /* Nonfatal Errors */
235 enum xa_error_nonfatal_execute_aac_dec {
236   XA_AACDEC_EXECUTE_NONFATAL_INSUFFICIENT_FRAME_DATA            = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 0)
237   ,XA_AACDEC_EXECUTE_NONFATAL_RUNTIME_INIT_RAMP_DOWN            = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 1)
238   ,XA_AACDEC_EXECUTE_NONFATAL_RAW_FRAME_PARSE_ERROR             = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 2)
239   ,XA_AACDEC_EXECUTE_NONFATAL_ADTS_HEADER_ERROR                 = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 3) // Depreciated error, decoder don't return this error anymore
240   ,XA_AACDEC_EXECUTE_NONFATAL_ADTS_HEADER_NOT_FOUND             = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 4) // Depreciated error, decoder don't return this error anymore
241   ,XA_AACDEC_EXECUTE_NONFATAL_DABPLUS_HEADER_NOT_FOUND          = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 5)
242   ,XA_AACDEC_EXECUTE_NONFATAL_LOAS_HEADER_ERROR                 = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 6) // Depreciated error, decoder don't return this error anymore
243   ,XA_AACDEC_EXECUTE_NONFATAL_STREAM_CHANGE                     = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 7)
244   ,XA_AACDEC_EXECUTE_NONFATAL_HEADER_NOT_FOUND                  = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 8)
245   ,XA_AACDEC_EXECUTE_NONFATAL_UNSUPPORTED_FEATURE               = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 9)
246   ,XA_AACDEC_EXECUTE_NONFATAL_HEADER_ERROR                      = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 10)
247   ,XA_AACDEC_EXECUTE_NONFATAL_PARTIAL_LAST_FRAME                = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 11)
248   ,XA_AACDEC_EXECUTE_NONFATAL_EMPTY_INPUT_BUFFER                = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 12)
249   ,XA_AACDEC_EXECUTE_NONFATAL_ROUTING_ABSENT_CH_IGNORED         = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 13)
250   ,XA_AACDEC_EXECUTE_NONFATAL_NEXT_SYNC_NOT_FOUND               = XA_ERROR_CODE(xa_severity_nonfatal, xa_class_execute, XA_CODEC_AAC_DEC, 14)
251 };
252 /* Fatal Errors */
253 enum xa_error_fatal_execute_aac_dec {
254   XA_AACDEC_EXECUTE_FATAL_PARSING_ERROR                  = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 0) // Depreciated error, decoder don't return this error anymore
255   ,XA_AACDEC_EXECUTE_FATAL_RAW_FRAME_PARSE_ERROR          = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 1)
256   ,XA_AACDEC_EXECUTE_FATAL_BAD_INPUT_FAILURE              = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 2) // Depreciated error, decoder don't return this error anymore
257   ,XA_AACDEC_EXECUTE_FATAL_UNSUPPORTED_FEATURE             = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 3)
258   ,XA_AACDEC_EXECUTE_FATAL_ERROR_IN_CHANROUTING           = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 4)
259   ,XA_AACDEC_EXECUTE_FATAL_EMPTY_INPUT_BUFFER              = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 5)
260   ,XA_AACDEC_EXECUTE_FATAL_LOAS_HEADER_CHANGE            = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 6) // Depreciated error, decoder don't return this error anymore
261   ,XA_AACDEC_EXECUTE_FATAL_INIT_ERROR                    = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 7) // Depreciated error, decoder don't return this error anymore
262   ,XA_AACDEC_EXECUTE_FATAL_UNKNOWN_STREAM_FORMAT         = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 8)
263   ,XA_AACDEC_EXECUTE_FATAL_ADIF_HEADER_NOT_FOUND         = XA_ERROR_CODE(xa_severity_fatal, xa_class_execute, XA_CODEC_AAC_DEC, 9)
264 
265 };
266 
267 #include "xa_type_def.h"
268 
269 /* Relevant for loas build only */
270 /* PCE status in the bit-stream */
271 typedef enum {
272   XA_AACDEC_PCE_NOT_FOUND_YET = 0,      /* No PCE found in the stream yet. */
273   XA_AACDEC_PCE_NEW           = 1,      /* New PCE found in the current frame. */
274   XA_AACDEC_PCE_USE_PREV      = 2       /* No PCE in current frame, using previous PCE. */
275 } xa_aac_dec_pce_status;
276 
277 /* MetaData Structure */
278 typedef struct
279 {
280   UWORD8 bMatrixMixdownIdxPresent;   /* Flag indicating if ucMatrixMixdownIndex & bPseudoSurroundEnable were present in PCE */
281   UWORD8 ucMatrixMixdownIndex;       /* 2-bit value selecting the coefficient set for matrix downmix.
282                                         Note, ucMatrixMixdownIndex is valid only if bMatrixMixdownIdxPresent = 1 */
283   UWORD8 bPseudoSurroundEnable;      /* Flag indicating the possibility of mixdown for pseudo surround reproduction.
284                                         Note, bPseudoSurroundEnable is valid only if bMatrixMixdownIdxPresent = 1 */
285 } xa_aac_dec_dwnmix_metadata_t;
286 
287 /* Structure for downmix levels present in acnillary data (DSE) */
288 /*
289 Where
290 new_dvb_downmix_data:
291      Flag for indicating the presence of new downmixing data
292      in the current frame.
293      0 - no "new" dvb downmixing data
294      1 - dvb downmixing data available
295 
296 mpeg_audio_type:
297      2-bits value indicating mpeg audio type.
298      0 - Reserved
299      1,2 - MPEG1 and MPEG2 Audio data.
300      3 - MPEG4 Audio data.
301 (Refer Section C.4.2.3 and C.5.2.2.1 of ETSI TS 101 154 V1.9.1 document )
302 
303 dolby_surround_mode:
304      2-bits value indicating dolby surround mode.
305      0,3 - Reserved
306      1 - 2-ch audio is not dolby surround encoded.
307      2 - 2-ch audio is dolby surround encoded.
308 (Refer Section C.4.2.4 and C.5.2.2.2 of ETSI TS 101 154 V1.9.1 document )
309 
310 center_mix_level_on:
311      Flag for the presence of center_mix_level_value.
312      0 or 1 are valid values(Refer to ETSI TS 101 154 V1.9.1)
313 center_mix_level_value;
314      3-bit value for the downmix factor for mixing the center channel
315      into the stereo output. Values refer to ETSI TS 101 154 V1.9.1
316 surround_mix_level_on:
317      Flag for the presence of surround_mix_level_value
318      0 or 1 are valid values(Refer to ETSI TS 101 154 V1.9.1)
319 surround_mix_level_value:
320      3-bit value for the downmix factor for mixing the left and
321      right surrond into the stereo output.
322      Values refer to ETSI TS 101 154 V1.9.1
323 (Refer Section C.4.2.10 and C.5.2.4 of ETSI TS 101 154 V1.9.1 document for the above)
324 
325 coarse_grain_timecode_on;
326 fine_grain_timecode_on;
327      2 bit flags indicating whether the coarse or fine time codes are present or not.
328 coarse_grain_timecode_value;
329 fine_grain_timecode_value;
330      14 bit values containing the coarse or fine grain_timecode values.
331 (Refer Section C.4.2.13 / C.4.2.14 and C.5.2.4 of ETSI TS 101 154 V1.9.1 document )
332 
333 (Details about timecodes:
334 Resetting of corse_grain_timecode_value based on (coarse_grain_timecode_on == '10') shall NOT
335 be done by the library. Same shall be true true of fine_grain_time_code_value.
336 
337 For MPEG4, if the status bit coarse_grain_timecode_status is 0, then both
338 coarse_grain_timecode_on;
339 coarse_grain_timecode_value;
340 shall be set to 0.
341 Same shall hold true for fine_grain_timecode values.)
342 
343 */
344 
345 typedef struct {
346   UWORD8 new_dvb_downmix_data;
347   UWORD8 mpeg_audio_type;
348   UWORD8 dolby_surround_mode;
349   UWORD8 center_mix_level_on;
350   UWORD8 center_mix_level_value;
351   UWORD8 surround_mix_level_on;
352   UWORD8 surround_mix_level_value;
353   UWORD8 coarse_grain_timecode_on;
354   UWORD coarse_grain_timecode_value;
355   UWORD8 fine_grain_timecode_on;
356   UWORD fine_grain_timecode_value;
357 } xa_aac_dec_dwnmix_level_dvb_info_t;
358 
359 #define MAX_NUM_CHANNELS   8
360 #define MAX_NUM_DRC_BANDS    16
361 /*
362   drc_info_valid: Flag to indicate if the rest of the nine elements in
363                 structure are valid (1) or not (0) for current frame.
364   The definition and values of the rest of the nine elements are
365                 the same as defined in Table 4.52 of ISO/IEC 14496-3.
366 */
367 typedef struct {
368   unsigned char drc_info_valid;
369   unsigned char exclude_masks[MAX_NUM_CHANNELS];
370   unsigned char drc_bands_present;
371   unsigned char drc_interpolation_scheme;
372   unsigned char drc_num_bands;
373   unsigned char drc_band_incr;
374   unsigned char drc_band_top[MAX_NUM_DRC_BANDS];
375   unsigned char prog_ref_level_present;
376   unsigned char prog_ref_level;
377   char dyn_rng_dbx4[MAX_NUM_DRC_BANDS];
378 } xa_aac_dec_parsed_drc_info_t;
379 
380 typedef struct _xa_aac_dec_parsed_pce_info_t
381 {
382     /* Number of elements */
383     UWORD8  num_front_channel_elements;
384     UWORD8  num_side_channel_elements;
385     UWORD8  num_back_channel_elements;
386     UWORD8  num_lfe_channel_elements;
387 
388     /* channels per element */
389     UWORD8  num_front_channels_per_element[16];
390     UWORD8  num_side_channels_per_element[16];
391     UWORD8  num_back_channels_per_element[16];
392     UWORD8  num_lfe_channels_per_element[16];
393 
394     /* channel height info */
395     UWORD8  front_element_height_info[16];
396     UWORD8  side_element_height_info[16];
397     UWORD8  back_element_height_info[16];
398 }xa_aac_dec_parsed_pce_info_t;
399 
400 #if defined(USE_DLL) && defined(_WIN32)
401 #define DLL_SHARED __declspec(dllimport)
402 #elif defined (_WINDLL)
403 #define DLL_SHARED __declspec(dllexport)
404 #else
405 #define DLL_SHARED
406 #endif
407 
408 #if defined(__cplusplus)
409 extern "C" {
410 #endif  /* __cplusplus */
411 DLL_SHARED xa_codec_func_t xa_aac_dec;
412 DLL_SHARED xa_codec_func_t xa_dabplus_dec;
413 #if defined(__cplusplus)
414 }
415 #endif  /* __cplusplus */
416 
417 #endif /* __XA_AAC_DEC_API_H__ */
418