Process audio data compressed with MP3. More...
Classes | |
struct | BandInfo_t |
struct | Chunk_t |
struct | FrameHeader_t |
Decoded 32 bit MP3 packet header. More... | |
struct | FrameHeaderExt_t |
Decoded 32 bit MP3 packet header with extended information. More... | |
struct | GranuleInfo_t |
struct | HuffmanCodeHeader_t |
struct | Layer2_AllocEntry_t |
Preset tables for Version 1, Layer 2 allocation entries. More... | |
struct | Layer3Huffman_t |
struct | Layer3SideInfo_t |
struct | XingChunk_t |
Public Types | |
enum | eMPEGAudioVersionID { MPEG_VERSION_2_5 , MPEG_VERSION_RESERVED , MPEG_VERSION_2 , MPEG_VERSION_1 } |
enum | eMPEGLayerDescription { MPEG_LAYER_RESERVED , MPEG_LAYER_3 , MPEG_LAYER_2 , MPEG_LAYER_1 } |
enum | eMPEGChannelMode { MPEG_MODE_STEREO , MPEG_MODE_JOINT_STEREO , MPEG_MODE_DUAL_CHANNEL , MPEG_MODE_MONO , MPEG_MODE_UNKNOWN } |
enum | eMPEGModeExtension { MPEG_MODEEXT_LR_LR , MPEG_MODEEXT_LR_I , MPEG_MODEEXT_MS_LR , MPEG_MODEEXT_MS_I } |
enum | eMPEGEmphasis { MPEG_EMP_NONE , MPEG_EMP_50_15MS , MPEG_EMP_RESERVED , MPEG_EMP_CCITJ17 } |
enum | eGranuleBlockType { BLOCK_TYPE_NORM , BLOCK_TYPE_START , BLOCK_TYPE_SHORT , BLOCK_TYPE_STOP } |
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
DecompressMP3 () | |
Default constructor. | |
virtual | ~DecompressMP3 () |
Default destructor. | |
eError | Reset (void) override |
Resets the decompresser to defaults. | |
eError | Process (void *pOutput, uintptr_t uOutputChunkSize, const void *pInput, uintptr_t uInputChunkLength) override |
Decompress audio data using alaw. | |
Chunk_t * | AddChunk (const uint8_t *pData, uintptr_t uSize) |
Add a new data chunk into the linked list. | |
void | RemoveLastChunk (void) |
Dispose of the last data chunk. | |
void | RemoveAllChunks (void) |
Dispose of all of the data chunks. | |
uint_t | GetByte (void) |
Fetch a byte from the chunk stream. | |
void | GetBytesFromChunks (uintptr_t uSize) |
Copy data from the chunk list into the bit stream. | |
uint_t | GetBit (void) |
Fetch a single bit from the m_pWorkPointer stream. | |
uint_t | GetBits (uint_t uBitCount) |
Fetch a stream of bits from the bit stream. | |
uint_t | SeekBuffer (uintptr_t uNegativeOffset) |
Update the internal buffer. | |
void | GetMP3Header (void) |
Fetch the 32 bit MP3 header from the chunk stream. | |
uintptr_t | ScanForFramePacket (uint_t bFreeMatchMode) const |
Scan ahead for an MP3 frame packet. | |
int | Layer3AudioDataPrecedesFrame (void) const |
Determine how many bytes to backtrack to next frame. | |
int | AudioDataPrecedesFrame (void) const |
Determine how many bytes to backtrack to next frame. | |
void | Layer3GetSideInfoType1 (uint_t uChannelCount, uint_t bMSStereo, uint_t uSampleRateIndex) |
Parse Side information for Layer 1 Docs in mp3_theory.pdf section 5.1.2 Side Information. | |
void | Layer3GetSideInfoType2 (uint_t uChannelCount, uint_t bMSStereo, uint_t uSampleRateIndex) |
Parse Side information for Layer 2 or 3. | |
int | Layer3GetSideInfo (void) |
Parse Side information. | |
uint_t | Layer3GetScaleFactors1 (uint_t *pScaleFactorIndexes, const GranuleInfo_t *pGranuleInfo) |
Parse scale factor indexes for MPeg 1.0. | |
uint_t | Layer3GetScaleFactors2 (uint_t *pScaleFactorIndexes, GranuleInfo_t *pGranuleInfo, uint_t bStereo) |
Parse scale factor indexes for MPeg 2.0 or 2.5. | |
uint_t | Layer3Dequantize (float *pHybridBuffer, const uint_t *pScaleFactorIndexes, GranuleInfo_t *pGranuleInfo, uint_t uSampleRateIndex, uint_t uBitsPreviouslyParsed) |
dequantize the Hybrid buffer | |
void | Layer3ProcessHybridBuffer (float *pHybridInput, float *pHybridOutput, uint_t uChannel, const GranuleInfo_t *pGranuleInfo) |
Process the hybrid buffers. | |
uint_t | ExtractXingHeader (uintptr_t uSkipAhead) |
Extract data from the Xing chunk. | |
uintptr_t | ProcessMonoSamples (int16_t *pOutput, uintptr_t uOffset, const float *pBand) |
Create samples from audio band information (Mono) | |
uintptr_t | ProcessMonoSamples (float *pOutput, uintptr_t uOffset, const float *pBand) |
Create samples from audio band information (Mono) | |
uintptr_t | ProcessStereoSamples (int16_t *pOutput, uintptr_t uOffset, uint_t uChannel, const float *pBand) |
Create samples from audio band information (Stereo) | |
uintptr_t | ProcessStereoSamples (float *pOutput, uintptr_t uOffset, uint_t uChannel, const float *pBand) |
Create samples from audio band information (Stereo) | |
uintptr_t | Layer3DecodeFrame (int16_t *pOutput, uintptr_t uOffset) |
Process a frame of Layer 3 data into 64 samples. | |
uintptr_t | Layer3DecodeFrame (float *pOutput, uintptr_t uOffset) |
Process a frame of Layer 3 data into 64 samples. | |
eError | Decode (int16_t *pOutput, uintptr_t uOutputSize, const uint8_t *pInput, uintptr_t uInputSize, uintptr_t *pProcessed) |
Decode MP3 data. | |
eError | Decode (float *pOutput, uintptr_t uOutputSize, const uint8_t *pInput, uintptr_t uInputSize, uintptr_t *pProcessed) |
Decode MP3 data. | |
Public Member Functions inherited from Burger::DecompressAudio | |
SoundManager::eDataType | GetDataType (void) const |
Returns the uncompressed data type this codec will output. | |
void | SetMono (void) |
Alert the decompression codec to create a single audio channel. | |
void | SetStereo (void) |
Alert the decompression codec to create stereo channels. | |
uint_t | IsStereo (void) const |
Obtain the stereo/mono state of the decompresser. | |
Public Member Functions inherited from Burger::Decompress | |
Decompress (void) | |
Default constructor. | |
uintptr_t | GetTotalInputSize (void) const noexcept |
Get the total processed input data in bytes. | |
uintptr_t | GetTotalOutputSize (void) const noexcept |
Get the total processed output data in bytes. | |
uintptr_t | GetProcessedInputSize (void) const noexcept |
Get the total processed output data in bytes from the last process pass. | |
uintptr_t | GetProcessedOutputSize (void) const noexcept |
Get the total processed output data in bytes from the last process pass. | |
uint32_t | GetSignature (void) const noexcept |
Return the signature for this decompressor. | |
Public Member Functions inherited from Burger::Base | |
const char * | get_class_name (void) const noexcept |
Get the name of the class. | |
virtual | ~Base () noexcept=default |
Destructor. | |
Static Public Member Functions | |
static DecompressMP3 * | New (void) |
Allocate and initialize a DecompressMP3. | |
Public Attributes | |
Chunk_t * | m_pNext |
First entry in the linked list of data chunks. | |
Chunk_t * | m_pPrev |
Last entry in the linked list of data chunks. | |
uint8_t * | m_pWorkPointer |
Pointer to m_ByteStreamBuffers. | |
uintptr_t | m_uRemainingBytes |
Number of bytes remaining stored in the entire linked list. | |
uintptr_t | m_uPreviousFrameSize |
Previous data frame size, UINTPTR_MAX is none was found. | |
uintptr_t | m_uFrameSize |
Number of bytes in the frame. | |
uintptr_t | m_uSideInfoSize |
Number of bytes for Side Information (Including CRC if present) | |
uintptr_t | m_uMP3DataSize |
Number of compressed byte in the current packet. | |
uint_t | m_uBitIndex |
Which bit is being parse for bit streaming (0-7) | |
uint_t | m_uVBRFrames |
VBR frames from the Xing packet. | |
int | m_iEncodingDelay |
Encoding delay from 0-3000 (or -1 if invalid) | |
int | m_iEncodingPadding |
Encoding padding from 0-3000 (or -1 if invalid) | |
uint_t | m_uWhichBuffer |
Which byte stream buffer is active? (0 or 1) | |
uint_t | m_uSynthBufferOffset |
Synthesizer buffer offset (0-15) | |
uint_t | m_bVBRHeaderValid |
TRUE if a Variable Bit Rate header was parsed. | |
uint_t | m_bSideInfoValid |
TRUE if MP3 side information was parsed. | |
uint_t | m_bDataValid |
TRUE if packet data was found. | |
uint_t | m_bFreeFrame |
TRUE if in free format mode (Sample rate can change) | |
uint_t | m_bPreviousFreeFrame |
TRUE if it was free format mode in the last pass. | |
uint_t | m_uPreviousFramePadding |
Number of bits from the previous frame's padding. | |
uint_t | m_bBitStreamNotSynced |
TRUE if the bit stream hadn't reached a sync marker. | |
FrameHeaderExt_t | m_FrameHeaderExt |
Data frame state. | |
Layer3SideInfo_t | m_Layer3SideInfo |
Side information for Layer 3 decoding. | |
uint8_t | m_ByteStreamBuffers [2][cMaxFrameSize+1024] |
Internal buffers. | |
uint_t | m_uHybridBlockIndexes [2] |
Which m_fHybridBlocks tables that are active (2 channels) | |
float | m_fHybridBlocks [2][2][cSubBandLimit *cSideSampleLimit] |
Buffers for DCT tables. | |
float | m_fSynthBuffers [2][2][256+16] |
Output buffers for DCT transforms (with 16 entry padding) | |
Static Public Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
static const uint_t | cSubBandLimit = 32 |
Number of sub bands. | |
static const uint_t | cSideSampleLimit = 18 |
Number of side samples (Used with sub bands) | |
static const uint_t | cCBands = 64 |
Number of partition bands. | |
static const uint_t | cDecoderDelay = 528 |
Sample delay on decoding. | |
static const uint_t | cEncoderDelay = 576 |
Sample delay on encoding. | |
static const uint_t | cPostDelay = 1152 |
Sample delay for granule encoding. | |
static const uint_t | cMaxFrameSize = 2880 |
Largest allowed frame in samples. | |
static const uint_t | cMDCTDelay = 48 |
Cosine table delay. | |
static const uint_t | cFFTIndex = cMDCTDelay + 224 |
Index into the FFT entry. | |
static const uint_t | cScaleBlock = 12 |
Layer1 / Layer2 scale block. | |
static const uint32_float_t | g_fDecodeWindow [544] |
MP3 decoding windows table. | |
static const Layer2_AllocEntry_t * | g_MP3Layer2Entries [5] |
Pointers to the MP3 Layer2 allocation tables. | |
static const uint8_t | g_HuffLens32 [4 *4] |
Bit lengths for the special case for 32 bits. | |
static const uint8_t | g_HuffLens33 [4 *4] |
Bit lengths for the 2nd special case. | |
static const HuffmanCodeHeader_t | g_HuffmanCodeHeaders [34] |
Array of Huffman trees. | |
static const Layer3Huffman_t | g_MP3CompashHash [2] |
Pointers to compact Huffman hash tables. | |
static const Layer3Huffman_t | g_MP3LongHash [32] |
Pointers to long Huffman hash tables. | |
static const uint32_t | g_HuffmanLengthTable16_24 [16 *16] |
Quick lookup for Huffman 16 and 24 bit tables. | |
static const uint32_t | g_HuffmanLengthTable2_3 [3 *3] |
Quick lookup for Huffman 2 and 3 bit tables. | |
static const uint32_t | g_HuffmanLengthTable5_6 [4 *4] |
Quick lookup for Huffman 5 and 6 bit tables. | |
static const uint_t | g_BitrateTables [3][16] |
Expected bit rate for MP3 files. | |
static const uint16_t | g_DataFrameBitrateTables [2][3][16] |
Bitrate lookup table for the DataFrame_t. | |
static const uint_t | g_SampleRateTables [3][4] |
Expected sample rate for MP3 files. | |
static const uint_t | g_SCFSI_BandTable [5] = { 0, 6, 11, 16, 21 } |
SCale Factor Selection Information. | |
static const uint_t | g_MP3SampleRates [9] |
Table of sample rates supported by MP3. | |
static const BandInfo_t | g_MP3BandInformation [9] |
Band tables for all levels of MP3 encoding. | |
static const uint_t | cSizeofBandInfoDiffHashes = 156 |
Length of each g_MP3BandInfoDiffHashes table in entries. | |
static const uint16_t * | g_MP3BandInfoDiffHashes [9] |
Pointers to hash tables to g_MP3BandInformation differences (Long and short) | |
static const uint_t | cSizeofBandInfoShortDiffHashes = 152 |
Length of each g_MP3BandInfoShortDiffHashes table in entries. | |
static const uint16_t * | g_MP3BandInfoShortDiffHashes [9] |
Pointers to hash tables to g_MP3BandInformation short differences. | |
static const uint_t | cSizeofBandInfoLongDiffHashes = 44 |
Length of each g_MP3BandInfoLongDiffHashes table in entries. | |
static const uint16_t * | g_MP3BandInfoLongDiffHashes [9] |
Pointers to hash tables to g_MP3BandInformation long differences. | |
static const uint8_t | g_MP3BandLongLimits [9][23] |
static const uint8_t | g_MP3BandShortLimits [9][14] |
static const uint8_t | g_GroupTable3 [3][3][3][3] |
MP3 Layer 2 Group table for 3*3*3 granularity. | |
static const uint8_t | g_GroupTable5 [5][5][5][3] |
MP3 Layer 2 Group table for 5*5*5 granularity. | |
static const uint8_t | g_GroupTable9 [9][9][9][3] |
MP3 Layer 2 Group table for 9*9*9 granularity. | |
static const uint32_float_t | g_MP3MulTable64 [27][64] |
MP3 Layer 2 magnitude table. | |
static const uint32_float_t | g_MP3Power3Div4 [8207] |
Table of pow(i,4/3) | |
static const uint32_float_t | g_MP3GainPow2 [378] |
MP3 Layer 3 table for pow(2.0,(i-46)*-0.25) | |
static const uint32_float_t | g_MP3AntiAliasTerms [8 *2] |
MP3 Layer 3 for anti-alias table. | |
static const uint32_float_t | g_MP3BlockType0 [36] |
MP3 Layer 3 table for block type 0. | |
static const uint32_float_t | g_MP3BlockType1 [36] |
MP3 Layer 3 table for block type 1. | |
static const uint32_float_t | g_MP3BlockType2 [12] |
MP3 Layer 3 table for block type 2. | |
static const uint32_float_t | g_MP3BlockType3 [36] |
MP3 Layer 3 table for block type 3. | |
static const float * | g_MP3BlockTypes [4] |
MP3 Layer 3 index table for all block types. | |
static const uint32_float_t | g_MP3PhasedBlockType0 [36] |
MP3 Layer 3 table for phase shifted block type 0. | |
static const uint32_float_t | g_MP3PhasedBlockType1 [36] |
MP3 Layer 3 table for phase shifted block type 1. | |
static const uint32_float_t | g_MP3PhasedBlockType2 [12] |
MP3 Layer 3 table for phase shifted block type 2. | |
static const uint32_float_t | g_MP3PhasedBlockType3 [36] |
MP3 Layer 3 table for phase shifted block type 3. | |
static const float * | g_MP3PhasedBlockTypes [4] |
MP3 Layer 3 index table for all phased block types. | |
static const uint32_float_t | g_MP3TanDivTan [16] |
MP3 Layer 3 tangent table for tan((i * BURGER_PI) / 12.0) / (tan((i * BURGER_PI) / 12.0) + 1) | |
static const uint32_float_t | g_MP3OneDivTan [16] |
MP3 Layer 3 tangent table for 1.0 / (tan((i * BURGER_PI) / 12.0) + 1) | |
static const uint32_float_t | g_MP3Sqrt2TanDivTan [16] |
MP3 Layer 3 tangent table for sqrt(2) * tan((i * BURGER_PI) / 12.0) / (tan((i * BURGER_PI) / 12.0) + 1) | |
static const uint32_float_t | g_MP3Sqrt2DivTan [16] |
MP3 Layer 3 tangent table for sqrt(2) / (tan((i * BURGER_PI) / 12.0) + 1) | |
static const uint32_float_t | g_MP3PowMono1 [2][16] |
MP3 Layer 3 power table1 for mono. | |
static const uint32_float_t | g_MP3PowMono2 [2][16] |
MP3 Layer 3 power table2 for mono. | |
static const uint32_float_t | g_MP3PowStereo1 [2][16] |
MP3 Layer 3 power table1 for stereo. | |
static const uint32_float_t | g_MP3PowStereo2 [2][16] |
MP3 Layer 3 power table2 for stereo. | |
static const uint32_float_t | g_MP3FFTShortWindow [128] |
MP3 Short Blackman FFT window. | |
static const uint32_float_t | g_MP3FFTWindow [1024] |
MP3 Blackman FFT window. | |
static const uint_t | g_MP3IntensitySLen [256] |
MP3 Layer 3 stereo intensity table. | |
static const uint_t | g_MP3NormalSLen [512] |
MP3 Layer 3 mono intensity table. | |
static const uint8_t | g_Layer3ScaleFactors1 [2][16] |
Table of bit widths of scale factor indexes. | |
static const uint8_t | g_Layer3ScaleFactors2 [3][6][4] |
Table of bit widths of scale factor indexes. | |
static const uint8_t | g_Layer3PresetTables [2][22] |
Table of Huffman presets. | |
static const int16_t | g_Table [256] |
static const uint32_t | Signature = 0x4D503320 |
'MP3 ' | |
Static Public Attributes inherited from Burger::DecompressAudio | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::Decompress | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Static Public Attributes inherited from Burger::Base | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
Protected Types | |
enum | eState { STATE_INIT , STATE_CACHEFULL } |
Protected Attributes | |
uint_t | m_uCacheSize |
Number of valid bytes in m_uCache. | |
eState | m_eState |
State of the decompression. | |
int16_t | m_iCache |
Temp uncompressed data buffer. | |
Protected Attributes inherited from Burger::DecompressAudio | |
SoundManager::eDataType | m_eDataType |
Data type the decompresser will create. | |
uint_t | m_bStereo |
TRUE if data is stereo | |
Protected Attributes inherited from Burger::Decompress | |
uintptr_t | m_uTotalInput |
Total number of bytes processed for input. | |
uintptr_t | m_uTotalOutput |
Total number of bytes processed for output. | |
uintptr_t | m_uInputLength |
Number of input bytes processed from the last call to Process() | |
uintptr_t | m_uOutputLength |
Number of output bytes processed from the last call to Process() | |
uint32_t | m_uSignature |
4 character code to identify this decompresser | |
Private Member Functions | |
DecompressMP3 (const DecompressMP3 &)=delete | |
DecompressMP3 & | operator= (const DecompressMP3 &)=delete |
DecompressMP3 (DecompressMP3 &&)=delete | |
DecompressMP3 & | operator= (DecompressMP3 &&)=delete |
Additional Inherited Members | |
Protected Member Functions inherited from Burger::DecompressAudio | |
DecompressAudio (SoundManager::eDataType uDataType) | |
Constructor. | |
Process audio data compressed with MP3.
Convert audio data compressed with MP3 to native 16 bit format
|
protected |
|
privatedelete |
|
privatedelete |
Burger::DecompressMP3::DecompressMP3 | ( | ) |
Default constructor.
Initializes the defaults
|
virtual |
Default destructor.
Dispose all data
Burger::DecompressMP3::Chunk_t *BURGER_API Burger::DecompressMP3::AddChunk | ( | const uint8_t * | pData, |
uintptr_t | uSize ) |
Add a new data chunk into the linked list.
Delete the last chunk in the internal buffer linked list
int BURGER_API Burger::DecompressMP3::AudioDataPrecedesFrame | ( | void | ) | const |
Determine how many bytes to backtrack to next frame.
This function works on all layers. If layer 1 or 2, it will return 0, on layer 3 it will return the frame count to backtrack
Burger::eError BURGER_API Burger::DecompressMP3::Decode | ( | float * | pOutput, |
uintptr_t | uOutputSize, | ||
const uint8_t * | pInput, | ||
uintptr_t | uInputSize, | ||
uintptr_t * | pProcessed ) |
Decode MP3 data.
Workhorse function, call with input data and continuously call this function until OK is returned alerting the calling function that the decoding is complete
This function will create 32 bit floating point output
pOutput | Pointer to a buffer for the decompressed audio data |
uOutputSize | Number of bytes in the output buffer, must be at least 1152 * 2 * sizeof(int16_t) |
pInput | Pointer to the input data |
uInputSize | Number of bytes in the input data |
pProcessed | Pointer to a variable to receive the number of bytes placed in the output buffer |
Burger::eError BURGER_API Burger::DecompressMP3::Decode | ( | int16_t * | pOutput, |
uintptr_t | uOutputSize, | ||
const uint8_t * | pInput, | ||
uintptr_t | uInputSize, | ||
uintptr_t * | pProcessed ) |
Decode MP3 data.
Workhorse function, call with input data and continuously call this function until OK is returned alerting the calling function that the decoding is complete
This function will create 16 bit integer output
pOutput | Pointer to a buffer for the decompressed audio data |
uOutputSize | Number of bytes in the output buffer, must be at least 1152 * 2 * sizeof(int16_t) |
pInput | Pointer to the input data |
uInputSize | Number of bytes in the input data |
pProcessed | Pointer to a variable to receive the number of bytes placed in the output buffer |
uint_t BURGER_API Burger::DecompressMP3::ExtractXingHeader | ( | uintptr_t | uSkipAhead | ) |
Extract data from the Xing chunk.
Scan the packet and locate a Xing chunk and if one is found, parse it but don't update the data chunk pointer.
uSkipAhead | Number of bytes to "skip ahead" before parsing the Xing record |
|
overridevirtualnoexcept |
Get the description to the class.
This virtual function will pull the pointer to the StaticRTTI instance that has the name of the class. Due to it being virtual, it will be the name of the most derived class.
Reimplemented from Burger::DecompressAudio.
uint_t BURGER_API Burger::DecompressMP3::GetBit | ( | void | ) |
Fetch a single bit from the m_pWorkPointer stream.
uint_t BURGER_API Burger::DecompressMP3::GetBits | ( | uint_t | uBitCount | ) |
Fetch a stream of bits from the bit stream.
Given a bit count of 0 to 16, fetch that number of bits from the bit stream
uBitCount | Number of bits to fetch (0 - 16) |
uint_t BURGER_API Burger::DecompressMP3::GetByte | ( | void | ) |
Fetch a byte from the chunk stream.
void BURGER_API Burger::DecompressMP3::GetBytesFromChunks | ( | uintptr_t | uSize | ) |
Copy data from the chunk list into the bit stream.
uSize | Number of bytes to copy from the chunks |
void BURGER_API Burger::DecompressMP3::GetMP3Header | ( | void | ) |
Fetch the 32 bit MP3 header from the chunk stream.
int BURGER_API Burger::DecompressMP3::Layer3AudioDataPrecedesFrame | ( | void | ) | const |
Determine how many bytes to backtrack to next frame.
This is an MP3 Layer 3 function. On Layer 1 or 2 files, it will return invalid values.
uintptr_t BURGER_API Burger::DecompressMP3::Layer3DecodeFrame | ( | float * | pOutput, |
uintptr_t | uOffset ) |
Process a frame of Layer 3 data into 64 samples.
Process a single MP3 frame and output 32 stereo 32 bit floating point samples
pOutput | Pointer to a buffer of 64 samples (32 stereo samples) |
uOffset | Offset from the pointer (Actual buffer is pOutput+uOffset) |
uintptr_t BURGER_API Burger::DecompressMP3::Layer3DecodeFrame | ( | int16_t * | pOutput, |
uintptr_t | uOffset ) |
Process a frame of Layer 3 data into 64 samples.
Process a single MP3 frame and output 32 stereo 16 bit signed samples
pOutput | Pointer to a buffer of 64 samples (32 stereo samples) |
uOffset | Offset from the pointer (Actual buffer is pOutput+uOffset) |
uint_t BURGER_API Burger::DecompressMP3::Layer3Dequantize | ( | float * | pHybridBuffer, |
const uint_t * | pScaleFactorIndexes, | ||
GranuleInfo_t * | pGranuleInfo, | ||
uint_t | uSampleRateIndex, | ||
uint_t | uBitsPreviouslyParsed ) |
dequantize the Hybrid buffer
Using a Huffman tree, extract data and create the hybrid buffer.
pHybridBuffer | Pointer to an uninitialized buffer that's cSubBandLimit*cSideSampleLimit in size |
pScaleFactorIndexes | Pointer to the scale factor indexes |
pGranuleInfo | Pointer to the GranuleInfo_t describing how to parse the stream |
uSampleRateIndex | Sample rate index for selecting the Huffman tree |
uBitsPreviouslyParsed | Number of bit processed in the packet before this function was called |
uint_t BURGER_API Burger::DecompressMP3::Layer3GetScaleFactors1 | ( | uint_t * | pScaleFactorIndexes, |
const GranuleInfo_t * | pGranuleInfo ) |
Parse scale factor indexes for MPeg 1.0.
Read from the bit stream the scale factor index table
pScaleFactorIndexes | Pointer to a buffer of at least 39 entries to store the indexes |
pGranuleInfo | Pointer to the GranuleInfo_t describing how to parse the stream |
uint_t BURGER_API Burger::DecompressMP3::Layer3GetScaleFactors2 | ( | uint_t * | pScaleFactorIndexes, |
GranuleInfo_t * | pGranuleInfo, | ||
uint_t | bStereo ) |
Parse scale factor indexes for MPeg 2.0 or 2.5.
Read from the bit stream the scale factor index table
pScaleFactorIndexes | Pointer to a buffer of at least 39 entries to store the indexes |
pGranuleInfo | Pointer to the GranuleInfo_t describing how to parse the stream |
bStereo | FALSE if mono, any other value for stereo parsing |
int BURGER_API Burger::DecompressMP3::Layer3GetSideInfo | ( | void | ) |
Parse Side information.
Docs in mp3_theory.pdf section 5.1.2 Side Information
void BURGER_API Burger::DecompressMP3::Layer3GetSideInfoType1 | ( | uint_t | uChannelCount, |
uint_t | bMSStereo, | ||
uint_t | uSampleRateIndex ) |
Parse Side information for Layer 1 Docs in mp3_theory.pdf section 5.1.2 Side Information.
uChannelCount | 1 for mono, 2 for stereo |
bMSStereo | TRUE if parsing MS Stereo |
uSampleRateIndex | Sample rate index value |
void BURGER_API Burger::DecompressMP3::Layer3GetSideInfoType2 | ( | uint_t | uChannelCount, |
uint_t | bMSStereo, | ||
uint_t | uSampleRateIndex ) |
Parse Side information for Layer 2 or 3.
Docs in mp3_theory.pdf section 5.1.2 Side Information
uChannelCount | 1 for mono, 2 for stereo |
bMSStereo | TRUE if parsing MS Stereo |
uSampleRateIndex | Sample rate index value |
void BURGER_API Burger::DecompressMP3::Layer3ProcessHybridBuffer | ( | float * | pHybridInput, |
float * | pHybridOutput, | ||
uint_t | uChannel, | ||
const GranuleInfo_t * | pGranuleInfo ) |
Process the hybrid buffers.
Perform the magic! Invoke DCT functions onto the hybrid buffers to set up for audio sample generations.
pHybridInput | Input hybrid buffer |
pHybridOutput | Output hybrid buffer |
uChannel | Which audio channel (0 or 1) |
pGranuleInfo | Pointer to a granule record for this packet |
|
static |
Allocate and initialize a DecompressMP3.
|
privatedelete |
|
privatedelete |
|
overridevirtual |
Decompress audio data using alaw.
Input data is assumed to be alaw compressed bytes.
pOutput | Pointer to the buffer to accept the decompressed data |
uOutputChunkLength | Number of bytes in the output buffer |
pInput | Pointer to data to decompress |
uInputChunkLength | Number of bytes in the data to decompress |
Implements Burger::Decompress.
uintptr_t BURGER_API Burger::DecompressMP3::ProcessMonoSamples | ( | float * | pOutput, |
uintptr_t | uOffset, | ||
const float * | pBand ) |
Create samples from audio band information (Mono)
Given the floats that describe the audio band frequencies, generate the next 32 entries of output sound.
This code is optimized to store audio data in 32 bit floating point format, used by most modern audio hardware.
pOutput | Pointer a buffer of 32 entries for audio data |
uOffset | Offset to the pOutput buffer to write to in bytes |
pBand | Pointer to FFT table |
uintptr_t BURGER_API Burger::DecompressMP3::ProcessMonoSamples | ( | int16_t * | pOutput, |
uintptr_t | uOffset, | ||
const float * | pBand ) |
Create samples from audio band information (Mono)
Given the floats that describe the audio band frequencies, generate the next 32 entries of output sound.
This code is optimized to store audio data in 16 bit signed integer format, used by most older audio hardware.
pOutput | Pointer a buffer of 32 entries for audio data |
uOffset | Offset to the pOutput buffer to write to in bytes |
pBand | Pointer to FFT table |
uintptr_t BURGER_API Burger::DecompressMP3::ProcessStereoSamples | ( | float * | pOutput, |
uintptr_t | uOffset, | ||
uint_t | uChannel, | ||
const float * | pBand ) |
Create samples from audio band information (Stereo)
Given the floats that describe the audio band frequencies, generate the next 32 entries of output sound for one channel of interleaved stereo data. The output buffer must be 64 entries in size with every other value being written.
This code is optimized to store audio data in 32 bit floating point format, used by most modern audio hardware.
pOutput | Pointer a buffer of 64 entries (32 left, 32 right) |
uOffset | Offset to the pOutput buffer to write to in bytes |
uChannel | 0 for even entries, 1 for odd entries |
pBand | Pointer to FFT table |
uintptr_t BURGER_API Burger::DecompressMP3::ProcessStereoSamples | ( | int16_t * | pOutput, |
uintptr_t | uOffset, | ||
uint_t | uChannel, | ||
const float * | pBand ) |
Create samples from audio band information (Stereo)
Given the floats that describe the audio band frequencies, generate the next 32 entries of output sound for one channel of interleaved stereo data. The output buffer must be 64 entries in size with every other value being written.
This code is optimized to store audio data in 16 bit signed integer format, used by most older audio hardware.
pOutput | Pointer a buffer of 64 entries (32 left, 32 right) |
uOffset | Offset to the pOutput buffer to write to in bytes |
uChannel | 0 for even entries, 1 for odd entries |
pBand | Pointer to FFT table |
void BURGER_API Burger::DecompressMP3::RemoveAllChunks | ( | void | ) |
Dispose of all of the data chunks.
Delete all data chunks
void BURGER_API Burger::DecompressMP3::RemoveLastChunk | ( | void | ) |
Dispose of the last data chunk.
Delete the last chunk in the internal buffer linked list
|
overridevirtual |
uintptr_t BURGER_API Burger::DecompressMP3::ScanForFramePacket | ( | uint_t | bFreeMatchMode | ) | const |
Scan ahead for an MP3 frame packet.
Scan ahead byte by byte until a packet ID is found and return the number of bytes to skip to get to the packet. If no packet was found, return -1
bFreeMatchMode | If TRUE, look for packets that match the currently parsed sample rate and layer |
uint_t BURGER_API Burger::DecompressMP3::SeekBuffer | ( | uintptr_t | uNegativeOffset | ) |
Update the internal buffer.
If uNegativeOffset is non-zero, grab that many bytes from the previous data stream and apply it to the current stream
|
static |
Number of partition bands.
|
static |
Sample delay on decoding.
|
static |
Sample delay on encoding.
|
static |
Index into the FFT entry.
|
static |
Largest allowed frame in samples.
|
static |
Cosine table delay.
|
static |
Sample delay for granule encoding.
|
static |
Layer1 / Layer2 scale block.
|
static |
Number of side samples (Used with sub bands)
|
static |
Length of each g_MP3BandInfoDiffHashes table in entries.
|
static |
Length of each g_MP3BandInfoLongDiffHashes table in entries.
|
static |
Length of each g_MP3BandInfoShortDiffHashes table in entries.
|
static |
Number of sub bands.
|
static |
Expected bit rate for MP3 files.
The first index is which type of MP3 file is being looked up and the second index with the bit rate constant.
The order is MPEG_VERSION_2, MPEG_VERSION_1, Special
|
static |
Bitrate lookup table for the DataFrame_t.
Values stolen from this web page section E https://www.mp3-tech.org/programmer/frame_header.html
|
static |
MP3 decoding windows table.
512 + 32 entries of the decode window scaled to 32767.0f so it's used to scale to 16 bit integer output
|
static |
MP3 Layer 2 Group table for 3*3*3 granularity.
|
static |
MP3 Layer 2 Group table for 5*5*5 granularity.
|
static |
MP3 Layer 2 Group table for 9*9*9 granularity.
|
static |
Bit lengths for the special case for 32 bits.
|
static |
Bit lengths for the 2nd special case.
|
static |
Array of Huffman trees.
Array of pointers to all of the Huffman tree tables balanced for MP3 decoding
|
static |
Quick lookup for Huffman 16 and 24 bit tables.
Quick lookup table for the lengths of the 16 bit and the 24 bit tables with the 16 bit entry in the upper 16 bits and the 24 table length in the lower 16 bits. 32 bit integers are used for byte storage so addition can be performed as a 2 entry vector of 2 shorts in an integer
|
static |
Quick lookup for Huffman 2 and 3 bit tables.
Quick lookup table for the lengths of the 2 bit and the 3 bit tables with the 2 bit entry in the upper 16 bits and the 3 table length in the lower 16 bits. 32 bit integers are used for byte storage so addition can be performed as a 2 entry vector of 2 shorts in an integer
|
static |
Quick lookup for Huffman 5 and 6 bit tables.
Quick lookup table for the lengths of the 5 bit and the 6 bit tables with the 5 bit entry in the upper 16 bits and the 6 table length in the lower 16 bits. 32 bit integers are used for byte storage so addition can be performed as a 2 entry vector of 2 shorts in an integer
|
static |
Table of Huffman presets.
|
static |
Table of bit widths of scale factor indexes.
|
static |
Table of bit widths of scale factor indexes.
|
static |
MP3 Layer 3 for anti-alias table.
The first 8 terms are 1.0 / sqrt(1.0 + value*value) The second 8 terms are value / sqrt(1.0 + value*value)
|
static |
Pointers to hash tables to g_MP3BandInformation differences (Long and short)
|
static |
Pointers to hash tables to g_MP3BandInformation long differences.
|
static |
Band tables for all levels of MP3 encoding.
|
static |
Pointers to hash tables to g_MP3BandInformation short differences.
|
static |
|
static |
|
static |
MP3 Layer 3 table for block type 0.
|
static |
MP3 Layer 3 table for block type 1.
|
static |
MP3 Layer 3 table for block type 2.
|
static |
MP3 Layer 3 table for block type 3.
|
static |
MP3 Layer 3 index table for all block types.
|
static |
Pointers to compact Huffman hash tables.
|
static |
MP3 Short Blackman FFT window.
|
static |
MP3 Blackman FFT window.
|
static |
MP3 Layer 3 table for pow(2.0,(i-46)*-0.25)
|
static |
|
static |
Pointers to the MP3 Layer2 allocation tables.
|
static |
Pointers to long Huffman hash tables.
|
static |
MP3 Layer 2 magnitude table.
|
static |
|
static |
MP3 Layer 3 tangent table for 1.0 / (tan((i * BURGER_PI) / 12.0) + 1)
|
static |
MP3 Layer 3 table for phase shifted block type 0.
|
static |
MP3 Layer 3 table for phase shifted block type 1.
|
static |
MP3 Layer 3 table for phase shifted block type 2.
|
static |
MP3 Layer 3 table for phase shifted block type 3.
|
static |
MP3 Layer 3 index table for all phased block types.
|
static |
Table of pow(i,4/3)
|
static |
MP3 Layer 3 power table1 for mono.
|
static |
MP3 Layer 3 power table2 for mono.
|
static |
MP3 Layer 3 power table1 for stereo.
|
static |
MP3 Layer 3 power table2 for stereo.
|
static |
Table of sample rates supported by MP3.
Entries 0-2 are Version 1, 3-5 are Version 2, 6-8 are Version 2.5 indexed by m_uSamplingRateFrequencyIndex
Data found on https://www.mp3-tech.org/programmer/frame_header.html in entry F
|
static |
MP3 Layer 3 tangent table for sqrt(2) / (tan((i * BURGER_PI) / 12.0) + 1)
|
static |
MP3 Layer 3 tangent table for sqrt(2) * tan((i * BURGER_PI) / 12.0) / (tan((i * BURGER_PI) / 12.0) + 1)
|
static |
MP3 Layer 3 tangent table for tan((i * BURGER_PI) / 12.0) / (tan((i * BURGER_PI) / 12.0) + 1)
|
static |
Expected sample rate for MP3 files.
The first index is which type of MP3 file is being looked up and the second index with the sample rate constant.
The order is Mpeg 2, Mpeg 1, Mpeg 2.5
|
static |
SCale Factor Selection Information.
Table for determining the granule size for the current SCFSI band.
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
|
static |
uint_t Burger::DecompressMP3::m_bBitStreamNotSynced |
TRUE if the bit stream hadn't reached a sync marker.
uint_t Burger::DecompressMP3::m_bDataValid |
TRUE if packet data was found.
uint_t Burger::DecompressMP3::m_bFreeFrame |
TRUE if in free format mode (Sample rate can change)
uint_t Burger::DecompressMP3::m_bPreviousFreeFrame |
TRUE if it was free format mode in the last pass.
uint_t Burger::DecompressMP3::m_bSideInfoValid |
TRUE if MP3 side information was parsed.
uint_t Burger::DecompressMP3::m_bVBRHeaderValid |
TRUE if a Variable Bit Rate header was parsed.
uint8_t Burger::DecompressMP3::m_ByteStreamBuffers[2][cMaxFrameSize+1024] |
Internal buffers.
|
protected |
State of the decompression.
float Burger::DecompressMP3::m_fHybridBlocks[2][2][cSubBandLimit *cSideSampleLimit] |
Buffers for DCT tables.
FrameHeaderExt_t Burger::DecompressMP3::m_FrameHeaderExt |
Data frame state.
float Burger::DecompressMP3::m_fSynthBuffers[2][2][256+16] |
Output buffers for DCT transforms (with 16 entry padding)
|
protected |
Temp uncompressed data buffer.
int Burger::DecompressMP3::m_iEncodingDelay |
Encoding delay from 0-3000 (or -1 if invalid)
int Burger::DecompressMP3::m_iEncodingPadding |
Encoding padding from 0-3000 (or -1 if invalid)
Layer3SideInfo_t Burger::DecompressMP3::m_Layer3SideInfo |
Side information for Layer 3 decoding.
Chunk_t* Burger::DecompressMP3::m_pNext |
First entry in the linked list of data chunks.
Chunk_t* Burger::DecompressMP3::m_pPrev |
Last entry in the linked list of data chunks.
uint8_t* Burger::DecompressMP3::m_pWorkPointer |
Pointer to m_ByteStreamBuffers.
uint_t Burger::DecompressMP3::m_uBitIndex |
Which bit is being parse for bit streaming (0-7)
|
protected |
Number of valid bytes in m_uCache.
uintptr_t Burger::DecompressMP3::m_uFrameSize |
Number of bytes in the frame.
uint_t Burger::DecompressMP3::m_uHybridBlockIndexes[2] |
Which m_fHybridBlocks tables that are active (2 channels)
uintptr_t Burger::DecompressMP3::m_uMP3DataSize |
Number of compressed byte in the current packet.
uint_t Burger::DecompressMP3::m_uPreviousFramePadding |
Number of bits from the previous frame's padding.
uintptr_t Burger::DecompressMP3::m_uPreviousFrameSize |
Previous data frame size, UINTPTR_MAX is none was found.
uintptr_t Burger::DecompressMP3::m_uRemainingBytes |
Number of bytes remaining stored in the entire linked list.
uintptr_t Burger::DecompressMP3::m_uSideInfoSize |
Number of bytes for Side Information (Including CRC if present)
uint_t Burger::DecompressMP3::m_uSynthBufferOffset |
Synthesizer buffer offset (0-15)
uint_t Burger::DecompressMP3::m_uVBRFrames |
VBR frames from the Xing packet.
uint_t Burger::DecompressMP3::m_uWhichBuffer |
Which byte stream buffer is active? (0 or 1)
|
static |
'MP3 '