1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef MP3_DEF_H_ |
|
21 #define MP3_DEF_H_ |
|
22 |
|
23 /*- Project Headers. --*/ |
|
24 #include "defines.h" |
|
25 |
|
26 /************************************************************************** |
|
27 External Objects Provided |
|
28 *************************************************************************/ |
|
29 |
|
30 /*-- General MPx Definitions. --*/ |
|
31 #ifndef PI |
|
32 #define PI (3.14159265358979) |
|
33 #endif |
|
34 #define MPEG_AUDIO_ID (1) |
|
35 #define MPEG_PHASE2_LSF (0) |
|
36 #define SBLIMIT (32) |
|
37 #define SSLIMIT (18) |
|
38 #define MAX_MONO_SAMPLES (SBLIMIT * SSLIMIT) |
|
39 #define HAN_SIZE (512) |
|
40 #define NUM_SUBWIN (16) |
|
41 #define SCALE (32768L) |
|
42 #define SYNC_WORD ((long) 0x7ff) |
|
43 #define SYNC_WORD_LENGTH (11) |
|
44 #define HEADER_BITS (20) |
|
45 #define MAX_LONG_SFB_BANDS (22) |
|
46 #define MAX_SHORT_SFB_BANDS (13) |
|
47 #define MIN_MP3FRAMELEN (1440) |
|
48 #define MAX_BITRESER_SIZE (512) |
|
49 #define CRC_MAX_PAYLOAD (34) |
|
50 |
|
51 /*-- MPEG Header Definitions - Mode Values --*/ |
|
52 #define MPG_MD_STEREO (0) |
|
53 #define MPG_MD_JOINT_STEREO (1) |
|
54 #define MPG_MD_DUAL_CHANNEL (2) |
|
55 #define MPG_MD_MONO (3) |
|
56 |
|
57 /*-- Some Useful Macros. --*/ |
|
58 #ifdef MIN |
|
59 #undef MIN |
|
60 #endif |
|
61 #define MIN(A, B) ((A) < (B) ? (A) : (B)) |
|
62 |
|
63 #ifdef MAX |
|
64 #undef MAX |
|
65 #endif |
|
66 #define MAX(A, B) ((A) > (B) ? (A) : (B)) |
|
67 |
|
68 /*-- Channel definitions. --*/ |
|
69 #define MONO_CHAN (0) |
|
70 //#define MAX_CHANNELS (2) |
|
71 #define LEFT_CHANNEL (MONO_CHAN) |
|
72 #define RIGHT_CHANNEL (MONO_CHAN + 1) |
|
73 |
|
74 /* |
|
75 Purpose: Masks those bit fields from the header to zero that |
|
76 do not remain fixed from frame to frame. |
|
77 Explanation: Following fields are assumed to be fixed : |
|
78 * 12th bit from the sync word |
|
79 * version |
|
80 * layer description |
|
81 * sampling rate |
|
82 * channel mode (layer 3 only) |
|
83 * copyright bit |
|
84 * original bit |
|
85 * de-emphasis |
|
86 |
|
87 Following fields can vary from frame to frame : |
|
88 * protection bit |
|
89 * bit rate |
|
90 * padding bit |
|
91 * private bit |
|
92 * channel mode extension |
|
93 */ |
|
94 #define HEADER_MASK(header) ((uint32)header & 0x001E0CCF) |
|
95 |
|
96 /* |
|
97 Purpose: Macro to extract layer description. |
|
98 Explanation: This is the bit value, use MP_Header::layer_number method |
|
99 to interpret this value. */ |
|
100 #define LAYER_MASK(header) (((uint32)header >> 17) & 3) |
|
101 |
|
102 /* |
|
103 Purpose: Layer III flags. |
|
104 Explanation: - */ |
|
105 typedef enum LayerIIIFlags |
|
106 { |
|
107 WINDOW_SWITCHING_FLAG = 4, |
|
108 MIXED_BLOCK_FLAG = 8, |
|
109 PRE_FLAG = 16, |
|
110 SCALEFAC_SCALE = 32, |
|
111 COUNT_1_TABLE_SELECT = 64 |
|
112 |
|
113 } Layer_III_Flags; |
|
114 |
|
115 /* |
|
116 Purpose: Stereo modes for layer III. |
|
117 Explanation: - */ |
|
118 typedef enum StereoMode |
|
119 { |
|
120 ONLY_MONO, |
|
121 ONLY_STEREO, |
|
122 MS_STEREO, |
|
123 IS_STEREO, |
|
124 LSF_IS_STEREO |
|
125 |
|
126 } StereoMode; |
|
127 |
|
128 /* |
|
129 Purpose: Block types for layer III. |
|
130 Explanation: The first four describe the actual block type for each subband, |
|
131 the rest of the declarations describe the block type for the |
|
132 whole frame. */ |
|
133 |
|
134 typedef enum MP3_WINDOW_TYPE |
|
135 { |
|
136 ONLY_LONG_WINDOW, |
|
137 LONG_SHORT_WINDOW, |
|
138 ONLY_SHORT_WINDOW, |
|
139 SHORT_LONG_WINDOW, |
|
140 MIXED_BLOCK_MODE, |
|
141 SHORT_BLOCK_MODE, |
|
142 LONG_BLOCK_MODE |
|
143 |
|
144 } MP3_WINDOW_TYPE, MP3WindowType; |
|
145 |
|
146 /* |
|
147 Purpose: Structure to hold scalefactor band parameters. |
|
148 Explanation: - */ |
|
149 typedef struct SFBAND_DATA_STR |
|
150 { |
|
151 int16 l[23]; /* long block. */ |
|
152 int16 s[14]; /* short block. */ |
|
153 |
|
154 } SFBAND_DATA; |
|
155 |
|
156 /* |
|
157 Purpose: Number of bits reserved for decoding each group |
|
158 of scalefactors. |
|
159 Explanation: - */ |
|
160 typedef struct SFBITS_DATA_STR |
|
161 { |
|
162 int16 l[5]; |
|
163 int16 s[3]; |
|
164 |
|
165 } SFBITS_DATA; |
|
166 |
|
167 /* |
|
168 Purpose: Sync seek code. |
|
169 Explanation: - */ |
|
170 typedef enum MIX_SYNC_STATUS |
|
171 { |
|
172 LAYER1_STREAM_MIX, |
|
173 LAYER2_STREAM_MIX, |
|
174 LAYER3_STREAM_MIX, |
|
175 FIRST_FRAME_WITH_LAYER1, |
|
176 FIRST_FRAME_WITH_LAYER2, |
|
177 FIRST_FRAME_WITH_LAYER3 |
|
178 |
|
179 } MIX_SYNC_STATUS; |
|
180 |
|
181 #endif /* MP3_DEF_H_ */ |
|