bowen liu / Mbed OS mbed-os-example-blinky

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mp3common.h Source File

mp3common.h

00001 /* ***** BEGIN LICENSE BLOCK ***** 
00002  * Version: RCSL 1.0/RPSL 1.0 
00003  *  
00004  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
00005  *      
00006  * The contents of this file, and the files included with this file, are 
00007  * subject to the current version of the RealNetworks Public Source License 
00008  * Version 1.0 (the "RPSL") available at 
00009  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
00010  * the file under the RealNetworks Community Source License Version 1.0 
00011  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
00012  * in which case the RCSL will apply. You may also obtain the license terms 
00013  * directly from RealNetworks.  You may not use this file except in 
00014  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
00015  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
00016  * RCSL for the rights, obligations and limitations governing use of the 
00017  * contents of the file.  
00018  *  
00019  * This file is part of the Helix DNA Technology. RealNetworks is the 
00020  * developer of the Original Code and owns the copyrights in the portions 
00021  * it created. 
00022  *  
00023  * This file, and the files included with this file, is distributed and made 
00024  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
00025  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
00026  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
00027  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
00028  * 
00029  * Technology Compatibility Kit Test Suite(s) Location: 
00030  *    http://www.helixcommunity.org/content/tck 
00031  * 
00032  * Contributor(s): 
00033  *  
00034  * ***** END LICENSE BLOCK ***** */ 
00035 
00036 /**************************************************************************************
00037  * Fixed-point MP3 decoder
00038  * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com)
00039  * June 2003
00040  *
00041  * mp3common.h - implementation-independent API's, datatypes, and definitions
00042  **************************************************************************************/
00043 
00044 #ifndef _MP3COMMON_H
00045 #define _MP3COMMON_H
00046 
00047 #include "mp3dec.h"
00048 #include "statname.h"   /* do name-mangling for static linking */
00049 
00050 #define MAX_SCFBD       4       /* max scalefactor bands per channel */
00051 #define NGRANS_MPEG1    2
00052 #define NGRANS_MPEG2    1
00053 
00054 /* 11-bit syncword if MPEG 2.5 extensions are enabled */
00055 #define SYNCWORDH       0xff
00056 #define SYNCWORDL       0xe0
00057 
00058 /* 12-bit syncword if MPEG 1,2 only are supported 
00059  * #define  SYNCWORDH       0xff
00060  * #define  SYNCWORDL       0xf0
00061  */
00062 
00063 typedef struct _MP3DecInfo {
00064     /* pointers to platform-specific data structures */
00065     void *FrameHeaderPS;
00066     void *SideInfoPS;
00067     void *ScaleFactorInfoPS;
00068     void *HuffmanInfoPS;
00069     void *DequantInfoPS;
00070     void *IMDCTInfoPS;
00071     void *SubbandInfoPS;
00072 
00073     /* buffer which must be large enough to hold largest possible main_data section */
00074     unsigned char mainBuf[MAINBUF_SIZE];
00075 
00076     /* special info for "free" bitrate files */
00077     int freeBitrateFlag;
00078     int freeBitrateSlots;
00079 
00080     /* user-accessible info */
00081     int bitrate;
00082     int nChans;
00083     int samprate;
00084     int nGrans;             /* granules per frame */
00085     int nGranSamps;         /* samples per granule */
00086     int nSlots;
00087     int layer;
00088     MPEGVersion version;
00089 
00090     int mainDataBegin;
00091     int mainDataBytes;
00092 
00093     int part23Length[MAX_NGRAN][MAX_NCHAN];
00094 
00095 } MP3DecInfo;
00096 
00097 typedef struct _SFBandTable {
00098     short l[23];
00099     short s[14];
00100 } SFBandTable;
00101 
00102 /* decoder functions which must be implemented for each platform */
00103 MP3DecInfo *AllocateBuffers(void);
00104 void FreeBuffers(MP3DecInfo *mp3DecInfo);
00105 int CheckPadBit(MP3DecInfo *mp3DecInfo);
00106 int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, unsigned char *buf);
00107 int UnpackSideInfo(MP3DecInfo *mp3DecInfo, unsigned char *buf);
00108 int DecodeHuffman(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch);
00109 int Dequantize(MP3DecInfo *mp3DecInfo, int gr);
00110 int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch);
00111 int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch);
00112 int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf);
00113 
00114 /* mp3tabs.c - global ROM tables */
00115 extern const int samplerateTab[3][3];
00116 extern const short bitrateTab[3][3][15];
00117 extern const short samplesPerFrameTab[3][3];
00118 extern const short bitsPerSlotTab[3];
00119 extern const short sideBytesTab[3][2];
00120 extern const short slotTab[3][3][15];
00121 extern const SFBandTable sfBandTable[3][3];
00122 
00123 #endif  /* _MP3COMMON_H */