OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
mp3tabs.c
Go to the documentation of this file.
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: RCSL 1.0/RPSL 1.0
3 *
4 * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
5 *
6 * The contents of this file, and the files included with this file, are
7 * subject to the current version of the RealNetworks Public Source License
8 * Version 1.0 (the "RPSL") available at
9 * http://www.helixcommunity.org/content/rpsl unless you have licensed
10 * the file under the RealNetworks Community Source License Version 1.0
11 * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
12 * in which case the RCSL will apply. You may also obtain the license terms
13 * directly from RealNetworks. You may not use this file except in
14 * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
15 * applicable to this file, the RCSL. Please see the applicable RPSL or
16 * RCSL for the rights, obligations and limitations governing use of the
17 * contents of the file.
18 *
19 * This file is part of the Helix DNA Technology. RealNetworks is the
20 * developer of the Original Code and owns the copyrights in the portions
21 * it created.
22 *
23 * This file, and the files included with this file, is distributed and made
24 * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
25 * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
26 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
27 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
28 *
29 * Technology Compatibility Kit Test Suite(s) Location:
30 * http://www.helixcommunity.org/content/tck
31 *
32 * Contributor(s):
33 *
34 * ***** END LICENSE BLOCK ***** */
35
36/**************************************************************************************
37 * Fixed-point MP3 decoder
38 * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
39 * June 2003
40 *
41 * mp3tabs.c - platform-independent tables for MP3 decoder (global, read-only)
42 **************************************************************************************/
43
44#include "mp3common.h"
45
46/* indexing = [version][samplerate index]
47 * sample rate of frame (Hz)
48 */
49const int samplerateTab[3][3] = {
50 {44100, 48000, 32000}, /* MPEG-1 */
51 {22050, 24000, 16000}, /* MPEG-2 */
52 {11025, 12000, 8000}, /* MPEG-2.5 */
53};
54
55/* indexing = [version][layer][bitrate index]
56 * bitrate (kbps) of frame
57 * - bitrate index == 0 is "free" mode (bitrate determined on the fly by
58 * counting bits between successive sync words)
59 */
60const short bitrateTab[3][3][15] = {
61 {
62 /* MPEG-1 */
63 { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448}, /* Layer 1 */
64 { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384}, /* Layer 2 */
65 { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320}, /* Layer 3 */
66 },
67 {
68 /* MPEG-2 */
69 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
70 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
71 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
72 },
73 {
74 /* MPEG-2.5 */
75 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
76 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
77 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
78 },
79};
80
81/* indexing = [version][layer]
82 * number of samples in one frame (per channel)
83 */
84const short samplesPerFrameTab[3][3] = {
85 {384, 1152, 1152 }, /* MPEG1 */
86 {384, 1152, 576 }, /* MPEG2 */
87 {384, 1152, 576 }, /* MPEG2.5 */
88};
89
90/* layers 1, 2, 3 */
91const short bitsPerSlotTab[3] = {32, 8, 8};
92
93/* indexing = [version][mono/stereo]
94 * number of bytes in side info section of bitstream
95 */
96const short sideBytesTab[3][2] = {
97 {17, 32}, /* MPEG-1: mono, stereo */
98 { 9, 17}, /* MPEG-2: mono, stereo */
99 { 9, 17}, /* MPEG-2.5: mono, stereo */
100};
101
102/* indexing = [version][sampleRate][bitRate]
103 * for layer3, nSlots = floor(samps/frame * bitRate / sampleRate / 8)
104 * - add one pad slot if necessary
105 */
106const short slotTab[3][3][15] = {
107 {
108 /* MPEG-1 */
109 { 0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835,1044 }, /* 44 kHz */
110 { 0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960 }, /* 48 kHz */
111 { 0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864,1008,1152,1440 }, /* 32 kHz */
112 },
113 {
114 /* MPEG-2 */
115 { 0, 26, 52, 78, 104, 130, 156, 182, 208, 261, 313, 365, 417, 470, 522 }, /* 22 kHz */
116 { 0, 24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480 }, /* 24 kHz */
117 { 0, 36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720 }, /* 16 kHz */
118 },
119 {
120 /* MPEG-2.5 */
121 { 0, 52, 104, 156, 208, 261, 313, 365, 417, 522, 626, 731, 835, 940,1044 }, /* 11 kHz */
122 { 0, 48, 96, 144, 192, 240, 288, 336, 384, 480, 576, 672, 768, 864, 960 }, /* 12 kHz */
123 { 0, 72, 144, 216, 288, 360, 432, 504, 576, 720, 864,1008,1152,1296,1440 }, /* 8 kHz */
124 },
125};
126
127/* indexing = [version][sampleRate][long (.l) or short (.s) block]
128 * sfBandTable[v][s].l[cb] = index of first bin in critical band cb (long blocks)
129 * sfBandTable[v][s].s[cb] = index of first bin in critical band cb (short blocks)
130 */
132 {
133 /* MPEG-1 (44, 48, 32 kHz) */
134 {
135 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90,110,134,162,196,238,288,342,418,576 },
136 { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84,106,136,192 }
137 },
138 {
139 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88,106,128,156,190,230,276,330,384,576 },
140 { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80,100,126,192 }
141 },
142 {
143 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82,102,126,156,194,240,296,364,448,550,576 },
144 { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78,104,138,180,192 }
145 }
146 },
147
148 {
149 /* MPEG-2 (22, 24, 16 kHz) */
150 {
151 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
152 { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74,100,132,174,192 }
153 },
154 {
155 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,114,136,162,194,232,278,332,394,464,540,576 },
156 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,136,180,192 }
157 },
158 {
159 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
160 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
161 },
162 },
163
164 {
165 /* MPEG-2.5 (11, 12, 8 kHz) */
166 {
167 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
168 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
169 },
170 {
171 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
172 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
173 },
174 {
175 { 0, 12, 24, 36, 48, 60, 72, 88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576 },
176 { 0, 8, 16, 24, 36, 52, 72, 96,124,160,162,164,166,192 }
177 },
178 },
179};
180
181
const short sideBytesTab[3][2]
Definition mp3tabs.c:96
const short bitsPerSlotTab[3]
Definition mp3tabs.c:91
const short bitrateTab[3][3][15]
Definition mp3tabs.c:60
const short slotTab[3][3][15]
Definition mp3tabs.c:106
const short samplesPerFrameTab[3][3]
Definition mp3tabs.c:84
const int samplerateTab[3][3]
Definition mp3tabs.c:49
const SFBandTable sfBandTable[3][3]
Definition mp3tabs.c:131