Package it.unimi.dsi.sux4j.mph.codec
Class Codec.Huffman
java.lang.Object
it.unimi.dsi.sux4j.mph.codec.Codec.Huffman
- All Implemented Interfaces:
Codec
- Enclosing interface:
- Codec
A Huffman codec with length-limiting capabilities and a fast canonical decoder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface it.unimi.dsi.sux4j.mph.codec.Codec
Codec.Binary, Codec.Decoder, Codec.Gamma, Codec.Huffman, Codec.Unary, Codec.ZeroCodec
-
Constructor Summary
ConstructorDescriptionHuffman()
Creates a new Huffman codec no length limitations.Huffman
(int maxDecodingTableLength) Creates a new Huffman codec with specified limit and entropy threshold equal to 0.999.Huffman
(int maxDecodingTableLength, double entropyThreshold) Creates a new Huffman codec with specified limit and entropy threshold. -
Method Summary
Modifier and TypeMethodDescriptiongetCoder
(Long2LongMap frequencies) Returns a coder for a specific map from symbols to frequencies.
-
Constructor Details
-
Huffman
public Huffman(int maxDecodingTableLength, double entropyThreshold) Creates a new Huffman codec with specified limit and entropy threshold.- Parameters:
maxDecodingTableLength
- a hard limit for the length of the decoding table.entropyThreshold
- the decoding table will be truncated if the accumulated entropy (starting from the most frequent symbols) exceeds this fraction of the overall entropy.
-
Huffman
public Huffman(int maxDecodingTableLength) Creates a new Huffman codec with specified limit and entropy threshold equal to 0.999.- Parameters:
maxDecodingTableLength
- a hard limit for the length of the decoding table.
-
Huffman
public Huffman()Creates a new Huffman codec no length limitations.
-
-
Method Details
-
getCoder
Description copied from interface:Codec
Returns a coder for a specific map from symbols to frequencies.Note that even instantaneous codes (such as
Codec.Unary
) need to know the set of symbols, as the returned coder needs to known the maximum codeword length.
-