diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/public/tier1/lzss.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/public/tier1/lzss.h')
| -rw-r--r-- | mp/src/public/tier1/lzss.h | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/mp/src/public/tier1/lzss.h b/mp/src/public/tier1/lzss.h index 0afdfef0..8b3409a9 100644 --- a/mp/src/public/tier1/lzss.h +++ b/mp/src/public/tier1/lzss.h @@ -1,69 +1,69 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// LZSS Codec. Designed for fast cheap gametime encoding/decoding. Compression results
-// are not aggresive as other alogrithms, but gets 2:1 on most arbitrary uncompressed data.
-//
-//=====================================================================================//
-
-#ifndef _LZSS_H
-#define _LZSS_H
-#pragma once
-
-#define LZSS_ID uint32( BigLong( ('L'<<24)|('Z'<<16)|('S'<<8)|('S') ) )
-#define SNAPPY_ID uint32( BigLong( ('S'<<24)|('N'<<16)|('A'<<8)|('P') ) )
-
-// bind the buffer for correct identification
-struct lzss_header_t
-{
- unsigned int id;
- unsigned int actualSize; // always little endian
-};
-
-class CUtlBuffer;
-
-#define DEFAULT_LZSS_WINDOW_SIZE 4096
-
-class CLZSS
-{
-public:
- unsigned char* Compress( const unsigned char *pInput, int inputlen, unsigned int *pOutputSize );
- unsigned char* CompressNoAlloc( const unsigned char *pInput, int inputlen, unsigned char *pOutput, unsigned int *pOutputSize );
- unsigned int Uncompress( const unsigned char *pInput, unsigned char *pOutput );
- //unsigned int Uncompress( unsigned char *pInput, CUtlBuffer &buf );
- unsigned int SafeUncompress( const unsigned char *pInput, unsigned char *pOutput, unsigned int unBufSize );
-
- static bool IsCompressed( const unsigned char *pInput );
- static unsigned int GetActualSize( const unsigned char *pInput );
-
- // windowsize must be a power of two.
- FORCEINLINE CLZSS( int nWindowSize = DEFAULT_LZSS_WINDOW_SIZE );
-
-private:
- // expected to be sixteen bytes
- struct lzss_node_t
- {
- const unsigned char *pData;
- lzss_node_t *pPrev;
- lzss_node_t *pNext;
- char empty[4];
- };
-
- struct lzss_list_t
- {
- lzss_node_t *pStart;
- lzss_node_t *pEnd;
- };
-
- void BuildHash( const unsigned char *pData );
- lzss_list_t *m_pHashTable;
- lzss_node_t *m_pHashTarget;
- int m_nWindowSize;
-
-};
-
-FORCEINLINE CLZSS::CLZSS( int nWindowSize )
-{
- m_nWindowSize = nWindowSize;
-}
-#endif
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// LZSS Codec. Designed for fast cheap gametime encoding/decoding. Compression results +// are not aggresive as other alogrithms, but gets 2:1 on most arbitrary uncompressed data. +// +//=====================================================================================// + +#ifndef _LZSS_H +#define _LZSS_H +#pragma once + +#define LZSS_ID uint32( BigLong( ('L'<<24)|('Z'<<16)|('S'<<8)|('S') ) ) +#define SNAPPY_ID uint32( BigLong( ('S'<<24)|('N'<<16)|('A'<<8)|('P') ) ) + +// bind the buffer for correct identification +struct lzss_header_t +{ + unsigned int id; + unsigned int actualSize; // always little endian +}; + +class CUtlBuffer; + +#define DEFAULT_LZSS_WINDOW_SIZE 4096 + +class CLZSS +{ +public: + unsigned char* Compress( const unsigned char *pInput, int inputlen, unsigned int *pOutputSize ); + unsigned char* CompressNoAlloc( const unsigned char *pInput, int inputlen, unsigned char *pOutput, unsigned int *pOutputSize ); + unsigned int Uncompress( const unsigned char *pInput, unsigned char *pOutput ); + //unsigned int Uncompress( unsigned char *pInput, CUtlBuffer &buf ); + unsigned int SafeUncompress( const unsigned char *pInput, unsigned char *pOutput, unsigned int unBufSize ); + + static bool IsCompressed( const unsigned char *pInput ); + static unsigned int GetActualSize( const unsigned char *pInput ); + + // windowsize must be a power of two. + FORCEINLINE CLZSS( int nWindowSize = DEFAULT_LZSS_WINDOW_SIZE ); + +private: + // expected to be sixteen bytes + struct lzss_node_t + { + const unsigned char *pData; + lzss_node_t *pPrev; + lzss_node_t *pNext; + char empty[4]; + }; + + struct lzss_list_t + { + lzss_node_t *pStart; + lzss_node_t *pEnd; + }; + + void BuildHash( const unsigned char *pData ); + lzss_list_t *m_pHashTable; + lzss_node_t *m_pHashTarget; + int m_nWindowSize; + +}; + +FORCEINLINE CLZSS::CLZSS( int nWindowSize ) +{ + m_nWindowSize = nWindowSize; +} +#endif + |