10725
|
1 /*
|
|
2 ** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
|
|
3 ** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
|
|
4 **
|
|
5 ** This program is free software; you can redistribute it and/or modify
|
|
6 ** it under the terms of the GNU General Public License as published by
|
|
7 ** the Free Software Foundation; either version 2 of the License, or
|
|
8 ** (at your option) any later version.
|
|
9 **
|
|
10 ** This program is distributed in the hope that it will be useful,
|
|
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 ** GNU General Public License for more details.
|
|
14 **
|
|
15 ** You should have received a copy of the GNU General Public License
|
|
16 ** along with this program; if not, write to the Free Software
|
|
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
18 **
|
|
19 ** Any non-GPL usage of this software or parts of this software is strictly
|
|
20 ** forbidden.
|
|
21 **
|
|
22 ** Commercial non-GPL licensing of this software is possible.
|
|
23 ** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
|
|
24 **
|
|
25 ** $Id: syntax.h,v 1.32 2003/07/29 08:20:14 menno Exp $
|
|
26 **/
|
|
27
|
|
28 #ifndef __SYNTAX_H__
|
|
29 #define __SYNTAX_H__
|
|
30
|
|
31 #ifdef __cplusplus
|
|
32 extern "C" {
|
|
33 #endif
|
|
34
|
|
35 #include "decoder.h"
|
|
36 #include "drc.h"
|
|
37 #include "bits.h"
|
|
38
|
|
39 #define MAIN 0
|
|
40 #define LC 1
|
|
41 #define SSR 2
|
|
42 #define LTP 3
|
|
43 #define LD 23
|
|
44 #define ER_LC 17
|
|
45 #define ER_LTP 19
|
|
46 #define DRM_ER_LC 27 /* special object type for DRM */
|
|
47
|
|
48
|
|
49 /* First object type that has ER */
|
|
50 #define ER_OBJECT_START 17
|
|
51
|
|
52
|
|
53 /* Bitstream */
|
|
54 #define LEN_SE_ID 3
|
|
55 #define LEN_TAG 4
|
|
56 #define LEN_BYTE 8
|
|
57
|
|
58 #define EXT_FIL 0
|
|
59 #define EXT_FILL_DATA 1
|
|
60 #define EXT_DATA_ELEMENT 2
|
|
61 #define EXT_DYNAMIC_RANGE 11
|
|
62 #define ANC_DATA 0
|
|
63
|
|
64 /* Syntax elements */
|
|
65 #define ID_SCE 0x0
|
|
66 #define ID_CPE 0x1
|
|
67 #define ID_CCE 0x2
|
|
68 #define ID_LFE 0x3
|
|
69 #define ID_DSE 0x4
|
|
70 #define ID_PCE 0x5
|
|
71 #define ID_FIL 0x6
|
|
72 #define ID_END 0x7
|
|
73
|
|
74 #define ONLY_LONG_SEQUENCE 0x0
|
|
75 #define LONG_START_SEQUENCE 0x1
|
|
76 #define EIGHT_SHORT_SEQUENCE 0x2
|
|
77 #define LONG_STOP_SEQUENCE 0x3
|
|
78
|
|
79 #define ZERO_HCB 0
|
|
80 #define FIRST_PAIR_HCB 5
|
|
81 #define ESC_HCB 11
|
|
82 #define QUAD_LEN 4
|
|
83 #define PAIR_LEN 2
|
|
84 #define NOISE_HCB 13
|
|
85 #define INTENSITY_HCB2 14
|
|
86 #define INTENSITY_HCB 15
|
|
87
|
|
88 static uint32_t sample_rates[] =
|
|
89 {
|
|
90 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000,
|
|
91 12000, 11025, 8000
|
|
92 };
|
|
93
|
|
94 int8_t GASpecificConfig(bitfile *ld, mp4AudioSpecificConfig *mp4ASC,
|
|
95 program_config *pce);
|
|
96
|
|
97 uint8_t adts_frame(adts_header *adts, bitfile *ld);
|
|
98 void get_adif_header(adif_header *adif, bitfile *ld);
|
|
99
|
|
100
|
|
101 /* static functions */
|
|
102 static uint8_t single_lfe_channel_element(faacDecHandle hDecoder,
|
|
103 element *sce, bitfile *ld,
|
|
104 int16_t *spec_data);
|
|
105 static uint8_t channel_pair_element(faacDecHandle hDecoder, element *cpe,
|
|
106 bitfile *ld, int16_t *spec_data1,
|
|
107 int16_t *spec_data2);
|
|
108 static uint8_t coupling_channel_element(faacDecHandle hDecoder, bitfile *ld);
|
|
109 static uint16_t data_stream_element(faacDecHandle hDecoder, bitfile *ld);
|
|
110 static uint8_t program_config_element(program_config *pce, bitfile *ld);
|
|
111 static uint8_t fill_element(faacDecHandle hDecoder, bitfile *ld, drc_info *drc
|
|
112 #ifdef SBR_DEC
|
|
113 ,uint8_t sbr_ele
|
|
114 #endif
|
|
115 );
|
|
116 static uint8_t individual_channel_stream(faacDecHandle hDecoder, element *ele,
|
|
117 bitfile *ld, ic_stream *ics, uint8_t scal_flag,
|
|
118 int16_t *spec_data);
|
|
119 static uint8_t ics_info(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
|
|
120 uint8_t common_window);
|
|
121 static uint8_t section_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
|
|
122 static uint8_t scale_factor_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld);
|
|
123 static void gain_control_data(bitfile *ld, ic_stream *ics);
|
|
124 static uint8_t spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
|
|
125 int16_t *spectral_data);
|
|
126 static uint16_t extension_payload(bitfile *ld, drc_info *drc, uint16_t count);
|
|
127 #ifdef ERROR_RESILIENCE
|
|
128 uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics,
|
|
129 bitfile *ld, int16_t *spectral_data);
|
|
130 #endif
|
|
131 static uint8_t pulse_data(ic_stream *ics, pulse_info *pul, bitfile *ld);
|
|
132 static void tns_data(ic_stream *ics, tns_info *tns, bitfile *ld);
|
|
133 static void ltp_data(faacDecHandle hDecoder, ic_stream *ics, ltp_info *ltp, bitfile *ld);
|
|
134 static uint8_t adts_fixed_header(adts_header *adts, bitfile *ld);
|
|
135 static void adts_variable_header(adts_header *adts, bitfile *ld);
|
|
136 static void adts_error_check(adts_header *adts, bitfile *ld);
|
|
137 static uint8_t dynamic_range_info(bitfile *ld, drc_info *drc);
|
|
138 static uint8_t excluded_channels(bitfile *ld, drc_info *drc);
|
|
139
|
|
140
|
|
141 #ifdef __cplusplus
|
|
142 }
|
|
143 #endif
|
|
144 #endif
|