summaryrefslogtreecommitdiff
path: root/zdeflate.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2004-04-08 01:28:31 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2004-04-08 01:28:31 +0000
commit2bb4ca7209a6b7ed86fd9c90a35c1b29df372c38 (patch)
tree158c70efa83fb2a830943cc02b9040dcf20bf351 /zdeflate.h
parent28a05b7a85c837025b0de2e685dfeaf0075cccf3 (diff)
downloadcryptopp-2bb4ca7209a6b7ed86fd9c90a35c1b29df372c38.tar.gz
add detection of uncompressibilty
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@156 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'zdeflate.h')
-rw-r--r--zdeflate.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/zdeflate.h b/zdeflate.h
index 60970d0..03fcbac 100644
--- a/zdeflate.h
+++ b/zdeflate.h
@@ -57,8 +57,11 @@ class Deflator : public LowFirstBitWriter
public:
enum {MIN_DEFLATE_LEVEL = 0, DEFAULT_DEFLATE_LEVEL = 6, MAX_DEFLATE_LEVEL = 9};
enum {MIN_LOG2_WINDOW_SIZE = 9, DEFAULT_LOG2_WINDOW_SIZE = 15, MAX_LOG2_WINDOW_SIZE = 15};
- Deflator(BufferedTransformation *attachment=NULL, int deflateLevel=DEFAULT_DEFLATE_LEVEL, int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE);
- //! possible parameter names: Log2WindowSize, DeflateLevel
+ /*! \note detectUncompressible makes it faster to process uncompressible files, but
+ if a file has both compressible and uncompressible parts, it may fail to compress some of the
+ compressible parts. */
+ Deflator(BufferedTransformation *attachment=NULL, int deflateLevel=DEFAULT_DEFLATE_LEVEL, int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true);
+ //! possible parameter names: Log2WindowSize, DeflateLevel, DetectUncompressible
Deflator(const NameValuePairs &parameters, BufferedTransformation *attachment=NULL);
//! this function can be used to set the deflate level in the middle of compression
@@ -70,7 +73,7 @@ public:
unsigned int Put2(const byte *inString, unsigned int length, int messageEnd, bool blocking);
bool IsolatedFlush(bool hardFlush, bool blocking);
-private:
+protected:
virtual void WritePrestreamHeader() {}
virtual void ProcessUncompressedData(const byte *string, unsigned int length) {}
virtual void WritePoststreamTail() {}
@@ -99,7 +102,8 @@ private:
unsigned distanceExtra : 13;
};
- int m_deflateLevel, m_log2WindowSize;
+ int m_deflateLevel, m_log2WindowSize, m_compressibleDeflateLevel;
+ unsigned int m_detectSkip, m_detectCount;
unsigned int DSIZE, DMASK, HSIZE, HMASK, GOOD_MATCH, MAX_LAZYLENGTH, MAX_CHAIN_LENGTH;
bool m_headerWritten, m_matchAvailable;
unsigned int m_dictionaryEnd, m_stringStart, m_lookahead, m_minLookahead, m_previousMatch, m_previousLength;