Decompress Deflate format. More...
Classes | |
struct | DeflateHuft_t |
Deflate huffman tree definition. More... | |
Public Member Functions | |
const Burger::StaticRTTI * | get_StaticRTTI (void) const noexcept override |
Get the description to the class. | |
DecompressDeflate () | |
Default constructor. | |
virtual | ~DecompressDeflate () |
Release any allocated memory. | |
eError | Reset (void) override |
Reset the decompressor. | |
eError | Process (void *pOutput, uintptr_t uOutputChunkLength, const void *pInput, uintptr_t uInputChunkLength) override |
Decompress data using Deflate compression. | |
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 Attributes | |
static const Burger::StaticRTTI | g_StaticRTTI |
The global description of the class. | |
static const uint32_t | Signature = 0x5A4C4942 |
'ZLIB' | |
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_METHOD , STATE_FLAG , STATE_DICT4 , STATE_DICT3 , STATE_DICT2 , STATE_DICT1 , STATE_DICT0 , STATE_BLOCKS , STATE_CHECK4 , STATE_CHECK3 , STATE_CHECK2 , STATE_CHECK1 , STATE_COMPLETE , STATE_ABORT } |
enum | eBlockMode { BLOCKMODE_TYPE , BLOCKMODE_LENS , BLOCKMODE_STORED , BLOCKMODE_TABLE , BLOCKMODE_BTREE , BLOCKMODE_DTREE , BLOCKMODE_CODES , BLOCKMODE_DRY , BLOCKMODE_COMPLETED , BLOCKMODE_ABORT } |
enum | eCodesMode { CODES_START , CODES_LEN , CODES_LENEXT , CODES_DIST , CODES_DISTEXT , CODES_COPY , CODES_LITERAL , CODES_WASH , CODES_END , CODES_ABORT } |
enum | { FIXED_BLOCKLENGTH =9 , FIXED_BLOCKDISTANCE =5 , MAX_WBITS =15 , MAXTREEDYNAMICSIZE =1440 , PRESET_DICT =0x20 , Z_DEFLATED =8 } |
Protected Member Functions | |
int | Flush (int iErrorCode) |
Copy as much as possible from the sliding window to the output area. | |
int | Fast (uint_t uBitLength, uint_t uBitDistance, const DeflateHuft_t *pHuffmanLength, const DeflateHuft_t *pHuffmanDistance) |
Optimized decompression code. | |
int | ProcessCodes (int iErrorCode) |
Process the decompression codes. | |
void | CodesReset (uint_t bCodeLengthBits, uint_t bCodeDistanceBits, const DeflateHuft_t *pCodeTreeLength, const DeflateHuft_t *pCodeTreeDistance) |
Reset the code state. | |
void | BlocksReset (void) |
Reset the decompression state. | |
int | ProcessBlocks (int iErrorCode) |
Process the data blocks. | |
Static Protected Member Functions | |
static int | BuildHuffmanTrees (const uint_t *pSampleCounts, uint_t uNumberSamples, uint_t uMaxSample, const uint_t *pDefaultLengths, const uint_t *pDefaultBits, DeflateHuft_t **ppNewTree, uint_t *pNewTreeSize, DeflateHuft_t *pExistingTree, uint_t *pHuffmanCount, uint_t *pWorkArea) |
Create a huffman tree. | |
static int | TreesBits (const uint_t *pSampleCounts, uint_t *pNewTreeSize, DeflateHuft_t **ppNewTree, DeflateHuft_t *pExistingTree) |
Set the default huffman trees. | |
static int | TreesDynamic (uint_t uNumberSamples, uint_t uNumberDistance, const uint_t *pSampleCounts, uint_t *pNewTreeSize, uint_t *pNewDistanceSize, DeflateHuft_t **ppNewTree, DeflateHuft_t **ppNewDistance, DeflateHuft_t *pExistingTree) |
Create the dynamic huffman tree. | |
Protected Attributes | |
const uint8_t * | m_pInput |
Packed data pointer. | |
uint8_t * | m_pOutput |
Output data pointer. | |
const uint8_t * | m_pWindowRead |
Window read pointer. | |
uint8_t * | m_pWindowWrite |
Window write pointer. | |
const DeflateHuft_t * | m_pCodeTree |
Pointer into tree. | |
const DeflateHuft_t * | m_pCodeTreeLength |
Pointer to literal/length/eob tree. | |
const DeflateHuft_t * | m_pCodeTreeDistance |
Pointer distance tree. | |
uint_t * | m_pTreesLengths |
Pointer to bit lengths of codes. | |
DeflateHuft_t * | m_pTreesHuffman |
Pointer to bit length decoding tree. | |
uintptr_t | m_uInputChunkLength |
Number of packed bytes remaining. | |
uintptr_t | m_uOutputChunkLength |
Number of bytes in the output buffer. | |
uintptr_t | m_uStoredBytesToCopy |
If STORED, bytes left to copy. | |
eState | m_eState |
State of the decompression. | |
eBlockMode | m_eBlockMode |
Current decompression block mode. | |
eCodesMode | m_eCodesMode |
Current inflate_codes mode. | |
uint32_t | m_uChecksumOfChunk |
Computed checksum value of decompressed data. | |
uint32_t | m_uChecksumInStream |
32 bit literal pulled from the big endian data stream (Must match DecompressDeflate::m_uChecksumInStream) | |
uint32_t | m_uAlder32Checksum |
Checksum on output. | |
uint32_t | m_uBitBucket |
Bit buffer. | |
uint_t | m_uCompressionMethod |
Compression method type. | |
uint_t | m_bLastBlock |
TRUE if this block is the last block. | |
uint_t | m_uBitCount |
Bits in bit buffer. | |
uint_t | m_uCodeLength |
Length in bits of the last code. | |
uint_t | m_uCodeTreeNeed |
Bits needed. | |
uint_t | m_uCodeLiteral |
Literal code fetched. | |
uint_t | m_uCodeCopyGet |
Bits to get for extra token. | |
uint_t | m_uCodeCopyDistance |
Distance back to copy from. | |
uint_t | m_uTreesTable |
Table lengths (14 bits) | |
uint_t | m_uTreesIndex |
Index into blends (or border) | |
uint_t | m_uTreesDepth |
Bit length tree depth. | |
uint8_t | m_bCodeLengthBits |
Length tree bits decoded per branch. | |
uint8_t | m_bCodeDistanceBits |
Distance tree bits decoder per branch. | |
uint8_t | m_WindowBuffer [1<< MAX_WBITS] |
Sliding window. | |
DeflateHuft_t | m_HuffmanTable [MAXTREEDYNAMICSIZE] |
Single data chunk for tree space. | |
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 | |
Static Protected Attributes | |
static const DeflateHuft_t | s_FixedTreeLiteral [] |
Table for preset literal codes. | |
static const DeflateHuft_t | s_FixedTreeDistance [] |
Table for preset distance codes. | |
Decompress Deflate format.
Decompress data in Deflate format which is the format used by ZLIB (Documented here Burger::CompressDeflate )
|
protected |
|
protected |
|
protected |
|
protected |
Burger::DecompressDeflate::DecompressDeflate | ( | ) |
Default constructor.
|
virtual |
Release any allocated memory.
|
protected |
Reset the decompression state.
|
staticprotected |
Create a huffman tree.
pSampleCounts | Pointer to the sample count array |
uNumberSamples | Number of sample count entries |
uMaxSample | Maximum value of a sample |
pDefaultLengths | Pointer to the default length |
pDefaultBits | Pointer to the default bits |
ppNewTree | Pointer to receive the new tree |
pNewTreeSize | Pointer to receive the size of the new tree |
pExistingTree | Pointer to an existing huffman tree |
pHuffmanCount | Pointer to receive the adjusted huffman tree size |
pWorkArea | Pointer to a work buffer |
|
protected |
Reset the code state.
bCodeLengthBits | Default code length bits |
bCodeDistanceBits | Default code distance bits |
pCodeTreeLength | Pointer to the code length huffman tree |
pCodeTreeDistance | Pointer to the code distance huffman tree |
|
protected |
Optimized decompression code.
Called with number of bytes left to write in window at least 258 (the maximum string length) and number of input bytes available at least ten. The ten bytes are six bytes for the longest length/ distance pair plus four bytes for overloading the bit buffer.
uBitLength | Length of the bit stream |
uBitDistance | Bit distance for huffman decoding |
pHuffmanLength | Pointer to the huffman table for length entries |
pHuffmanDistance | Pointer to the huffman table for distance entries |
|
protected |
Copy as much as possible from the sliding window to the output area.
iErrorCode | Current error code |
|
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::Decompress.
|
overridevirtual |
Decompress data using Deflate compression.
Using the Deflate (ZLIB) compression algorithm, decompress the data
pOutput | Pointer to the buffer to accept the decompressed data |
uOutputChunkLength | Number of bytes in the output buffer |
pInput | Pointer to data to compress |
uInputChunkLength | Number of bytes in the data to decompress |
Implements Burger::Decompress.
|
protected |
Process the data blocks.
iErrorCode | Default error code to return |
|
protected |
Process the decompression codes.
iErrorCode | Current error code |
|
overridevirtual |
|
staticprotected |
Set the default huffman trees.
pSampleCounts | Pointer to the sample count array |
pNewTreeSize | Pointer to receive the size of the new tree |
ppNewTree | Pointer to receive the new tree |
pExistingTree | Pointer to an existing huffman tree |
|
staticprotected |
Create the dynamic huffman tree.
uNumberSamples | Number of sample count entries |
uNumberDistance | Number of distance sample entries |
pSampleCounts | Pointer to the sample count array |
pNewTreeSize | Pointer to receive the size of the new tree |
pNewDistanceSize | Pointer to receive the size of the new distance tree |
ppNewTree | Pointer to receive the new tree |
ppNewDistance | Pointer to receive the new distance tree |
pExistingTree | Pointer to an existing huffman tree |
|
static |
The global description of the class.
This record contains the name of this class and a reference to the parent
|
protected |
Distance tree bits decoder per branch.
|
protected |
Length tree bits decoded per branch.
|
protected |
TRUE if this block is the last block.
|
protected |
Current decompression block mode.
|
protected |
Current inflate_codes mode.
|
protected |
State of the decompression.
|
protected |
Single data chunk for tree space.
|
protected |
Pointer into tree.
|
protected |
Pointer distance tree.
|
protected |
Pointer to literal/length/eob tree.
|
protected |
Packed data pointer.
|
protected |
Output data pointer.
|
protected |
Pointer to bit length decoding tree.
|
protected |
Pointer to bit lengths of codes.
|
protected |
Window read pointer.
|
protected |
Window write pointer.
|
protected |
Checksum on output.
|
protected |
Bit buffer.
|
protected |
Bits in bit buffer.
|
protected |
32 bit literal pulled from the big endian data stream (Must match DecompressDeflate::m_uChecksumInStream)
|
protected |
Computed checksum value of decompressed data.
|
protected |
Distance back to copy from.
|
protected |
Bits to get for extra token.
|
protected |
Length in bits of the last code.
|
protected |
Literal code fetched.
|
protected |
Bits needed.
|
protected |
Compression method type.
|
protected |
Number of packed bytes remaining.
|
protected |
Number of bytes in the output buffer.
|
protected |
If STORED, bytes left to copy.
|
protected |
Bit length tree depth.
|
protected |
Index into blends (or border)
|
protected |
Table lengths (14 bits)
|
protected |
Sliding window.
|
staticprotected |
Table for preset distance codes.
|
staticprotected |
Table for preset literal codes.
|
static |
'ZLIB'