aboutsummaryrefslogblamecommitdiffstats
path: root/doc/api-documentation/html/lzsscomprs_8h-source.html
blob: 0fe73f64a5a0e514389ca275e81ea9ed0b979532 (plain) (tree)




























































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>lzsscomprs.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
<hr><h1>lzsscomprs.h</h1><div class="fragment"><pre>00001 <font class="comment">/******************************************************************************</font>
00002 <font class="comment"> *  lzsscomprs.h   - definition of Class SWCompress used for data compression</font>
00003 <font class="comment"> *</font>
00004 <font class="comment"> * $Id: lzsscomprs_8h-source.html,v 1.7 2002/06/20 20:23:09 mgruner Exp $</font>
00005 <font class="comment"> *</font>
00006 <font class="comment"> * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)</font>
00007 <font class="comment"> *      CrossWire Bible Society</font>
00008 <font class="comment"> *      P. O. Box 2528</font>
00009 <font class="comment"> *      Tempe, AZ  85280-2528</font>
00010 <font class="comment"> *</font>
00011 <font class="comment"> * This program is free software; you can redistribute it and/or modify it</font>
00012 <font class="comment"> * under the terms of the GNU General Public License as published by the</font>
00013 <font class="comment"> * Free Software Foundation version 2.</font>
00014 <font class="comment"> *</font>
00015 <font class="comment"> * This program is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"> *</font>
00020 <font class="comment"> */</font>
00021 
00022 <font class="preprocessor">#ifndef LZSSCOMPRS_H</font>
00023 <font class="preprocessor"></font><font class="preprocessor">#define LZSSCOMPRS_H</font>
00024 <font class="preprocessor"></font>
00025 <font class="preprocessor">#include &lt;swcomprs.h&gt;</font>
00026 
00027 <font class="preprocessor">#include &lt;defs.h&gt;</font>
00028 
00029 <font class="comment">// The following are constant sizes used by the compression algorithm.</font>
00030 <font class="comment">//</font>
00031 <font class="comment">//  N         - This is the size of the ring buffer.  It is set</font>
00032 <font class="comment">//              to 4K.  It is important to note that a position</font>
00033 <font class="comment">//              within the ring buffer requires 12 bits.  </font>
00034 <font class="comment">//</font>
00035 <font class="comment">//  F         - This is the maximum length of a character sequence</font>
00036 <font class="comment">//              that can be taken from the ring buffer.  It is set</font>
00037 <font class="comment">//              to 18.  Note that a length must be 3 before it is</font>
00038 <font class="comment">//              worthwhile to store a position/length pair, so the</font>
00039 <font class="comment">//              length can be encoded in only 4 bits.  Or, put yet</font>
00040 <font class="comment">//              another way, it is not necessary to encode a length</font>
00041 <font class="comment">//              of 0-18, it is necessary to encode a length of</font>
00042 <font class="comment">//              3-18, which requires 4 bits.</font>
00043 <font class="comment">//              </font>
00044 <font class="comment">//  THRESHOLD - It takes 2 bytes to store an offset and</font>
00045 <font class="comment">//              a length.  If a character sequence only</font>
00046 <font class="comment">//              requires 1 or 2 characters to store </font>
00047 <font class="comment">//              uncompressed, then it is better to store</font>
00048 <font class="comment">//              it uncompressed than as an offset into</font>
00049 <font class="comment">//              the ring buffer.</font>
00050 <font class="comment">//</font>
00051 <font class="comment">// Note that the 12 bits used to store the position and the 4 bits</font>
00052 <font class="comment">// used to store the length equal a total of 16 bits, or 2 bytes.</font>
00053 
00054 <font class="preprocessor">#define N               4096</font>
00055 <font class="preprocessor"></font><font class="preprocessor">#define F               18</font>
00056 <font class="preprocessor"></font><font class="preprocessor">#define THRESHOLD       3</font>
00057 <font class="preprocessor"></font><font class="preprocessor">#define NOT_USED        N</font>
00058 <font class="preprocessor"></font>
00059 
00060 
00061 <font class="keyword">class </font>SWDLLEXPORT LZSSCompress:<font class="keyword">public</font> SWCompress
00062 {
00063   <font class="keyword">static</font> <font class="keywordtype">unsigned</font> <font class="keywordtype">char</font> m_ring_buffer[N + F - 1];
00064   <font class="keyword">static</font> <font class="keywordtype">short</font> <font class="keywordtype">int</font> m_match_position;
00065   <font class="keyword">static</font> <font class="keywordtype">short</font> <font class="keywordtype">int</font> m_match_length;
00066   <font class="keyword">static</font> <font class="keywordtype">short</font> <font class="keywordtype">int</font> m_lson[N + 1];
00067   <font class="keyword">static</font> <font class="keywordtype">short</font> <font class="keywordtype">int</font> m_rson[N + 257];
00068   <font class="keyword">static</font> <font class="keywordtype">short</font> <font class="keywordtype">int</font> m_dad[N + 1];
00069   <font class="keywordtype">void</font> InitTree ();
00070   <font class="keywordtype">void</font> InsertNode (<font class="keywordtype">short</font> <font class="keywordtype">int</font> Pos);
00071   <font class="keywordtype">void</font> DeleteNode (<font class="keywordtype">short</font> <font class="keywordtype">int</font> Node);
00072 <font class="keyword">public</font>:
00073     LZSSCompress ();
00074     <font class="keyword">virtual</font> ~ LZSSCompress ();
00075   <font class="keyword">virtual</font> <font class="keywordtype">void</font> Encode (<font class="keywordtype">void</font>);
00076   <font class="keyword">virtual</font> <font class="keywordtype">void</font> Decode (<font class="keywordtype">void</font>);
00077 };
00078 
00079 <font class="preprocessor">#endif</font>
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:59 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>