huffman_decode
Functions
-
int main(int argc, char *argv[])
huffman_encode cbfile [ infile ]
cbfile str
ascii codebook
infile str
bool-type codeword sequence
stdout
int-type symbol sequence
The below example encodes
data.i
and decodes it.huffman_encode cbfile < data.i | huffman_decode cbfile > data.i2 # data.i and data.i2 should be identical
- Parameters:
argc – [in] Number of arguments.
argv – [in] Argument vector.
- Returns:
0 on success, 1 on failure.
See also
-
class HuffmanDecoding
Decode symbols from binary sequence.
The input is a codeword and the output is the corresponding symbol.
Public Functions
-
explicit HuffmanDecoding(std::ifstream *input_stream)
- Parameters:
input_stream – [in] Stream which contains codebook.
-
inline bool IsValid() const
- Returns:
True if this object is valid.
-
bool Get(bool input, int *output, bool *is_leaf)
- Parameters:
input – [in] A bit.
output – [in] Symbol.
is_leaf – [in] True if output is overwritten.
-
explicit HuffmanDecoding(std::ifstream *input_stream)