summaryrefslogtreecommitdiff
path: root/include/lzsscomprs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lzsscomprs.h')
-rw-r--r--include/lzsscomprs.h61
1 files changed, 12 insertions, 49 deletions
diff --git a/include/lzsscomprs.h b/include/lzsscomprs.h
index 67732a3..b960a55 100644
--- a/include/lzsscomprs.h
+++ b/include/lzsscomprs.h
@@ -1,9 +1,11 @@
/******************************************************************************
- * lzsscomprs.h - definition of Class SWCompress used for data compression
*
- * $Id: lzsscomprs.h 1688 2005-01-01 04:42:26Z scribe $
+ * lzsscomprs.h - definition of Class SWCompress used for data
+ * compression
*
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * $Id: lzsscomprs.h 2935 2013-08-02 11:06:30Z scribe $
+ *
+ * Copyright 1999-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -28,54 +30,15 @@
SWORD_NAMESPACE_START
-// The following are constant sizes used by the compression algorithm.
-//
-// N - This is the size of the ring buffer. It is set
-// to 4K. It is important to note that a position
-// within the ring buffer requires 12 bits.
-//
-// F - This is the maximum length of a character sequence
-// that can be taken from the ring buffer. It is set
-// to 18. Note that a length must be 3 before it is
-// worthwhile to store a position/length pair, so the
-// length can be encoded in only 4 bits. Or, put yet
-// another way, it is not necessary to encode a length
-// of 0-18, it is necessary to encode a length of
-// 3-18, which requires 4 bits.
-//
-// THRESHOLD - It takes 2 bytes to store an offset and
-// a length. If a character sequence only
-// requires 1 or 2 characters to store
-// uncompressed, then it is better to store
-// it uncompressed than as an offset into
-// the ring buffer.
-//
-// Note that the 12 bits used to store the position and the 4 bits
-// used to store the length equal a total of 16 bits, or 2 bytes.
-
-#define N 4096
-#define F 18
-#define THRESHOLD 3
-#define NOT_USED N
-
-
-
-class SWDLLEXPORT LZSSCompress:public SWCompress
+class SWDLLEXPORT LZSSCompress : public SWCompress
{
- static unsigned char m_ring_buffer[N + F - 1];
- static short int m_match_position;
- static short int m_match_length;
- static short int m_lson[N + 1];
- static short int m_rson[N + 257];
- static short int m_dad[N + 1];
- void InitTree ();
- void InsertNode (short int Pos);
- void DeleteNode (short int Node);
+class Private;
+ Private *p;
public:
- LZSSCompress ();
- virtual ~ LZSSCompress ();
- virtual void Encode (void);
- virtual void Decode (void);
+ LZSSCompress ();
+ virtual ~LZSSCompress();
+ virtual void Encode(void);
+ virtual void Decode(void);
};
SWORD_NAMESPACE_END