Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/external/mp3dec/real/coder.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 | * coder.h - private, implementation-specific header file |
| TMBOY | 47:9e361da97763 | 42 | **************************************************************************************/ |
| TMBOY | 47:9e361da97763 | 43 | |
| TMBOY | 47:9e361da97763 | 44 | #ifndef _CODER_H |
| TMBOY | 47:9e361da97763 | 45 | #define _CODER_H |
| TMBOY | 47:9e361da97763 | 46 | |
| TMBOY | 47:9e361da97763 | 47 | #include "mp3common.h" |
| TMBOY | 47:9e361da97763 | 48 | |
| TMBOY | 47:9e361da97763 | 49 | #if defined(_WIN32) && defined(_M_IX86) && (defined (_DEBUG) || defined (REL_ENABLE_ASSERTS)) |
| TMBOY | 47:9e361da97763 | 50 | #define ASSERT(x) if (!(x)) __asm int 3; |
| TMBOY | 47:9e361da97763 | 51 | #else |
| TMBOY | 47:9e361da97763 | 52 | #define ASSERT(x) /* do nothing */ |
| TMBOY | 47:9e361da97763 | 53 | #endif |
| TMBOY | 47:9e361da97763 | 54 | |
| TMBOY | 47:9e361da97763 | 55 | #ifndef MAX |
| TMBOY | 47:9e361da97763 | 56 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
| TMBOY | 47:9e361da97763 | 57 | #endif |
| TMBOY | 47:9e361da97763 | 58 | |
| TMBOY | 47:9e361da97763 | 59 | #ifndef MIN |
| TMBOY | 47:9e361da97763 | 60 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
| TMBOY | 47:9e361da97763 | 61 | #endif |
| TMBOY | 47:9e361da97763 | 62 | |
| TMBOY | 47:9e361da97763 | 63 | /* clip to range [-2^n, 2^n - 1] */ |
| TMBOY | 47:9e361da97763 | 64 | #define CLIP_2N(y, n) { \ |
| TMBOY | 47:9e361da97763 | 65 | int sign = (y) >> 31; \ |
| TMBOY | 47:9e361da97763 | 66 | if (sign != (y) >> (n)) { \ |
| TMBOY | 47:9e361da97763 | 67 | (y) = sign ^ ((1 << (n)) - 1); \ |
| TMBOY | 47:9e361da97763 | 68 | } \ |
| TMBOY | 47:9e361da97763 | 69 | } |
| TMBOY | 47:9e361da97763 | 70 | |
| TMBOY | 47:9e361da97763 | 71 | #define SIBYTES_MPEG1_MONO 17 |
| TMBOY | 47:9e361da97763 | 72 | #define SIBYTES_MPEG1_STEREO 32 |
| TMBOY | 47:9e361da97763 | 73 | #define SIBYTES_MPEG2_MONO 9 |
| TMBOY | 47:9e361da97763 | 74 | #define SIBYTES_MPEG2_STEREO 17 |
| TMBOY | 47:9e361da97763 | 75 | |
| TMBOY | 47:9e361da97763 | 76 | /* number of fraction bits for pow43Tab (see comments there) */ |
| TMBOY | 47:9e361da97763 | 77 | #define POW43_FRACBITS_LOW 22 |
| TMBOY | 47:9e361da97763 | 78 | #define POW43_FRACBITS_HIGH 12 |
| TMBOY | 47:9e361da97763 | 79 | |
| TMBOY | 47:9e361da97763 | 80 | #define DQ_FRACBITS_OUT 25 /* number of fraction bits in output of dequant */ |
| TMBOY | 47:9e361da97763 | 81 | #define IMDCT_SCALE 2 /* additional scaling (by sqrt(2)) for fast IMDCT36 */ |
| TMBOY | 47:9e361da97763 | 82 | |
| TMBOY | 47:9e361da97763 | 83 | #define HUFF_PAIRTABS 32 |
| TMBOY | 47:9e361da97763 | 84 | #define BLOCK_SIZE 18 |
| TMBOY | 47:9e361da97763 | 85 | #define NBANDS 32 |
| TMBOY | 47:9e361da97763 | 86 | #define MAX_REORDER_SAMPS ((192-126)*3) /* largest critical band for short blocks (see sfBandTable) */ |
| TMBOY | 47:9e361da97763 | 87 | #define VBUF_LENGTH (17 * 2 * NBANDS) /* for double-sized vbuf FIFO */ |
| TMBOY | 47:9e361da97763 | 88 | |
| TMBOY | 47:9e361da97763 | 89 | /* additional external symbols to name-mangle for static linking */ |
| TMBOY | 47:9e361da97763 | 90 | #define SetBitstreamPointer STATNAME(SetBitstreamPointer) |
| TMBOY | 47:9e361da97763 | 91 | #define GetBits STATNAME(GetBits) |
| TMBOY | 47:9e361da97763 | 92 | #define CalcBitsUsed STATNAME(CalcBitsUsed) |
| TMBOY | 47:9e361da97763 | 93 | #define DequantChannel STATNAME(DequantChannel) |
| TMBOY | 47:9e361da97763 | 94 | #define MidSideProc STATNAME(MidSideProc) |
| TMBOY | 47:9e361da97763 | 95 | #define IntensityProcMPEG1 STATNAME(IntensityProcMPEG1) |
| TMBOY | 47:9e361da97763 | 96 | #define IntensityProcMPEG2 STATNAME(IntensityProcMPEG2) |
| TMBOY | 47:9e361da97763 | 97 | #define PolyphaseMono STATNAME(PolyphaseMono) |
| TMBOY | 47:9e361da97763 | 98 | #define PolyphaseStereo STATNAME(PolyphaseStereo) |
| TMBOY | 47:9e361da97763 | 99 | #define FDCT32 STATNAME(FDCT32) |
| TMBOY | 47:9e361da97763 | 100 | |
| TMBOY | 47:9e361da97763 | 101 | #define ISFMpeg1 STATNAME(ISFMpeg1) |
| TMBOY | 47:9e361da97763 | 102 | #define ISFMpeg2 STATNAME(ISFMpeg2) |
| TMBOY | 47:9e361da97763 | 103 | #define ISFIIP STATNAME(ISFIIP) |
| TMBOY | 47:9e361da97763 | 104 | #define uniqueIDTab STATNAME(uniqueIDTab) |
| TMBOY | 47:9e361da97763 | 105 | #define coef32 STATNAME(coef32) |
| TMBOY | 47:9e361da97763 | 106 | #define polyCoef STATNAME(polyCoef) |
| TMBOY | 47:9e361da97763 | 107 | #define csa STATNAME(csa) |
| TMBOY | 47:9e361da97763 | 108 | #define imdctWin STATNAME(imdctWin) |
| TMBOY | 47:9e361da97763 | 109 | |
| TMBOY | 47:9e361da97763 | 110 | #define huffTable STATNAME(huffTable) |
| TMBOY | 47:9e361da97763 | 111 | #define huffTabOffset STATNAME(huffTabOffset) |
| TMBOY | 47:9e361da97763 | 112 | #define huffTabLookup STATNAME(huffTabLookup) |
| TMBOY | 47:9e361da97763 | 113 | #define quadTable STATNAME(quadTable) |
| TMBOY | 47:9e361da97763 | 114 | #define quadTabOffset STATNAME(quadTabOffset) |
| TMBOY | 47:9e361da97763 | 115 | #define quadTabMaxBits STATNAME(quadTabMaxBits) |
| TMBOY | 47:9e361da97763 | 116 | |
| TMBOY | 47:9e361da97763 | 117 | /* map these to the corresponding 2-bit values in the frame header */ |
| TMBOY | 47:9e361da97763 | 118 | typedef enum { |
| TMBOY | 47:9e361da97763 | 119 | Stereo = 0x00, /* two independent channels, but L and R frames might have different # of bits */ |
| TMBOY | 47:9e361da97763 | 120 | Joint = 0x01, /* coupled channels - layer III: mix of M-S and intensity, Layers I/II: intensity and direct coding only */ |
| TMBOY | 47:9e361da97763 | 121 | Dual = 0x02, /* two independent channels, L and R always have exactly 1/2 the total bitrate */ |
| TMBOY | 47:9e361da97763 | 122 | Mono = 0x03 /* one channel */ |
| TMBOY | 47:9e361da97763 | 123 | } StereoMode; |
| TMBOY | 47:9e361da97763 | 124 | |
| TMBOY | 47:9e361da97763 | 125 | typedef struct _BitStreamInfo { |
| TMBOY | 47:9e361da97763 | 126 | unsigned char *bytePtr; |
| TMBOY | 47:9e361da97763 | 127 | unsigned int iCache; |
| TMBOY | 47:9e361da97763 | 128 | int cachedBits; |
| TMBOY | 47:9e361da97763 | 129 | int nBytes; |
| TMBOY | 47:9e361da97763 | 130 | } BitStreamInfo; |
| TMBOY | 47:9e361da97763 | 131 | |
| TMBOY | 47:9e361da97763 | 132 | typedef struct _FrameHeader { |
| TMBOY | 47:9e361da97763 | 133 | MPEGVersion ver; /* version ID */ |
| TMBOY | 47:9e361da97763 | 134 | int layer; /* layer index (1, 2, or 3) */ |
| TMBOY | 47:9e361da97763 | 135 | int crc; /* CRC flag: 0 = disabled, 1 = enabled */ |
| TMBOY | 47:9e361da97763 | 136 | int brIdx; /* bitrate index (0 - 15) */ |
| TMBOY | 47:9e361da97763 | 137 | int srIdx; /* sample rate index (0 - 2) */ |
| TMBOY | 47:9e361da97763 | 138 | int paddingBit; /* padding flag: 0 = no padding, 1 = single pad byte */ |
| TMBOY | 47:9e361da97763 | 139 | int privateBit; /* unused */ |
| TMBOY | 47:9e361da97763 | 140 | StereoMode sMode; /* mono/stereo mode */ |
| TMBOY | 47:9e361da97763 | 141 | int modeExt; /* used to decipher joint stereo mode */ |
| TMBOY | 47:9e361da97763 | 142 | int copyFlag; /* copyright flag: 0 = no, 1 = yes */ |
| TMBOY | 47:9e361da97763 | 143 | int origFlag; /* original flag: 0 = copy, 1 = original */ |
| TMBOY | 47:9e361da97763 | 144 | int emphasis; /* deemphasis mode */ |
| TMBOY | 47:9e361da97763 | 145 | int CRCWord; /* CRC word (16 bits, 0 if crc not enabled) */ |
| TMBOY | 47:9e361da97763 | 146 | |
| TMBOY | 47:9e361da97763 | 147 | const SFBandTable *sfBand; |
| TMBOY | 47:9e361da97763 | 148 | } FrameHeader; |
| TMBOY | 47:9e361da97763 | 149 | |
| TMBOY | 47:9e361da97763 | 150 | typedef struct _SideInfoSub { |
| TMBOY | 47:9e361da97763 | 151 | int part23Length; /* number of bits in main data */ |
| TMBOY | 47:9e361da97763 | 152 | int nBigvals; /* 2x this = first set of Huffman cw's (maximum amplitude can be > 1) */ |
| TMBOY | 47:9e361da97763 | 153 | int globalGain; /* overall gain for dequantizer */ |
| TMBOY | 47:9e361da97763 | 154 | int sfCompress; /* unpacked to figure out number of bits in scale factors */ |
| TMBOY | 47:9e361da97763 | 155 | int winSwitchFlag; /* window switching flag */ |
| TMBOY | 47:9e361da97763 | 156 | int blockType; /* block type */ |
| TMBOY | 47:9e361da97763 | 157 | int mixedBlock; /* 0 = regular block (all short or long), 1 = mixed block */ |
| TMBOY | 47:9e361da97763 | 158 | int tableSelect[3]; /* index of Huffman tables for the big values regions */ |
| TMBOY | 47:9e361da97763 | 159 | int subBlockGain[3]; /* subblock gain offset, relative to global gain */ |
| TMBOY | 47:9e361da97763 | 160 | int region0Count; /* 1+region0Count = num scale factor bands in first region of bigvals */ |
| TMBOY | 47:9e361da97763 | 161 | int region1Count; /* 1+region1Count = num scale factor bands in second region of bigvals */ |
| TMBOY | 47:9e361da97763 | 162 | int preFlag; /* for optional high frequency boost */ |
| TMBOY | 47:9e361da97763 | 163 | int sfactScale; /* scaling of the scalefactors */ |
| TMBOY | 47:9e361da97763 | 164 | int count1TableSelect; /* index of Huffman table for quad codewords */ |
| TMBOY | 47:9e361da97763 | 165 | } SideInfoSub; |
| TMBOY | 47:9e361da97763 | 166 | |
| TMBOY | 47:9e361da97763 | 167 | typedef struct _SideInfo { |
| TMBOY | 47:9e361da97763 | 168 | int mainDataBegin; |
| TMBOY | 47:9e361da97763 | 169 | int privateBits; |
| TMBOY | 47:9e361da97763 | 170 | int scfsi[MAX_NCHAN][MAX_SCFBD]; /* 4 scalefactor bands per channel */ |
| TMBOY | 47:9e361da97763 | 171 | |
| TMBOY | 47:9e361da97763 | 172 | SideInfoSub sis[MAX_NGRAN][MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 173 | } SideInfo; |
| TMBOY | 47:9e361da97763 | 174 | |
| TMBOY | 47:9e361da97763 | 175 | typedef struct { |
| TMBOY | 47:9e361da97763 | 176 | int cbType; /* pure long = 0, pure short = 1, mixed = 2 */ |
| TMBOY | 47:9e361da97763 | 177 | int cbEndS[3]; /* number nonzero short cb's, per subbblock */ |
| TMBOY | 47:9e361da97763 | 178 | int cbEndSMax; /* max of cbEndS[] */ |
| TMBOY | 47:9e361da97763 | 179 | int cbEndL; /* number nonzero long cb's */ |
| TMBOY | 47:9e361da97763 | 180 | } CriticalBandInfo; |
| TMBOY | 47:9e361da97763 | 181 | |
| TMBOY | 47:9e361da97763 | 182 | typedef struct _DequantInfo { |
| TMBOY | 47:9e361da97763 | 183 | int workBuf[MAX_REORDER_SAMPS]; /* workbuf for reordering short blocks */ |
| TMBOY | 47:9e361da97763 | 184 | CriticalBandInfo cbi[MAX_NCHAN]; /* filled in dequantizer, used in joint stereo reconstruction */ |
| TMBOY | 47:9e361da97763 | 185 | } DequantInfo; |
| TMBOY | 47:9e361da97763 | 186 | |
| TMBOY | 47:9e361da97763 | 187 | typedef struct _HuffmanInfo { |
| TMBOY | 47:9e361da97763 | 188 | int huffDecBuf[MAX_NCHAN][MAX_NSAMP]; /* used both for decoded Huffman values and dequantized coefficients */ |
| TMBOY | 47:9e361da97763 | 189 | int nonZeroBound[MAX_NCHAN]; /* number of coeffs in huffDecBuf[ch] which can be > 0 */ |
| TMBOY | 47:9e361da97763 | 190 | int gb[MAX_NCHAN]; /* minimum number of guard bits in huffDecBuf[ch] */ |
| TMBOY | 47:9e361da97763 | 191 | } HuffmanInfo; |
| TMBOY | 47:9e361da97763 | 192 | |
| TMBOY | 47:9e361da97763 | 193 | typedef enum _HuffTabType { |
| TMBOY | 47:9e361da97763 | 194 | noBits, |
| TMBOY | 47:9e361da97763 | 195 | oneShot, |
| TMBOY | 47:9e361da97763 | 196 | loopNoLinbits, |
| TMBOY | 47:9e361da97763 | 197 | loopLinbits, |
| TMBOY | 47:9e361da97763 | 198 | quadA, |
| TMBOY | 47:9e361da97763 | 199 | quadB, |
| TMBOY | 47:9e361da97763 | 200 | invalidTab |
| TMBOY | 47:9e361da97763 | 201 | } HuffTabType; |
| TMBOY | 47:9e361da97763 | 202 | |
| TMBOY | 47:9e361da97763 | 203 | typedef struct _HuffTabLookup { |
| TMBOY | 47:9e361da97763 | 204 | int linBits; |
| TMBOY | 47:9e361da97763 | 205 | HuffTabType tabType; |
| TMBOY | 47:9e361da97763 | 206 | } HuffTabLookup; |
| TMBOY | 47:9e361da97763 | 207 | |
| TMBOY | 47:9e361da97763 | 208 | typedef struct _IMDCTInfo { |
| TMBOY | 47:9e361da97763 | 209 | int outBuf[MAX_NCHAN][BLOCK_SIZE][NBANDS]; /* output of IMDCT */ |
| TMBOY | 47:9e361da97763 | 210 | int overBuf[MAX_NCHAN][MAX_NSAMP / 2]; /* overlap-add buffer (by symmetry, only need 1/2 size) */ |
| TMBOY | 47:9e361da97763 | 211 | int numPrevIMDCT[MAX_NCHAN]; /* how many IMDCT's calculated in this channel on prev. granule */ |
| TMBOY | 47:9e361da97763 | 212 | int prevType[MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 213 | int prevWinSwitch[MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 214 | int gb[MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 215 | } IMDCTInfo; |
| TMBOY | 47:9e361da97763 | 216 | |
| TMBOY | 47:9e361da97763 | 217 | typedef struct _BlockCount { |
| TMBOY | 47:9e361da97763 | 218 | int nBlocksLong; |
| TMBOY | 47:9e361da97763 | 219 | int nBlocksTotal; |
| TMBOY | 47:9e361da97763 | 220 | int nBlocksPrev; |
| TMBOY | 47:9e361da97763 | 221 | int prevType; |
| TMBOY | 47:9e361da97763 | 222 | int prevWinSwitch; |
| TMBOY | 47:9e361da97763 | 223 | int currWinSwitch; |
| TMBOY | 47:9e361da97763 | 224 | int gbIn; |
| TMBOY | 47:9e361da97763 | 225 | int gbOut; |
| TMBOY | 47:9e361da97763 | 226 | } BlockCount; |
| TMBOY | 47:9e361da97763 | 227 | |
| TMBOY | 47:9e361da97763 | 228 | /* max bits in scalefactors = 5, so use char's to save space */ |
| TMBOY | 47:9e361da97763 | 229 | typedef struct _ScaleFactorInfoSub { |
| TMBOY | 47:9e361da97763 | 230 | char l[23]; /* [band] */ |
| TMBOY | 47:9e361da97763 | 231 | char s[13][3]; /* [band][window] */ |
| TMBOY | 47:9e361da97763 | 232 | } ScaleFactorInfoSub; |
| TMBOY | 47:9e361da97763 | 233 | |
| TMBOY | 47:9e361da97763 | 234 | /* used in MPEG 2, 2.5 intensity (joint) stereo only */ |
| TMBOY | 47:9e361da97763 | 235 | typedef struct _ScaleFactorJS { |
| TMBOY | 47:9e361da97763 | 236 | int intensityScale; |
| TMBOY | 47:9e361da97763 | 237 | int slen[4]; |
| TMBOY | 47:9e361da97763 | 238 | int nr[4]; |
| TMBOY | 47:9e361da97763 | 239 | } ScaleFactorJS; |
| TMBOY | 47:9e361da97763 | 240 | |
| TMBOY | 47:9e361da97763 | 241 | typedef struct _ScaleFactorInfo { |
| TMBOY | 47:9e361da97763 | 242 | ScaleFactorInfoSub sfis[MAX_NGRAN][MAX_NCHAN]; |
| TMBOY | 47:9e361da97763 | 243 | ScaleFactorJS sfjs; |
| TMBOY | 47:9e361da97763 | 244 | } ScaleFactorInfo; |
| TMBOY | 47:9e361da97763 | 245 | |
| TMBOY | 47:9e361da97763 | 246 | /* NOTE - could get by with smaller vbuf if memory is more important than speed |
| TMBOY | 47:9e361da97763 | 247 | * (in Subband, instead of replicating each block in FDCT32 you would do a memmove on the |
| TMBOY | 47:9e361da97763 | 248 | * last 15 blocks to shift them down one, a hardware style FIFO) |
| TMBOY | 47:9e361da97763 | 249 | */ |
| TMBOY | 47:9e361da97763 | 250 | typedef struct _SubbandInfo { |
| TMBOY | 47:9e361da97763 | 251 | int vbuf[MAX_NCHAN * VBUF_LENGTH]; /* vbuf for fast DCT-based synthesis PQMF - double size for speed (no modulo indexing) */ |
| TMBOY | 47:9e361da97763 | 252 | int vindex; /* internal index for tracking position in vbuf */ |
| TMBOY | 47:9e361da97763 | 253 | } SubbandInfo; |
| TMBOY | 47:9e361da97763 | 254 | |
| TMBOY | 47:9e361da97763 | 255 | /* bitstream.c */ |
| TMBOY | 47:9e361da97763 | 256 | void SetBitstreamPointer(BitStreamInfo *bsi, int nBytes, unsigned char *buf); |
| TMBOY | 47:9e361da97763 | 257 | unsigned int GetBits(BitStreamInfo *bsi, int nBits); |
| TMBOY | 47:9e361da97763 | 258 | int CalcBitsUsed(BitStreamInfo *bsi, unsigned char *startBuf, int startOffset); |
| TMBOY | 47:9e361da97763 | 259 | |
| TMBOY | 47:9e361da97763 | 260 | /* dequant.c, dqchan.c, stproc.c */ |
| TMBOY | 47:9e361da97763 | 261 | int DequantChannel(int *sampleBuf, int *workBuf, int *nonZeroBound, FrameHeader *fh, SideInfoSub *sis, |
| TMBOY | 47:9e361da97763 | 262 | ScaleFactorInfoSub *sfis, CriticalBandInfo *cbi); |
| TMBOY | 47:9e361da97763 | 263 | void MidSideProc(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, int mOut[2]); |
| TMBOY | 47:9e361da97763 | 264 | void IntensityProcMPEG1(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, |
| TMBOY | 47:9e361da97763 | 265 | CriticalBandInfo *cbi, int midSideFlag, int mixFlag, int mOut[2]); |
| TMBOY | 47:9e361da97763 | 266 | void IntensityProcMPEG2(int x[MAX_NCHAN][MAX_NSAMP], int nSamps, FrameHeader *fh, ScaleFactorInfoSub *sfis, |
| TMBOY | 47:9e361da97763 | 267 | CriticalBandInfo *cbi, ScaleFactorJS *sfjs, int midSideFlag, int mixFlag, int mOut[2]); |
| TMBOY | 47:9e361da97763 | 268 | |
| TMBOY | 47:9e361da97763 | 269 | /* dct32.c */ |
| TMBOY | 47:9e361da97763 | 270 | void FDCT32(int *x, int *d, int offset, int oddBlock, int gb); |
| TMBOY | 47:9e361da97763 | 271 | |
| TMBOY | 47:9e361da97763 | 272 | /* hufftabs.c */ |
| TMBOY | 47:9e361da97763 | 273 | extern const HuffTabLookup huffTabLookup[HUFF_PAIRTABS]; |
| TMBOY | 47:9e361da97763 | 274 | extern const int huffTabOffset[HUFF_PAIRTABS]; |
| TMBOY | 47:9e361da97763 | 275 | extern const unsigned short huffTable[]; |
| TMBOY | 47:9e361da97763 | 276 | extern const unsigned char quadTable[64+16]; |
| TMBOY | 47:9e361da97763 | 277 | extern const int quadTabOffset[2]; |
| TMBOY | 47:9e361da97763 | 278 | extern const int quadTabMaxBits[2]; |
| TMBOY | 47:9e361da97763 | 279 | |
| TMBOY | 47:9e361da97763 | 280 | /* polyphase.c (or asmpoly.s) |
| TMBOY | 47:9e361da97763 | 281 | * some platforms require a C++ compile of all source files, |
| TMBOY | 47:9e361da97763 | 282 | * so if we're compiling C as C++ and using native assembly |
| TMBOY | 47:9e361da97763 | 283 | * for these functions we need to prevent C++ name mangling. |
| TMBOY | 47:9e361da97763 | 284 | */ |
| TMBOY | 47:9e361da97763 | 285 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 286 | extern "C" { |
| TMBOY | 47:9e361da97763 | 287 | #endif |
| TMBOY | 47:9e361da97763 | 288 | void PolyphaseMono(short *pcm, int *vbuf, const int *coefBase); |
| TMBOY | 47:9e361da97763 | 289 | void PolyphaseStereo(short *pcm, int *vbuf, const int *coefBase); |
| TMBOY | 47:9e361da97763 | 290 | #ifdef __cplusplus |
| TMBOY | 47:9e361da97763 | 291 | } |
| TMBOY | 47:9e361da97763 | 292 | #endif |
| TMBOY | 47:9e361da97763 | 293 | |
| TMBOY | 47:9e361da97763 | 294 | /* trigtabs.c */ |
| TMBOY | 47:9e361da97763 | 295 | extern const int imdctWin[4][36]; |
| TMBOY | 47:9e361da97763 | 296 | extern const int ISFMpeg1[2][7]; |
| TMBOY | 47:9e361da97763 | 297 | extern const int ISFMpeg2[2][2][16]; |
| TMBOY | 47:9e361da97763 | 298 | extern const int ISFIIP[2][2]; |
| TMBOY | 47:9e361da97763 | 299 | extern const int csa[8][2]; |
| TMBOY | 47:9e361da97763 | 300 | extern const int coef32[31]; |
| TMBOY | 47:9e361da97763 | 301 | extern const int polyCoef[264]; |
| TMBOY | 47:9e361da97763 | 302 | |
| TMBOY | 47:9e361da97763 | 303 | #endif /* _CODER_H */ |
