pub enum EncodingScheme {
BalancedTree,
Fano,
Shannon,
Huffman,
}Expand description
Encoding schems (i.e. the compression algorithms) supported by this library.
Variants§
BalancedTree
Create a new balanced tree encoding.
All letters in this encoding are fixed width bit strings. The smallest width necessary to generate the required number of letters for all input tokens is used.
Fano
Create a new Fano encoding.
Shannon
Create a new Shannon encoding.
The Shannon encoding scheme is defined thus:
Let the tokens, sorted in decreasing order of frequency be
t1, t2, t3 ...
Let the probability of occurrence of the Tokens be f1, f2, f3 ...
Define the numbers l1, l2, l3 ... such that lk = ceil(log2(1/fk))
Let the (computed) cumulative proportions be c1, c2, c3 ...
Then, the code is e1, e2, e3 ...
such that ek = first lk bits of the binary expansion of Fk.
Huffman
Create a new Huffman encoding.
Of the algorithms implemented in this library, this is closest to practical compression libraries used widely - e.g., deflate, jpeg and mp3 use a Huffman-like encoding in their backends.
Trait Implementations§
Source§impl Clone for EncodingScheme
impl Clone for EncodingScheme
Source§fn clone(&self) -> EncodingScheme
fn clone(&self) -> EncodingScheme
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more