forked from madler/zlib
-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Bulent Abali edited this page Nov 18, 2015
·
16 revisions
Zlib/Make-dht is a slightly modified version of the Zlib library. You supply the literal/length and distance symbol frequencies. Make-dht produces a Huffman table that deflate() would have inserted in the Deflate block. We introduced a new zlib function, deflate_make_dht(). Also provided sample code in examples/makedht.c
- If you are studying Zlib.
- If you are debugging your own inflate implementation, implemented in software or hardware, and you want to test it with various huffman tables that zlib would have produced.
- If your hardware cannot produce its own huffman table and needs zlib's help.
Clone abalib/zlib and checkout make-dht or develop:
git clone https://github.com/abalib/zlib
git checkout make-dht
Follow the zlib README instructions.
cd to zlib root directory
./configure
make
cd examples
cc -O -I.. -o makedht makedht.c ../libz.a
Usage example:
./makedht jabber1.lzcount jabber1.dht
bytes: 19 invalid bits: 4
00000000000000000000000000000094
203826000000220058c5a6900244f0c3
d7770700000000000000000000000000
Hex dump of the same:
xxd jabber1.dht
0000000: 2038 2600 0000 2200 58c5 a690 0244 f0c3 8&...".X....D..
0000010: d777 07 .w.
Contents of jabber1.lzcount. Symbol 32 occurs 2 times, 39 occurs 1 times, ... , distance symbols 0 and 29 occur 0 times. Missing symbols occur 0 times by default:
32 : 2
39 : 1
84 : 1
97 : 1
98 : 1
114 : 1
115 : 1
119 : 1
256 : 1
0 : 0
29 : 0
More details on usage are found in the makedht.c comments.