huffman [options] source [target]
Options:
-u
uncompress file
-z
compress file (by default)
-r
rename output (should be used with target specified, ${source}.huff
by default)
Examples:
huffman -u zip.huff
huffman -zr code.txt code.huff
Dictionary Size
8bit(char)
File Structure:
Header | Data |
---|
Header Structure:
Header | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
tree size | node 1 | node 2 | ... | node n | ||||||
huff code length | huff code block 1 | huff code block 2 | ... | margin part for last block | huff code block (m+7)/8 | source code | ||||
n-1 (8bit) | m(8bit) | 8bit | 8bit | -m mod8 bit | m mod8 bit | 8bit |
Data Structure:
Data | ||
---|---|---|
huffman bitstream | alignment | alignment size |
a bit | a(8bit) |
First submitted by Catoverflow, as experiment homework for data structure class :3