FastLED 3.9.15
Loading...
Searching...
No Matches
mp3common.h
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 * mp3common.h - implementation-independent API's, datatypes, and definitions
42 **************************************************************************************/
43
44#ifndef _MP3COMMON_H
45#define _MP3COMMON_H
46
47#include "fl/stl/stdint.h" // MUST be first - defines int32_t used in inline functions
48#include "fl/stl/noexcept.h"
49#include "mp3dec.h"
50#include "statname.h" /* do name-mangling for static linking */
51
52#define MAX_SCFBD 4 /* max scalefactor bands per channel */
53#define NGRANS_MPEG1 2
54#define NGRANS_MPEG2 1
55
56/* 11-bit syncword if MPEG 2.5 extensions are enabled */
57/*
58#define SYNCWORDH 0xff
59#define SYNCWORDL 0xe0
60*/
61
62/* 12-bit syncword if MPEG 1,2 only are supported */
63#define SYNCWORDH 0xff
64#define SYNCWORDL 0xf0
65
66typedef struct _MP3DecInfo {
67 /* pointers to platform-specific data structures */
75
76 /* buffer which must be large enough to hold largest possible main_data section */
77 unsigned char mainBuf[MAINBUF_SIZE];
78
79 /* special info for "free" bitrate files */
82
83 /* user-accessible info */
85 int nChans;
87 int nGrans; /* granules per frame */
88 int nGranSamps; /* samples per granule */
89 int nSlots;
90 int layer;
92
95
97
99
100namespace fl {
101namespace third_party {
102
103typedef struct _SFBandTable {
104 short l[23];
105 short s[14];
107
108/* decoder functions which must be implemented for each platform */
110void FreeBuffers(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT;
111int CheckPadBit(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT;
112int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT;
113int UnpackSideInfo(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT;
114int DecodeHuffman(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) FL_NOEXCEPT;
115int Dequantize(MP3DecInfo *mp3DecInfo, int gr) FL_NOEXCEPT;
116int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch) FL_NOEXCEPT;
117int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) FL_NOEXCEPT;
118int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf) FL_NOEXCEPT;
119
120/* mp3tabs.c - global ROM tables */
121extern const int32_t samplerateTab[3][3];
122extern const short bitrateTab[3][3][15];
123extern const short samplesPerFrameTab[3][3];
124extern const short bitsPerSlotTab[3];
125extern const short sideBytesTab[3][2];
126extern const short slotTab[3][3][15];
127extern const SFBandTable sfBandTable[3][3];
128
129} // namespace third_party
130} // namespace fl
131
132#endif /* _MP3COMMON_H */
struct _MP3DecInfo MP3DecInfo
void * IMDCTInfoPS
Definition mp3common.h:73
MPEGVersion version
Definition mp3common.h:91
int part23Length[MAX_NGRAN][MAX_NCHAN]
Definition mp3common.h:96
int mainDataBegin
Definition mp3common.h:93
int mainDataBytes
Definition mp3common.h:94
void * FrameHeaderPS
Definition mp3common.h:68
void * DequantInfoPS
Definition mp3common.h:72
void * ScaleFactorInfoPS
Definition mp3common.h:70
void * SideInfoPS
Definition mp3common.h:69
int freeBitrateSlots
Definition mp3common.h:81
void * HuffmanInfoPS
Definition mp3common.h:71
unsigned char mainBuf[MAINBUF_SIZE]
Definition mp3common.h:77
void * SubbandInfoPS
Definition mp3common.h:74
int freeBitrateFlag
Definition mp3common.h:80
int nGranSamps
Definition mp3common.h:88
#define MAX_NCHAN
Definition mp3dec.h:78
MPEGVersion
Definition mp3dec.h:82
#define MAINBUF_SIZE
Definition mp3dec.h:75
#define MAX_NGRAN
Definition mp3dec.h:77
int Dequantize(MP3DecInfo *mp3DecInfo, int gr) FL_NOEXCEPT
Definition dequant.hpp:78
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
int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch) FL_NOEXCEPT
Definition scalfact.hpp:357
const int32_t samplerateTab[3][3]
Definition mp3tabs.hpp:53
const short bitsPerSlotTab[3]
Definition mp3tabs.hpp:95
int UnpackSideInfo(MP3DecInfo *mp3DecInfo, const unsigned char *buf) FL_NOEXCEPT
const short samplesPerFrameTab[3][3]
Definition mp3tabs.hpp:88
int DecodeHuffman(MP3DecInfo *mp3DecInfo, const unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch) FL_NOEXCEPT
Definition huffman.hpp:385
void FreeBuffers(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
Definition buffers.hpp:163
int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch) FL_NOEXCEPT
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
MP3DecInfo * AllocateBuffers(void) FL_NOEXCEPT
Definition buffers.hpp:99
int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf) FL_NOEXCEPT
Definition subband.hpp:65
int CheckPadBit(MP3DecInfo *mp3DecInfo) FL_NOEXCEPT
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT