chnhuffmanencode implements Huffman coding of the channel sequence, channel (CHN format). chnhuffmanencode calls QccENTHUffmanEncodeChannel(3) , which designs the Huffman code table (based upon the observed probability of occurrence of symbols in the channel), encodes the channel symbols, and outputs binary Huffman codewords to the output bitstream. chnhuffmanencode outputs the Huffman code designed for the channel to huffman_table.
chnhuffmanencode initially outputs a few bytes of header information (original number of symbols in channel, symbol alphabet size, and huffman-coding order) to bitstream. The byte-packed bitstream produced by the Huffman coding follows.
Normally, chnarithemticencode prints to stdout the rate achieved by the Huffman coding, expressed in terms of bits per channel symbol. This output may be suppressed by the -s option (silent mode). The -vo option indicates that only the value of the rate is to be printed (terse output). The -s option overrides the -vo option. If option -d is given, the rate is printed as bits per vector component (i.e., it is the bit rate of the Huffman coding divided by vector_dimension). For example, the -d option gives a convenient way to calculate the bit rate, in bits per original source symbol, when the channel corresponds to indices output from a vector quantizer (see vqencode(1) ). Note: the specification of the -d option in no way affects the operation of the Huffman encoder; it affects only the printed output of the rate.
D. A. Huffman, "A Method for the Construction of Minimum-Redundancy Codes," Proceedings of the IRE, vol. 40, pp. 1098-1101, September 1952.