ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/pub/mp3common.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | /* ***** BEGIN LICENSE BLOCK ***** |
| TMBOY | 47:9e361da97763 | 2 | * Version: RCSL 1.0/RPSL 1.0 |
| TMBOY | 47:9e361da97763 | 3 | * |
| TMBOY | 47:9e361da97763 | 4 | * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. |
| TMBOY | 47:9e361da97763 | 5 | * |
| TMBOY | 47:9e361da97763 | 6 | * The contents of this file, and the files included with this file, are |
| TMBOY | 47:9e361da97763 | 7 | * subject to the current version of the RealNetworks Public Source License |
| TMBOY | 47:9e361da97763 | 8 | * Version 1.0 (the "RPSL") available at |
| TMBOY | 47:9e361da97763 | 9 | * http://www.helixcommunity.org/content/rpsl unless you have licensed |
| TMBOY | 47:9e361da97763 | 10 | * the file under the RealNetworks Community Source License Version 1.0 |
| TMBOY | 47:9e361da97763 | 11 | * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, |
| TMBOY | 47:9e361da97763 | 12 | * in which case the RCSL will apply. You may also obtain the license terms |
| TMBOY | 47:9e361da97763 | 13 | * directly from RealNetworks. You may not use this file except in |
| TMBOY | 47:9e361da97763 | 14 | * compliance with the RPSL or, if you have a valid RCSL with RealNetworks |
| TMBOY | 47:9e361da97763 | 15 | * applicable to this file, the RCSL. Please see the applicable RPSL or |
| TMBOY | 47:9e361da97763 | 16 | * RCSL for the rights, obligations and limitations governing use of the |
| TMBOY | 47:9e361da97763 | 17 | * contents of the file. |
| TMBOY | 47:9e361da97763 | 18 | * |
| TMBOY | 47:9e361da97763 | 19 | * This file is part of the Helix DNA Technology. RealNetworks is the |
| TMBOY | 47:9e361da97763 | 20 | * developer of the Original Code and owns the copyrights in the portions |
| TMBOY | 47:9e361da97763 | 21 | * it created. |
| TMBOY | 47:9e361da97763 | 22 | * |
| TMBOY | 47:9e361da97763 | 23 | * This file, and the files included with this file, is distributed and made |
| TMBOY | 47:9e361da97763 | 24 | * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| TMBOY | 47:9e361da97763 | 25 | * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| TMBOY | 47:9e361da97763 | 26 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS |
| TMBOY | 47:9e361da97763 | 27 | * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| TMBOY | 47:9e361da97763 | 28 | * |
| TMBOY | 47:9e361da97763 | 29 | * Technology Compatibility Kit Test Suite(s) Location: |
| TMBOY | 47:9e361da97763 | 30 | * http://www.helixcommunity.org/content/tck |
| TMBOY | 47:9e361da97763 | 31 | * |
| TMBOY | 47:9e361da97763 | 32 | * Contributor(s): |
| TMBOY | 47:9e361da97763 | 33 | * |
| TMBOY | 47:9e361da97763 | 34 | * ***** END LICENSE BLOCK ***** */ |
| TMBOY | 47:9e361da97763 | 35 | |
| TMBOY | 47:9e361da97763 | 36 | /************************************************************************************** |
| TMBOY | 47:9e361da97763 | 37 | * Fixed-point MP3 decoder |
| TMBOY | 47:9e361da97763 | 38 | * Jon Recker (jrecker@real.com), Ken Cooke (kenc@real.com) |
| TMBOY | 47:9e361da97763 | 39 | * June 2003 |
| TMBOY | 47:9e361da97763 | 40 | * |
| TMBOY | 47:9e361da97763 | 41 | * mp3common.h - implementation-independent API's, datatypes, and definitions |
| TMBOY | 47:9e361da97763 | 42 | **************************************************************************************/ |
| TMBOY | 47:9e361da97763 | 43 | |
| TMBOY | 47:9e361da97763 | 44 | #ifndef _MP3COMMON_H |
| TMBOY | 47:9e361da97763 | 45 | #define _MP3COMMON_H |
| TMBOY | 47:9e361da97763 | 46 | |
| TMBOY | 47:9e361da97763 | 47 | #include "mp3dec.h" |
| TMBOY | 47:9e361da97763 | 48 | #include "statname.h" /* do name-mangling for static linking */ |
| TMBOY | 47:9e361da97763 | 49 | |
| TMBOY | 47:9e361da97763 | 50 | #define MAX_SCFBD 4 /* max scalefactor bands per channel */ |
| TMBOY | 47:9e361da97763 | 51 | #define NGRANS_MPEG1 2 |
| TMBOY | 47:9e361da97763 | 52 | #define NGRANS_MPEG2 1 |
| TMBOY | 47:9e361da97763 | 53 | |
| TMBOY | 47:9e361da97763 | 54 | /* 11-bit syncword if MPEG 2.5 extensions are enabled */ |
| TMBOY | 47:9e361da97763 | 55 | #define SYNCWORDH 0xff |
| TMBOY | 47:9e361da97763 | 56 | #define SYNCWORDL 0xe0 |
| TMBOY | 47:9e361da97763 | 57 | |
| TMBOY | 47:9e361da97763 | 58 | /* 12-bit syncword if MPEG 1,2 only are supported |
| TMBOY | 47:9e361da97763 | 59 | * #define SYNCWORDH 0xff |
| TMBOY | 47:9e361da97763 | 60 | * #define SYNCWORDL 0xf0 |
| TMBOY | 47:9e361da97763 | 61 | */ |
| TMBOY | 47:9e361da97763 | 62 | |
| TMBOY | 47:9e361da97763 | 63 | typedef struct _MP3DecInfo { |
| TMBOY | 47:9e361da97763 | 64 | /* pointers to platform-specific data structures */ |
| TMBOY | 47:9e361da97763 | 65 | void *FrameHeaderPS; |
| TMBOY | 47:9e361da97763 | 66 | void *SideInfoPS; |
| TMBOY | 47:9e361da97763 | 67 | void *ScaleFactorInfoPS; |
| TMBOY | 47:9e361da97763 | 68 | void *HuffmanInfoPS; |
| TMBOY | 47:9e361da97763 | 69 | void *DequantInfoPS; |
| TMBOY | 47:9e361da97763 | 70 | void *IMDCTInfoPS; |
| TMBOY | 47:9e361da97763 | 71 | void *SubbandInfoPS; |
| TMBOY | 47:9e361da97763 | 72 | |
| TMBOY | 47:9e361da97763 | 73 | /* buffer which must be large enough to hold largest possible main_data section */ |
| TMBOY | 47:9e361da97763 | 74 | unsigned char mainBuf[MAINBUF_SIZE]; |
| TMBOY | 47:9e361da97763 | 75 | |
| TMBOY | 47:9e361da97763 | 76 | /* special info for "free" bitrate files */ |
| TMBOY | 47:9e361da97763 | 77 | int freeBitrateFlag; |
| TMBOY | 47:9e361da97763 | 78 | int freeBitrateSlots; |
| TMBOY | 47:9e361da97763 | 79 | |
| TMBOY | 47:9e361da97763 | 80 | /* user-accessible info */ |
| TMBOY | 47:9e361da97763 | 81 | int bitrate; |
| TMBOY | 47:9e361da97763 | 82 | int nChans; |
| TMBOY | 47:9e361da97763 | 83 | int samprate; |
| TMBOY | 47:9e361da97763 | 84 | int nGrans; /* granules per frame */ |
| TMBOY | 47:9e361da97763 | 85 | int nGranSamps; /* samples per granule */ |
| TMBOY | 47:9e361da97763 | 86 | int nSlots; |
| TMBOY | 47:9e361da97763 | 87 | int layer; |
| TMBOY | 47:9e361da97763 | 88 | MPEGVersion version; |
| TMBOY | 47:9e361da97763 | 89 | |
| TMBOY | 47:9e361da97763 | 90 | int mainDataBegin; |
| TMBOY | 47:9e361da97763 | 91 | int mainDataBytes; |
| TMBOY | 47:9e361da97763 | 92 | |
| TMBOY | 47:9e361da97763 | 93 | int part23Length[MAX_NGRAN][MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 94 | |
| TMBOY | 47:9e361da97763 | 95 | } MP3DecInfo; |
| TMBOY | 47:9e361da97763 | 96 | |
| TMBOY | 47:9e361da97763 | 97 | typedef struct _SFBandTable { |
| TMBOY | 47:9e361da97763 | 98 | short l[23]; |
| TMBOY | 47:9e361da97763 | 99 | short s[14]; |
| TMBOY | 47:9e361da97763 | 100 | } SFBandTable; |
| TMBOY | 47:9e361da97763 | 101 | |
| TMBOY | 47:9e361da97763 | 102 | /* decoder functions which must be implemented for each platform */ |
| TMBOY | 47:9e361da97763 | 103 | MP3DecInfo *AllocateBuffers(void); |
| TMBOY | 47:9e361da97763 | 104 | void FreeBuffers(MP3DecInfo *mp3DecInfo); |
| TMBOY | 47:9e361da97763 | 105 | int CheckPadBit(MP3DecInfo *mp3DecInfo); |
| TMBOY | 47:9e361da97763 | 106 | int UnpackFrameHeader(MP3DecInfo *mp3DecInfo, unsigned char *buf); |
| TMBOY | 47:9e361da97763 | 107 | int UnpackSideInfo(MP3DecInfo *mp3DecInfo, unsigned char *buf); |
| TMBOY | 47:9e361da97763 | 108 | int DecodeHuffman(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int huffBlockBits, int gr, int ch); |
| TMBOY | 47:9e361da97763 | 109 | int Dequantize(MP3DecInfo *mp3DecInfo, int gr); |
| TMBOY | 47:9e361da97763 | 110 | int IMDCT(MP3DecInfo *mp3DecInfo, int gr, int ch); |
| TMBOY | 47:9e361da97763 | 111 | int UnpackScaleFactors(MP3DecInfo *mp3DecInfo, unsigned char *buf, int *bitOffset, int bitsAvail, int gr, int ch); |
| TMBOY | 47:9e361da97763 | 112 | int Subband(MP3DecInfo *mp3DecInfo, short *pcmBuf); |
| TMBOY | 47:9e361da97763 | 113 | |
| TMBOY | 47:9e361da97763 | 114 | /* mp3tabs.c - global ROM tables */ |
| TMBOY | 47:9e361da97763 | 115 | extern const int samplerateTab[3][3]; |
| TMBOY | 47:9e361da97763 | 116 | extern const short bitrateTab[3][3][15]; |
| TMBOY | 47:9e361da97763 | 117 | extern const short samplesPerFrameTab[3][3]; |
| TMBOY | 47:9e361da97763 | 118 | extern const short bitsPerSlotTab[3]; |
| TMBOY | 47:9e361da97763 | 119 | extern const short sideBytesTab[3][2]; |
| TMBOY | 47:9e361da97763 | 120 | extern const short slotTab[3][3][15]; |
| TMBOY | 47:9e361da97763 | 121 | extern const SFBandTable sfBandTable[3][3]; |
| TMBOY | 47:9e361da97763 | 122 | |
| TMBOY | 47:9e361da97763 | 123 | #endif /* _MP3COMMON_H */ |
