Documentation ¶
Overview ¶
Package huffman implements Huffman prefix coding.
Index ¶
Constants ¶
View Source
const TreeSelectionLimit = 50
TreeSelectionLimit is the symbol limit for each tree selection.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NodeQueue ¶
type NodeQueue []*Node
NodeQueue is a priority queue that keeps track of nodes.
func (*NodeQueue) Pop ¶
func (nq *NodeQueue) Pop() interface{}
Pop pops the lowest priority node from the queue.
type Tree ¶
type Tree struct { Codes []*Code // contains filtered or unexported fields }
Tree is a binary tree that is navigated to produce bits for the frequencies of symbols.
func GenerateTrees ¶
func GenerateTrees(freqs rle2.Frequencies, src []uint16) ([]*Tree, []int)
GenerateTrees creates the trees required to encode the data, and which tree to use for each 50 symbol block of data in src.
func NewTree ¶
func NewTree(freqs rle2.Frequencies) *Tree
NewTree creates a huffman tree and gets the codes for the symbol frequencies given.
Click to show internal directories.
Click to hide internal directories.