diff options
Diffstat (limited to 'src/huffman/huff.h')
-rw-r--r-- | src/huffman/huff.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/huffman/huff.h b/src/huffman/huff.h index d2c3e3e..b75acbb 100644 --- a/src/huffman/huff.h +++ b/src/huffman/huff.h @@ -9,13 +9,13 @@ /* 03.05.03 2.00 Lad Added compression */ /* 08.12.03 2.01 Dan High-memory handling (> 0x80000000) */ /*****************************************************************************/ - + #ifndef __HUFFMAN_H__ #define __HUFFMAN_H__ //----------------------------------------------------------------------------- // Defines - + #define HUFF_ITEM_COUNT 0x203 // Number of items in the item pool #define LINK_ITEM_COUNT 0x80 // Maximum number of quick-link items @@ -32,23 +32,23 @@ class TInputStream unsigned int Peek7Bits(); unsigned int Get8Bits(); void SkipBits(unsigned int BitCount); - + unsigned char * pbInBufferEnd; // End position in the the input buffer unsigned char * pbInBuffer; // Current position in the the input buffer unsigned int BitBuffer; // Input bit buffer unsigned int BitCount; // Number of bits remaining in 'dwBitBuff' }; - + // Output stream for Huffmann compression class TOutputStream { public: - + TOutputStream(void * pvOutBuffer, size_t cbOutLength); void PutBits(unsigned int dwValue, unsigned int nBitCount); void Flush(); - + unsigned char * pbOutBufferEnd; // End position in the output buffer unsigned char * pbOutBuffer; // Current position in the output buffer unsigned int BitBuffer; // Bit buffer @@ -72,7 +72,7 @@ struct THTreeItem void RemoveItem(); // void RemoveEntry(); - + THTreeItem * pNext; // Pointer to lower-weight tree item THTreeItem * pPrev; // Pointer to higher-weight item unsigned int DecompressedValue; // 08 - Decompressed byte value (also index in the array) @@ -87,7 +87,7 @@ struct THTreeItem // decompressing a bit faster. Sometimes it can even get the decompressed // byte directly. struct TQuickLink -{ +{ unsigned int ValidValue; // If greater than THuffmannTree::MinValidValue, the entry is valid unsigned int ValidBits; // Number of bits that are valid for this item link union @@ -96,7 +96,7 @@ struct TQuickLink unsigned int DecompressedValue; // Value for direct decompression }; }; - + // Structure for Huffman tree (Size 0x3674 bytes). Because I'm not expert // for the decompression, I do not know actually if the class is really a Hufmann @@ -104,7 +104,7 @@ struct TQuickLink class THuffmannTree { public: - + THuffmannTree(bool bCompression); ~THuffmannTree(); @@ -125,17 +125,17 @@ class THuffmannTree unsigned int Compress(TOutputStream * os, void * pvInBuffer, int cbInBuffer, int nCmpType); unsigned int Decompress(void * pvOutBuffer, unsigned int cbOutLength, TInputStream * is); - + THTreeItem ItemBuffer[HUFF_ITEM_COUNT]; // Buffer for tree items. No memory allocation is needed unsigned int ItemsUsed; // Number of tree items used from ItemBuffer - + // Head of the linear item list THTreeItem * pFirst; // Pointer to the highest weight item THTreeItem * pLast; // Pointer to the lowest weight item THTreeItem * ItemsByByte[0x102]; // Array of item pointers, one for each possible byte value TQuickLink QuickLinks[LINK_ITEM_COUNT]; // Array of quick-link items - + unsigned int MinValidValue; // A minimum value of TQDecompress::ValidValue to be considered valid unsigned int bIsCmp0; // 1 if compression type 0 }; |