FastLED 3.9.15
Loading...
Searching...
No Matches
mp3tabs.hpp
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 "pub/mp3common.h"
45#include "fl/stl/stdint.h"
46
47namespace fl {
48namespace third_party {
49
50/* indexing = [version][samplerate index]
51 * sample rate of frame (Hz)
52 */
53const int32_t samplerateTab[3][3] = {
54 {44100, 48000, 32000}, /* MPEG-1 */
55 {22050, 24000, 16000}, /* MPEG-2 */
56 {11025, 12000, 8000}, /* MPEG-2.5 */
57};
58
59/* indexing = [version][layer][bitrate index]
60 * bitrate (kbps) of frame
61 * - bitrate index == 0 is "free" mode (bitrate determined on the fly by
62 * counting bits between successive sync words)
63 */
64const short bitrateTab[3][3][15] = {
65 {
66 /* MPEG-1 */
67 { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448}, /* Layer 1 */
68 { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384}, /* Layer 2 */
69 { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320}, /* Layer 3 */
70 },
71 {
72 /* MPEG-2 */
73 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
74 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
75 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
76 },
77 {
78 /* MPEG-2.5 */
79 { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, /* Layer 1 */
80 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 2 */
81 { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, /* Layer 3 */
82 },
83};
84
85/* indexing = [version][layer]
86 * number of samples in one frame (per channel)
87 */
88const short samplesPerFrameTab[3][3] = {
89 {384, 1152, 1152 }, /* MPEG1 */
90 {384, 1152, 576 }, /* MPEG2 */
91 {384, 1152, 576 }, /* MPEG2.5 */
92};
93
94/* layers 1, 2, 3 */
95const short bitsPerSlotTab[3] = {32, 8, 8};
96
97/* indexing = [version][mono/stereo]
98 * number of bytes in side info section of bitstream
99 */
100const short sideBytesTab[3][2] = {
101 {17, 32}, /* MPEG-1: mono, stereo */
102 { 9, 17}, /* MPEG-2: mono, stereo */
103 { 9, 17}, /* MPEG-2.5: mono, stereo */
104};
105
106/* indexing = [version][sampleRate][bitRate]
107 * for layer3, nSlots = floor(samps/frame * bitRate / sampleRate / 8)
108 * - add one pad slot if necessary
109 */
110const short slotTab[3][3][15] = {
111 {
112 /* MPEG-1 */
113 { 0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835,1044 }, /* 44 kHz */
114 { 0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960 }, /* 48 kHz */
115 { 0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864,1008,1152,1440 }, /* 32 kHz */
116 },
117 {
118 /* MPEG-2 */
119 { 0, 26, 52, 78, 104, 130, 156, 182, 208, 261, 313, 365, 417, 470, 522 }, /* 22 kHz */
120 { 0, 24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480 }, /* 24 kHz */
121 { 0, 36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720 }, /* 16 kHz */
122 },
123 {
124 /* MPEG-2.5 */
125 { 0, 52, 104, 156, 208, 261, 313, 365, 417, 522, 626, 731, 835, 940,1044 }, /* 11 kHz */
126 { 0, 48, 96, 144, 192, 240, 288, 336, 384, 480, 576, 672, 768, 864, 960 }, /* 12 kHz */
127 { 0, 72, 144, 216, 288, 360, 432, 504, 576, 720, 864,1008,1152,1296,1440 }, /* 8 kHz */
128 },
129};
130
131/* indexing = [version][sampleRate][long (.l) or short (.s) block]
132 * sfBandTable[v][s].l[cb] = index of first bin in critical band cb (long blocks)
133 * sfBandTable[v][s].s[cb] = index of first bin in critical band cb (short blocks)
134 */
136 {
137 /* MPEG-1 (44, 48, 32 kHz) */
138 {
139 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90,110,134,162,196,238,288,342,418,576 },
140 { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84,106,136,192 }
141 },
142 {
143 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88,106,128,156,190,230,276,330,384,576 },
144 { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80,100,126,192 }
145 },
146 {
147 { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82,102,126,156,194,240,296,364,448,550,576 },
148 { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78,104,138,180,192 }
149 }
150 },
151
152 {
153 /* MPEG-2 (22, 24, 16 kHz) */
154 {
155 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
156 { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74,100,132,174,192 }
157 },
158 {
159 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,114,136,162,194,232,278,332,394,464,540,576 },
160 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,136,180,192 }
161 },
162 {
163 { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
164 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
165 },
166 },
167
168 {
169 /* MPEG-2.5 (11, 12, 8 kHz) */
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, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96,116,140,168,200,238,284,336,396,464,522,576 },
176 { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80,104,134,174,192 }
177 },
178 {
179 { 0, 12, 24, 36, 48, 60, 72, 88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576 },
180 { 0, 8, 16, 24, 36, 52, 72, 96,124,160,162,164,166,192 }
181 },
182 },
183};
184
185} // namespace third_party
186} // namespace fl
struct fl::third_party::_SFBandTable SFBandTable
const short slotTab[3][3][15]
Definition mp3tabs.hpp:110
const short sideBytesTab[3][2]
Definition mp3tabs.hpp:100
const int32_t samplerateTab[3][3]
Definition mp3tabs.hpp:53
const short bitsPerSlotTab[3]
Definition mp3tabs.hpp:95
const short samplesPerFrameTab[3][3]
Definition mp3tabs.hpp:88
const SFBandTable sfBandTable[3][3]
Definition mp3tabs.hpp:135
fl::i32 int32_t
Definition coder.h:220
const short bitrateTab[3][3][15]
Definition mp3tabs.hpp:64
Base definition for an LED controller.
Definition crgb.hpp:179