88 const float *src1,
const float *src2,
int len) {
90 *dst++ = *src0++ * *src1++ + *src2++;
94 const float *src1,
int len) {
98 *dst++ = *src0++ * *src1--;
101 struct WMACoefHuffmanParam;
273 int *coefCount,
int coefBitCount);
276 int *coefCount,
int totalGain,
float mdctNorm);
281 const float *levelTable,
const uint16 *runTable,
int version,
float *ptr,
282 int offset,
int numCoefs,
int blockLen,
int frameLenBits,
int coefNbBits);
284 void lspToCurve(
float *out,
float *val_max_ptr,
int n,
float *lsp);
286 void window(
float *out)
const;
298 _version(version), _sampleRate(sampleRate), _channels(channels),
299 _bitRate(bitRate), _blockAlign(blockAlign), _audioFlags(0),
300 _resetBlockLengths(true), _curFrame(0), _frameLen(0), _frameLenBits(0),
301 _blockSizeCount(0), _framePos(0), _curBlock(0), _blockLen(0), _blockLenBits(0),
302 _nextBlockLenBits(0), _prevBlockLenBits(0), _byteOffsetBits(0),
303 _lastSuperframeLen(0), _lastBitoffset(0) {
305 for (
int i = 0; i < 2; i++)
319 #ifdef XOREOS_LITTLE_ENDIAN 372 if ((
_version == 1) && extraData && (extraData->
size() >= 4)) {
377 if ((
_version == 2) && extraData && (extraData->
size() >= 6)) {
390 if ((
_version == 2) && extraData && (extraData->
size() >= 8)) {
420 int count = ((flags >> 3) & 3) + 1;
427 return MIN(count, maxCount) + 1;
460 bps = bpsOrig * 1.6f;
462 if (rateNormalized == 44100) {
466 highFreq = highFreq * 0.4f;
470 if (rateNormalized == 22050) {
475 highFreq = highFreq * 0.7f;
477 highFreq = highFreq * 0.6f;
482 if (rateNormalized == 16000) {
484 highFreq = highFreq * 0.5f;
486 highFreq = highFreq * 0.3f;
491 if (rateNormalized == 11025) {
492 highFreq = highFreq * 0.7f;
496 if (rateNormalized == 8000) {
500 if (bpsOrig <= 0.625f)
501 highFreq = highFreq * 0.5f;
503 highFreq = highFreq * 0.65f;
510 highFreq = highFreq * 0.75f;
511 else if (bpsOrig >= 0.6f)
512 highFreq = highFreq * 0.6f;
514 highFreq = highFreq * 0.5f;
531 for (i = 0; i < 25; i++) {
534 int pos = ((blockLen * 2 * a) + (b >> 1)) / b;
540 if (pos >= blockLen) {
551 const uint8 *table = 0;
566 for (
int i = 0; i < n; i++)
574 for (
int i = 0; i < 25; i++) {
577 int pos = ((blockLen * 2 * a) + (b << 1)) / (4 * b);
607 for (
int i = 0; i < n; i++) {
637 float norm = (1.0f / (float)(1LL << 31)) * sqrt(3.0) *
_noiseMult;
640 seed = seed * 314159 + 1;
650 int coefHuffTable = 2;
654 }
else if (bps < 1.16f) {
695 levelTable.
reset(
new float[params.
n]);
704 while (i < params.
n) {
707 int l = params.
levels[k++];
709 for (
int j = 0; j < l; j++) {
711 iLevelTable[i] = level;
712 levelTable [i] = level;
730 for (
int i = 0; i < 256; i++) {
738 for (
int i = (1 <<
kLSPPowBits) - 1; i >= 0; i--) {
762 warning(
"WMACodec::decodeSuperFrame(): size < _blockAlign");
771 int outputDataSize = 0;
782 int newFrameCount = bits.
getBits(4) - 1;
783 if (newFrameCount < 0) {
794 int frameCount = newFrameCount;
802 std::memset(outputData.
get(), 0, outputDataSize * 2);
814 while (bitOffset > 7) {
815 *lastSuperframeEnd++ = bits.
getBits(8);
822 *lastSuperframeEnd++ = bits.
getBits(bitOffset) << (8 - bitOffset);
839 bits.
skip(bitOffset);
845 for (
int i = 0; i < newFrameCount; i++,
_curFrame++)
850 int remainingBits = bits.
size() - bits.
pos();
851 if (remainingBits > 0) {
876 std::memset(outputData.
get(), 0, outputDataSize * 2);
898 while (finished == 0)
934 bool msStereo =
false;
936 msStereo = bits.
getBit() != 0;
940 bool hasChannels =
false;
943 hasChannel[i] =
false;
946 hasChannel[i] = bits.
getBit() != 0;
976 bool msStereo,
bool *hasChannel) {
984 if (!
decodeNoise(bits, bSize, hasChannel, coefCount))
997 if (msStereo && hasChannel[1]) {
1001 if (!hasChannel[0]) {
1003 hasChannel[0] =
true;
1020 else if (!(msStereo && (i == 1)))
1042 const int prev = bits.
getBits(n);
1045 warning(
"WMACodec::evalBlockLength(): _prevBlockLenBits %d out of range", prevBits);
1051 const int cur = bits.
getBits(n);
1054 warning(
"WMACodec::evalBlockLength(): _blockLenBits %d out of range", curBits);
1067 const int next = bits.
getBits(n);
1070 warning(
"WMACodec::evalBlockLength(): _nextBlockLenBits %d out of range", nextBits);
1087 warning(
"WMACodec::evalBlockLength(): _blockLenBits not initialized to a valid value");
1093 warning(
"WMACodec::evalBlockLength(): frame length overflow");
1104 coefCount[i] = coefN;
1108 bool *hasChannel,
int *coefCount) {
1117 for (
int j = 0; j < n; j++) {
1118 bool a = bits.
getBit() != 0;
1132 int val = (int) 0x80000000;
1134 for (
int j = 0; j < n; j++) {
1138 if (val != (
int) 0x80000000) {
1141 warning(
"WMACodec::decodeNoise(): HGain Huffman invalid");
1182 int *coefCount,
int coefBitCount) {
1186 if (hasChannel[i]) {
1189 const int tindex = ((i == 1) && msStereo);
1192 std::memset(ptr, 0,
_blockLen *
sizeof(
float));
1201 bits.
skip(-((ptrdiff_t)(bits.
pos() & 7)));
1210 float mdctNorm = 1.0f / (float) n4;
1212 mdctNorm *= sqrt((
float) n4);
1218 int *coefCount,
int totalGain,
float mdctNorm) {
1224 float *coefs =
_coefs[i];
1225 const float *coefs1 =
_coefs1[i];
1230 const float mult = (pow(10, totalGain * 0.05f) /
_maxExponent[i]) * mdctNorm;
1243 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
1249 int lastHighBand = 0;
1250 for (
int k = 0; k < n1; k++) {
1256 for (
int j = 0; j < n; j++) {
1257 const float v = exponents[(j << bSize) >> eSize];
1262 expPower[k] = e2 / n;
1266 exponents += (n << bSize) >> eSize;
1270 exponents =
_exponents[i] + ((_coefsStart << bSize) >> eSize);
1272 for (
int k = -1; k < n1; k++) {
1283 float mult1 = sqrt(expPower[k] / expPower[lastHighBand]);
1289 for (
int j = 0; j < n; j++) {
1293 *coefs++ = noise * exponents[(j << bSize) >> eSize] * mult1;
1296 exponents += (n << bSize) >> eSize;
1301 for (
int j = 0; j < n; j++) {
1305 *coefs++ = ((*coefs1++) + noise) * exponents[(j << bSize) >> eSize] * mult;
1308 exponents += (n << bSize) >> eSize;
1315 const float mult1 = mult * exponents[(-(1 << bSize)) >> eSize];
1317 for (
int j = 0; j < n; j++) {
1327 for (
int j = 0;j < coefCount[i]; j++) {
1328 *coefs = coefs1[j] * exponents[(j << bSize) >> eSize] * mult;
1333 for (
int j = 0; j < n; j++)
1343 1.7782794100389e-04f, 2.0535250264571e-04f,
1344 2.3713737056617e-04f, 2.7384196342644e-04f,
1345 3.1622776601684e-04f, 3.6517412725484e-04f,
1346 4.2169650342858e-04f, 4.8696752516586e-04f,
1347 5.6234132519035e-04f, 6.4938163157621e-04f,
1348 7.4989420933246e-04f, 8.6596432336006e-04f,
1349 1.0000000000000e-03f, 1.1547819846895e-03f,
1350 1.3335214321633e-03f, 1.5399265260595e-03f,
1351 1.7782794100389e-03f, 2.0535250264571e-03f,
1352 2.3713737056617e-03f, 2.7384196342644e-03f,
1353 3.1622776601684e-03f, 3.6517412725484e-03f,
1354 4.2169650342858e-03f, 4.8696752516586e-03f,
1355 5.6234132519035e-03f, 6.4938163157621e-03f,
1356 7.4989420933246e-03f, 8.6596432336006e-03f,
1357 1.0000000000000e-02f, 1.1547819846895e-02f,
1358 1.3335214321633e-02f, 1.5399265260595e-02f,
1359 1.7782794100389e-02f, 2.0535250264571e-02f,
1360 2.3713737056617e-02f, 2.7384196342644e-02f,
1361 3.1622776601684e-02f, 3.6517412725484e-02f,
1362 4.2169650342858e-02f, 4.8696752516586e-02f,
1363 5.6234132519035e-02f, 6.4938163157621e-02f,
1364 7.4989420933246e-02f, 8.6596432336007e-02f,
1365 1.0000000000000e-01f, 1.1547819846895e-01f,
1366 1.3335214321633e-01f, 1.5399265260595e-01f,
1367 1.7782794100389e-01f, 2.0535250264571e-01f,
1368 2.3713737056617e-01f, 2.7384196342644e-01f,
1369 3.1622776601684e-01f, 3.6517412725484e-01f,
1370 4.2169650342858e-01f, 4.8696752516586e-01f,
1371 5.6234132519035e-01f, 6.4938163157621e-01f,
1372 7.4989420933246e-01f, 8.6596432336007e-01f,
1373 1.0000000000000e+00f, 1.1547819846895e+00f,
1374 1.3335214321633e+00f, 1.5399265260595e+00f,
1375 1.7782794100389e+00f, 2.0535250264571e+00f,
1376 2.3713737056617e+00f, 2.7384196342644e+00f,
1377 3.1622776601684e+00f, 3.6517412725484e+00f,
1378 4.2169650342858e+00f, 4.8696752516586e+00f,
1379 5.6234132519035e+00f, 6.4938163157621e+00f,
1380 7.4989420933246e+00f, 8.6596432336007e+00f,
1381 1.0000000000000e+01f, 1.1547819846895e+01f,
1382 1.3335214321633e+01f, 1.5399265260595e+01f,
1383 1.7782794100389e+01f, 2.0535250264571e+01f,
1384 2.3713737056617e+01f, 2.7384196342644e+01f,
1385 3.1622776601684e+01f, 3.6517412725484e+01f,
1386 4.2169650342858e+01f, 4.8696752516586e+01f,
1387 5.6234132519035e+01f, 6.4938163157621e+01f,
1388 7.4989420933246e+01f, 8.6596432336007e+01f,
1389 1.0000000000000e+02f, 1.1547819846895e+02f,
1390 1.3335214321633e+02f, 1.5399265260595e+02f,
1391 1.7782794100389e+02f, 2.0535250264571e+02f,
1392 2.3713737056617e+02f, 2.7384196342644e+02f,
1393 3.1622776601684e+02f, 3.6517412725484e+02f,
1394 4.2169650342858e+02f, 4.8696752516586e+02f,
1395 5.6234132519035e+02f, 6.4938163157621e+02f,
1396 7.4989420933246e+02f, 8.6596432336007e+02f,
1397 1.0000000000000e+03f, 1.1547819846895e+03f,
1398 1.3335214321633e+03f, 1.5399265260595e+03f,
1399 1.7782794100389e+03f, 2.0535250264571e+03f,
1400 2.3713737056617e+03f, 2.7384196342644e+03f,
1401 3.1622776601684e+03f, 3.6517412725484e+03f,
1402 4.2169650342858e+03f, 4.8696752516586e+03f,
1403 5.6234132519035e+03f, 6.4938163157621e+03f,
1404 7.4989420933246e+03f, 8.6596432336007e+03f,
1405 1.0000000000000e+04f, 1.1547819846895e+04f,
1406 1.3335214321633e+04f, 1.5399265260595e+04f,
1407 1.7782794100389e+04f, 2.0535250264571e+04f,
1408 2.3713737056617e+04f, 2.7384196342644e+04f,
1409 3.1622776601684e+04f, 3.6517412725484e+04f,
1410 4.2169650342858e+04f, 4.8696752516586e+04f,
1411 5.6234132519035e+04f, 6.4938163157621e+04f,
1412 7.4989420933246e+04f, 8.6596432336007e+04f,
1413 1.0000000000000e+05f, 1.1547819846895e+05f,
1414 1.3335214321633e+05f, 1.5399265260595e+05f,
1415 1.7782794100389e+05f, 2.0535250264571e+05f,
1416 2.3713737056617e+05f, 2.7384196342644e+05f,
1417 3.1622776601684e+05f, 3.6517412725484e+05f,
1418 4.2169650342858e+05f, 4.8696752516586e+05f,
1419 5.6234132519035e+05f, 6.4938163157621e+05f,
1420 7.4989420933246e+05f, 8.6596432336007e+05f,
1424 const float *ptab =
powTab + 60;
1425 const uint32 *iptab =
reinterpret_cast<const uint32 *
>(ptab);
1437 lastExp = bits.
getBits(5) + 10;
1439 float v = ptab[lastExp];
1440 uint32 iv = iptab[lastExp];
1452 }
while ((n -= 4) > 0);
1460 warning(
"WMACodec::decodeExpHuffman(): Exponent invalid");
1465 lastExp += code - 60;
1467 warning(
"WMACodec::decodeExpHuffman(): Exponent out of range: %d", lastExp);
1471 float v = ptab[lastExp];
1472 uint32 iv = iptab[lastExp];
1485 }
while ((n -= 4) > 0);
1497 for (
int i = 0; i < n; i++) {
1503 q *= w - lsp[j - 1];
1507 p *= p * (2.0f - w);
1508 q *= q * (2.0f + w);
1519 *val_max_ptr = val_max;
1529 if (i == 0 || i >= 8)
1542 const float *levelTable,
const uint16 *runTable,
int version,
float *ptr,
1543 int offset,
int numCoefs,
int blockLen,
int frameLenBits,
int coefNbBits) {
1545 const unsigned int coefMask = blockLen - 1;
1547 for (; offset < numCoefs; offset++) {
1548 const int code = huffman.
getSymbol(bits);
1553 const float sign = bits.
getBit() ? 1.0f : -1.0f;
1555 offset += runTable[code];
1557 ptr[offset & coefMask] = levelTable[code] * sign;
1559 }
else if (code == 1) {
1571 level = bits.
getBits(coefNbBits);
1573 offset += bits.
getBits(frameLenBits);
1582 warning(
"WMACodec::decodeRunLevel(): Broken escape sequence");
1585 offset += bits.
getBits(frameLenBits) + 4;
1587 offset += bits.
getBits(2) + 1;
1592 const int sign = bits.
getBit() - 1;
1594 ptr[offset & coefMask] = (level ^ sign) - sign;
1600 if (offset > numCoefs) {
1601 warning(
"WMACodec::decodeRunLevel(): Overflow in spectral RLE, ignoring");
1626 const int n = (
_blockLen - blockLen) / 2;
1632 std::memcpy(out + n + blockLen, in + n + blockLen, n *
sizeof(
float));
1648 const int n = (
_blockLen - blockLen) / 2;
1652 std::memcpy(out, in, n*
sizeof(
float));
1656 std::memset(out + n + blockLen, 0, n *
sizeof(
float));
1668 const unsigned int e = u.v >> 23;
1672 t.v = ((u.v <<
kLSPPowBits) & ((1 << 23) - 1)) | (127 << 23);
1694 if (totalGain < 15)
return 13;
1695 else if (totalGain < 32)
return 12;
1696 else if (totalGain < 40)
return 11;
1697 else if (totalGain < 45)
return 10;
1727 return new WMACodec(version, sampleRate, channels, bitRate, blockAlign, &extraData);
(Inverse) Modified Discrete Cosine Transforms.
float pow_m1_4(float x) const
const uint32 hgainHuffCodes[37]
int _curBlock
The number of the block we're currently in.
const uint16 * levels
Table to build run/level tables.
uint16 readUint16LE()
Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it...
bool evalBlockLength(Common::BitStream &bits)
int decodeBlock(Common::BitStream &bits)
int _frameLen
The frame length.
float _noiseMult
Noise multiplier.
void finish()
Mark this stream as finished.
"GSound", global, non-engine sound.
QueuingAudioStream * makeQueuingAudioStream(int rate, int channels)
Factory function for an QueuingAudioStream.
float _frameOut[kChannelsMax][kBlockSizeMax *2]
static int intLog2(uint32 v)
bool isFinished() const
Is the stream marked as finished?
float _noiseTable[kNoiseTabSize]
Noise table.
void debugC(Common::DebugChannel channel, uint32 level, const char *s,...)
bool decodeChannels(Common::BitStream &bits, int bSize, bool msStereo, bool *hasChannel)
bool decodeNoise(Common::BitStream &bits, int bSize, bool *hasChannel, int *coefCount)
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
bool decodeSpectralCoef(Common::BitStream &bits, bool msStereo, bool *hasChannel, int *coefCount, int coefBitCount)
int _lastSuperframeLen
Size of the overhang data.
static void vectorFMulReverse(float *dst, const float *src0, const float *src1, int len)
void reset(PointerType o=0)
Resets the pointer with the new value.
Common::ScopedArray< float > _coefHuffmanLevelTable[2]
Level table for the coef Huffman.
int getBlockSizeCount(uint16 flags)
Utility functions for debug output.
PointerType release()
Returns the plain pointer value and releases ScopedPtr.
Common::ScopedPtr< Common::Huffman > _hgainHuffman
Perceptual noise Huffman code.
const uint8 * huffBits
Bit sizes.
void initCoefHuffman(float bps)
virtual size_t pos() const =0
Return the stream position in bits.
void calculateMDCTCoefficients(int bSize, bool *hasChannel, int *coefCount, int totalGain, float mdctNorm)
int _blockLen
Current block length.
Implementing the reading stream interfaces for plain memory blocks.
int _blockLenBits
log2 of current block length.
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
const float * getSineWindow(int bits)
RewindableAudioStream * makePCMStream(Common::SeekableReadStream *stream, int rate, byte flags, int channels, bool disposeAfterUse)
Creates an audio stream, which plays from the given stream.
uint32 getBits(size_t n)
Read a multi-bit value from the bit stream.
Decoding PCM (Pulse Code Modulation).
int _coefsStart
First coded coef.
void init(Common::SeekableReadStream *extraData)
uint8 _channels
Output channel count.
Static data used for decoding Microsoft's Windows Media Audio.
WMACodec(int version, uint32 sampleRate, uint8 channels, uint32 bitRate, uint32 blockAlign, Common::SeekableReadStream *extraData=0)
size_t pos() const
Return the stream position in bits.
int _blockSizeCount
Number of block sizes.
static const int kBlockSizeMax
Max number of bytes in a block.
void evalFlags(uint16 flags, Common::SeekableReadStream *extraData)
int _highBandValues[kChannelsMax][kHighBandSizeMax]
byte _lastSuperframe[kSuperframeSizeMax+4]
Overhang from the last superframe.
(Inverse) Modified Discrete Cosine Transforms.
A simple scoped smart pointer template.
static const WMACoefHuffmanParam coefHuffmanParam[6]
uint32 getSymbol(BitStream &bits) const
Return the next symbol in the bitstream.
static const uint8 exponentBand44100[3][25]
Basic exceptions to throw.
void calculateCoefCount(int *coefCount, int bSize) const
int _exponentHighBands[kBlockNBSizes][kHighBandSizeMax]
int _prevBlockLenBits
log2 of previous block length.
bool calculateIMDCT(int bSize, bool msStereo, bool *hasChannel)
static const uint8 exponentBand32000[3][25]
Common::PtrVector< Common::MDCT > _mdct
MDCT contexts.
bool decodeRunLevel(Common::BitStream &bits, const Common::Huffman &huffman, const float *levelTable, const uint16 *runTable, int version, float *ptr, int offset, int numCoefs, int blockLen, int frameLenBits, int coefNbBits)
const uint32 * huffCodes
Bit values.
int _lastBitoffset
Bit position within the overhang.
Utility templates and functions.
uint32 _sampleRate
Output sample rate.
int getChannels() const
Return the number channels in this stream.
int _curFrame
The number of the frame we're currently in.
float _maxExponent[kChannelsMax]
An AudioStream designed to work in terms of packets.
Decode a Huffman'd bitstream.
virtual uint32 getBit()=0
Read a bit from the bit stream.
static int readTotalGain(Common::BitStream &bits)
bool endOfData() const
End of data reached? If this returns true, it means that at this time there is no data available in t...
bool _highBandCoded[kChannelsMax][kHighBandSizeMax]
static const int kNoiseTabSize
Size of the noise table.
virtual size_t read(void *dataPtr, size_t dataSize)=0
Read data from the stream.
Simple memory based 'stream', which implements the ReadStream interface for a plain memory block...
static int totalGainToBits(int totalGain)
void window(float *out) const
Apply MDCT window and add into output.
Low-level type definitions to handle fixed width types portably.
Common::ScopedPtr< Common::Huffman > _coefHuffman[2]
Coefficients Huffman codes.
float _lspPowMTable1[(1<< kLSPPowBits)]
int _exponentsBSize[kChannelsMax]
Common::ScopedPtr< QueuingAudioStream > _audStream
A vector storing pointer to objects, with automatic deletion.
int _exponentSizes[kBlockNBSizes]
const uint16 wmaCriticalFreqs[25]
bool useNoiseCoding(float &highFreq, float &bps)
void warning(const char *s,...)
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
uint32 getNormalizedSampleRate()
void calcIMDCT(float *output, const float *input)
Compute inverse MDCT of size N = 2^nbits.
const uint8 scaleHuffBits[121]
static const int kHighBandSizeMax
Max size of a high band.
bool decodeExpLSP(Common::BitStream &bits, int ch)
bool _useBitReservoir
Is each frame packet a "superframe"?
Decoding Microsoft's Windows Media Audio.
static const int kLSPCoefCount
const uint32 scaleHuffCodes[121]
bool _useNoiseCoding
Should perceptual noise be added?
void skip(size_t n)
Skip the specified amount of bits.
int _exponentHighSizes[kBlockNBSizes]
sound is 16 bits wide (default: 8bit)
Generic audio input stream.
#define XOREOS_FALLTHROUGH
PointerType get() const
Returns the plain pointer value.
static void butterflyFloats(float *v1, float *v2, int len)
uint16 _exponentBands[kBlockNBSizes][25]
float _exponents[kChannelsMax][kBlockSizeMax]
size_t size() const
Return the stream size in bits.
bool endOfStream() const
End of stream reached? If this returns true, it means that all data in this stream is used up and no ...
bool _resetBlockLengths
Do we need new block lengths?
void queuePacket(Common::SeekableReadStream *data)
Queue the next packet to be decoded.
Common::ScopedArray< uint16 > _coefHuffmanIntTable[2]
Int table for the coef Huffman.
Parameters for Huffman'd WMA coefficient codes.
bool _useVariableBlockLen
Are the block lengths variable?
bool _useExpHuffman
Exponents in Huffman code? Otherwise, in LSP.
int _frameLenBits
log2 of the frame length.
Decompressing Huffman codes.
virtual void skip(size_t n)=0
Skip the specified amount of bits.
static const int kChannelsMax
Max number of channels we support.
float _output[kBlockSizeMax *2]
int _coefsEnd[kBlockNBSizes]
Max number of coded coefficients.
float _coefs[kChannelsMax][kBlockSizeMax]
std::vector< const float * > _mdctWindow
MDCT window functions.
static const int kSuperframeSizeMax
Max size of a superframe.
float _lspPowMTable2[(1<< kLSPPowBits)]
static void vectorFMulAdd(float *dst, const float *src0, const float *src1, const float *src2, int len)
bool decodeFrame(Common::BitStream &bits, int16 *outputData)
Common::ScopedPtr< Common::Huffman > _expHuffman
Exponents Huffman code.
static void floatToInt16Interleave(int16 *dst, const float **src, uint32 length, uint8 channels)
virtual uint32 getBits(size_t n)=0
Read a multi-bit value from the bit stream.
const uint8 hgainHuffBits[37]
samples are little endian (default: big endian)
uint16 getFlags(Common::SeekableReadStream *extraData)
int _nextBlockLenBits
log2 of next block length.
A template implementing a bit stream for different data memory layouts.
static const int kLSPPowBits
Number of bits for the LSP power value.
bool decodeExpHuffman(Common::BitStream &bits, int ch)
float _coefs1[kChannelsMax][kBlockSizeMax]
Common::SeekableReadStream * decodeSuperFrame(Common::SeekableReadStream &data)
static const int kBlockBitsMax
Max number of bits in a block.
Common::ScopedArray< uint16 > _coefHuffmanRunTable[2]
Run table for the coef Huffman.
bool decodeExponents(Common::BitStream &bits, int bSize, bool *hasChannel)
int _framePos
The position within the frame we're currently in.
PacketizedAudioStream * makeWMAStream(int version, uint32 sampleRate, uint8 channels, uint32 bitRate, uint32 blockAlign, Common::SeekableReadStream &extraData)
Create a PacketizedAudioStream that decodes WMA sound.
static uint32 getLargeVal(Common::BitStream &bits)
uint32 _blockAlign
Input block align.
static const float powTab[]
float getNormalizedMDCTLength() const
int _highBandStart[kBlockNBSizes]
Index of first coef in high band.
const WMACoefHuffmanParam * _coefHuffmanParam[2]
Params for coef Huffman codes.
byte _audioFlags
Output flags.
const float lspCodebook[kLSPCoefCount][16]
static const int kBlockNBSizes
Interface for a seekable & readable data stream.
int getRate() const
Sample rate of the stream.
void lspToCurve(float *out, float *val_max_ptr, int n, float *lsp)
static const int kBlockBitsMin
Min number of bits in a block.
float _lspCosTable[kBlockSizeMax]
size_t readBuffer(int16 *buffer, const size_t numSamples)
Fill the given buffer with up to numSamples samples.
uint32 _bitRate
Input bit rate.
static const uint8 exponentBand22050[3][25]
void evalMDCTScales(float highFreq)
Sound decoding utility functions.