My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Project Information
Members

A variant of David Huffman's original algorithm is implemented as a template class. Parameters for a size_type, a byte type, and a bits-per-byte (integral) value are specified. Compression, decompression, and premeasurement facilities occur over one or more iterators. Compression is extremely fast (thanks to a set of lookup tables), and decompression is sufficiently so.

Internally, the Huffman tree is communicated within 3 to 320 byte packets. Memory allocation is done in a single block, up front, and is managed internally. Both initialization and cleanup should be seemless, and as much has been observed.

Iterators can be to file streams, arrays, containers (back_inserter, et al), or really anything. The key thing is that the iterator is ultimately responsible for it's internal errors, so it is customary to enclose calls in a try/catch block, handling each custom exception. The library code will report back the number of bytes processed or else zero if an error occurs (or the data set is empty). Note that you can also throw a huffman<SizeType, Byte, BitsPerByte>::exception, if you want to cause the library to simply return zero, which may be most convenient.

Powered by Google Project Hosting