📄 adaptive huffman encoding.htm
字号:
<html><head><title>Adaptive Huffman Encoding</title></head><body><center><h2>Adaptive Huffman Encoding</h2></center>
<hr>
<p>
</p><h3>Description</h3>
<p>
<table border="1" cellpadding="5" cellspacing="1">
<tbody><tr><td><b>Author</b></td><td><a href="http://www.xcf.berkeley.edu/%7Ejmacd">Josh MacDonald</a>
(<a href="mailto:jmacd@XCF.Berkeley.EDU">jmacd@XCF.Berkeley.EDU</a>)</td></tr>
<tr><td><b>Organization</b></td><td>
<a href="http://www.xcf.berkeley.edu/">XCF</a></td></tr>
<tr><td><b>Date</b></td><td>Aug 9, 1996</td></tr>
<tr><td><b>Purpose</b></td><td>This is a library for adaptive Huffman encoding, as described by Knuth in "Dynamic Huffman Coding", Journal of Algorithms vol 6.</td></tr>
<tr><td><b>Portability</b></td><td>ANSI</td></tr>
</tbody></table>
</p><p>
</p><p>
</p><h3>Interface</h3>
<p>
</p><p>
<em>Exported Types</em>
<table border="1" cellpadding="5" cellspacing="1">
<tbody><tr><td>HuffStruct</td><td>This struct has no user defined
operations and is left unspecified. It contains the state of the
huffman codec and is passed as an argument to allmost all the routines
in this package.</td></tr>
<tr><td>Bit</td><td>If you have to ask, you don't know.</td></tr>
</tbody></table>
</p><p>
</p><p>
<em>Exported Functions</em>
<table border="1" cellpadding="5" cellspacing="1">
<tbody><tr>
<td><b>Function</b></td><td><b>Description</b></td>
<td><b>Doc</b></td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_035">Huff_Dump_Stats()</a>
</td><td>write a table.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_034">Huff_Delete()</a>
</td><td>deletion.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_033">Huff_Decode_Data()</a>
</td><td>once ReceiveBit returns 1, this retrieves an index into the
alphabet otherwise this returns 0, indicating more bits are
required.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_031">Huff_Decode_Bit()</a>
</td><td>receives a bit at a time and returns true when a complete code has
been received.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_020">Huff_Get_Encoded_Bit()</a>
</td><td>Should be called as many times as Huff_Encode_Data returns.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_019">Huff_Encode_Data()</a>
</td><td>Takes Huffman transmitter h and n, the nth elt in the alphabet, and
returns the number of required to encode n.
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_016">Huff_Initialize_Adaptive_Encoder()</a>
</td><td>returns an initialized Huffman encoder for an alphabet with the
given size. returns NULL if enough memory cannot be allocated
</td><td>N/A</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_017">Huff_Initialize_Training_Encoder()</a>
</td><td>returns an initialized encoder for encoding via a fixed table and
raining that table for future uses.
</td><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/Huff_Initialize_Training_Encoder.info.html">More</a></td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c#M_018">Huff_Initialize_Fixed_Encoder()</a>
</td><td>returns an initialized encoder for encoding via a fixed table which
was hard coded. The header to include can be produced by a stats
file using the utility stats2header.
</td><td>N/A</td></tr>
</tbody></table>
</p><p>
</p><p>
</p><h3>Source Files</h3>
<p>
<table border="1" cellpadding="5" cellspacing="1">
<tbody><tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.h.html">huff.h</a></td><td>Interface</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c.html">huff.c</a></td><td>Implementation</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/stats2header.c.html">stats2header.c</a></td><td>A utility for generating header files from tables.</td></tr>
<tr><td><a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/stats.h.html">stats.h</a></td><td>Table of frequencies for Huffman compression trees (automatically generated by <b>stat2header</b>.</td></tr>
</tbody></table>
</p><p>
</p><h3>Examples</h3>
<p>
See the bottom of <a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/code/huff.c.html">huff.c</a> for an example.
</p><p>
</p><h3>Miscellaenous</h3>
<p>
This is a library for adaptive Huffman encoding, as described by Knuth
in "Dynamic Huffman Coding", Journal of Algorithms vol 6. </p><p> A test program <code>compact</code>
is compiled by default, which uses the algorithm to compress and
uncompress files. The driver is very simple and accepts only the -d
flag, and will not use the standard io. The -d flag or calling the
program under the name 'uncompact' will cause it to uncompress. It
writes compressed files with a <code>.jz</code> extensions. </p><p>
The stats2header file takes 3 arguments, infile outfile table_name.
infile is the name of a file containing whitespace separated numbers,
the first being the alphabet size and the rest being the frequency of
each element in the alphabet. </p><p> Do not use zero-frequency elements in these stats files, I haven't accounted for those yet.
</p><p>
</p><h3>Download The Package</h3>
<p>
<a href="http://www.xcf.berkeley.edu/%7Eali/K0D/Algorithms/huff/huff.tar.gz">huff.tar.gz</a>
</p><p>
</p><hr>
<address>
<a href="mailto:repository@xcf.berkeley.edu">Repository@XCF.Berkeley.EDU</a>
</address>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -