"L. Spiro Engine"
|
A primitive and light-weight implementation of a zlib inflation routine. More...
#include <LSCZLib.h>
Classes | |
struct | LSC_HUFFMAN |
Public Types | |
typedef CVectorPoD< LSUINT8, LSUINT32, 0xFFFFUL > | LSC_ZLIB_BUFFER |
Public Member Functions | |
LSBOOL LSE_CALL | DecodeZLib (const LSUINT8 *_pui8Buffer, LSUINTPTR _uiptrLen, LSBOOL _bSkipHeaders, LSC_ZLIB_BUFFER &_zbOut) |
Protected Types | |
enum | { LSC_FAST_BITS = 9UL, LSC_MASK = (1UL << LSC_FAST_BITS) - 1UL } |
typedef struct lsc::CZLib::LSC_HUFFMAN * | LPLSC_HUFFMAN |
typedef struct lsc::CZLib::LSC_HUFFMAN | LPCLSC_HUFFMAN |
Protected Member Functions | |
LSBOOL LSE_CALL | FillBits (const CExternalByteStream &_ebsStream) |
LSBOOL LSE_CALL | Receive (const CExternalByteStream &_ebsStream, LSUINT32 _ui32Total, LSUINT32 &_ui32Return) |
LSBOOL LSE_CALL | ComputeHuffmanCodes (const CExternalByteStream &_ebsStream) |
LSBOOL LSE_CALL | BuildHuffman (LSC_HUFFMAN &_hHuffman, const LSUINT8 *_pui8Codes, LSUINT32 _ui32Total) |
LSINT32 LSE_CALL | DecodeHuffman (const CExternalByteStream &_ebsStream, LSC_HUFFMAN &_hHuffman) |
LSBOOL LSE_CALL | ParseHuffmanBlock (const CExternalByteStream &_ebsStream, LSC_ZLIB_BUFFER &_zbOut) |
LSBOOL LSE_CALL | ParseUncompressed (const CExternalByteStream &_ebsStream, LSC_ZLIB_BUFFER &_zbOut) |
Static Protected Member Functions | |
static LSBOOL LSE_CALL | CheckHeader (const CExternalByteStream &_ebsStream) |
static LSBOOL LSE_CALL | ReadUi8 (const CExternalByteStream &_ebsStream, LSUINT8 &_ui8Dst) |
static LSE_INLINE LSUINT16 LSE_CALL | ReverseBits (LSUINT16 _ui16ReverseMe, LSUINT32 _ui32Shift) |
static LSVOID LSE_CALL | SetDefaults () |
Protected Attributes | |
LSUINT32 | m_ui32BufferedBits |
LSUINT32 | m_ui32TotalBitsBuffered |
LSC_HUFFMAN | m_hLength |
LSC_HUFFMAN | m_hDistance |
Static Protected Attributes | |
static LSUINT8 | m_ui8DefaultLengths [288] |
static LSUINT8 | m_ui8DefaultDistances [32] |
static CCriticalSection | m_scCrit |
A primitive and light-weight implementation of a zlib inflation routine.
Class CZLib Description: A primitive and light-weight implementation of a zlib inflation routine. This class cannot be used to compress/deflate data.
typedef struct lsc::CZLib::LSC_HUFFMAN * lsc::CZLib::LPLSC_HUFFMAN [protected] |
Huffman table.
typedef CVectorPoD<LSUINT8, LSUINT32, 0xFFFFUL> lsc::CZLib::LSC_ZLIB_BUFFER |
The output buffer.
anonymous enum [protected] |
Huffman metrics.
LSBOOL LSE_CALL lsc::CZLib::BuildHuffman | ( | LSC_HUFFMAN & | _hHuffman, |
const LSUINT8 * | _pui8Codes, | ||
LSUINT32 | _ui32Total | ||
) | [protected] |
Build Huffman codes.
_hHuffman | The target Huffman buffer. |
_pui8Codes | Litst of codes. |
_ui32Total | Length of the list of codes. |
static LSBOOL LSE_CALL lsc::CZLib::CheckHeader | ( | const CExternalByteStream & | _ebsStream | ) | [static, protected] |
Check the ZLib header.
_ebsStream | The stream containing the ZLib-compressed buffer. |
LSBOOL LSE_CALL lsc::CZLib::ComputeHuffmanCodes | ( | const CExternalByteStream & | _ebsStream | ) | [protected] |
Compute the Huffman codes.
_ebsStream | The stream. |
LSINT32 LSE_CALL lsc::CZLib::DecodeHuffman | ( | const CExternalByteStream & | _ebsStream, |
LSC_HUFFMAN & | _hHuffman | ||
) | [protected] |
Decode a Huffman buffer.
_ebsStream | The stream. |
_hHuffman | The Huffman buffer. |
LSBOOL LSE_CALL lsc::CZLib::DecodeZLib | ( | const LSUINT8 * | _pui8Buffer, |
LSUINTPTR | _uiptrLen, | ||
LSBOOL | _bSkipHeaders, | ||
LSC_ZLIB_BUFFER & | _zbOut | ||
) |
Decodes a ZLib buffer, optionally skipping the header as per certain iPhone PNG formats.
_pui8Buffer | The compressed buffer to decompress. |
_uiptrLen | Length of the buffer to decompress. |
_bSkipHeaders | If true, headers are skipped. |
_zbOut | Holds the returned decompressed data. |
LSBOOL LSE_CALL lsc::CZLib::FillBits | ( | const CExternalByteStream & | _ebsStream | ) | [protected] |
Fill our bit buffer.
_ebsStream | The stream from which to take bits. |
LSBOOL LSE_CALL lsc::CZLib::ParseHuffmanBlock | ( | const CExternalByteStream & | _ebsStream, |
LSC_ZLIB_BUFFER & | _zbOut | ||
) | [protected] |
Parse a Huffman block.
_ebsStream | The stream. |
_zbOut | The output. |
LSBOOL LSE_CALL lsc::CZLib::ParseUncompressed | ( | const CExternalByteStream & | _ebsStream, |
LSC_ZLIB_BUFFER & | _zbOut | ||
) | [protected] |
Parse and uncompressed block.
_ebsStream | The stream. |
_zbOut | The output. |
static LSBOOL LSE_CALL lsc::CZLib::ReadUi8 | ( | const CExternalByteStream & | _ebsStream, |
LSUINT8 & | _ui8Dst | ||
) | [static, protected] |
Reads a single 8-bit value from the given stream.
_ebsStream | The stream from which to read an 8-bit value. |
_ui8Dst | Destination for the read value. |
LSBOOL LSE_CALL lsc::CZLib::Receive | ( | const CExternalByteStream & | _ebsStream, |
LSUINT32 | _ui32Total, | ||
LSUINT32 & | _ui32Return | ||
) | [protected] |
Read X number of bits.
_ebsStream | The stream from which to take bits. |
_ui32Total | The number of bits to read. |
_ui32Return | Holds the returned value. |
LSE_INLINE LSUINT16 LSE_CALL lsc::CZLib::ReverseBits | ( | LSUINT16 | _ui16ReverseMe, |
LSUINT32 | _ui32Shift | ||
) | [static, protected] |
Reverse bits and shift off some. The reverse is assumed to be on a 16-bit value.
_ui16ReverseMe | The value to reverse. |
_ui32Shift | The number of bits to keep from the reversed value. |
static LSVOID LSE_CALL lsc::CZLib::SetDefaults | ( | ) | [static, protected] |
Apply default sizes and distances.
LSC_HUFFMAN lsc::CZLib::m_hDistance [protected] |
Distance Huffman buffer.
LSC_HUFFMAN lsc::CZLib::m_hLength [protected] |
Length Huffman buffer.
CCriticalSection lsc::CZLib::m_scCrit [static, protected] |
Critcal section for updating the deafult values;
LSUINT32 lsc::CZLib::m_ui32BufferedBits [protected] |
Buffered bits.
LSUINT32 lsc::CZLib::m_ui32TotalBitsBuffered [protected] |
Total bits buffered.
LSUINT8 lsc::CZLib::m_ui8DefaultDistances[32] [static, protected] |
Default distances.
LSUINT8 lsc::CZLib::m_ui8DefaultLengths[288] [static, protected] |
Default lengths.