Documentation ¶
Overview ¶
Package huffman provices some implementations of different algorithms for generating Huffman trees.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCode ¶
GenerateCode generate code in reversed format. This method can be used for deflate header written
func GenerateCodeForIAA ¶
GenerateCodeForIAA generate code in non-reversed format. Result will be inplace.
Types ¶
type LenLimitedCode ¶
type LenLimitedCode struct {
// contains filtered or unexported fields
}
LenLimitedCode implements a code length limited algorithm huffman tree generator.
func NewLenLimitedCode ¶
func NewLenLimitedCode() *LenLimitedCode
NewLenLimitedCode creates a new LenLimitedCode instance
type MoffatHuffmanCode ¶
type MoffatHuffmanCode struct{}
MoffatHuffmanCode implements In-Place Calculation of Minimum-Redundancy Codes. Check http://hjemmesider.diku.dk/~jyrki/Paper/WADS95.pdf .
func (*MoffatHuffmanCode) Generate ¶
func (m *MoffatHuffmanCode) Generate(histogram []int32)
Generate huffman tree from histogram and write tree codes into codes.
type TreeGenerator ¶
type TreeGenerator interface { // Generate huffman tree from histogram and write tree codes into codes. Generate(maxLens int, histogram []int32, codeLens []int32) (num int) }
TreeGenerator generate code's lengths from the histogram A huffman tree generator must be reused due to memory allocation overhead.