文件名称:huffman
介绍说明--下载内容均来自于网络,请自行研究使用
由于目前数字通信中一般都使用二进制符号,因此二进制的Huffman编码技术最为普遍,其编码步骤如下:
1、将信源符号按概率从大到小进行排列;
2、给两个概率最小的信源符号各分配一个码元“0”和“1”,然后将这两个信源符号合并成一个新符号,并用这两个最小的概率之和作为新符号的概率,结果得到一个只有(n-1)个信源符号的新信源(假设原来所需编码的符号数为n),称为信源的第一次缩减信源S1;
3、将缩减信源S1的符号仍按概率从大到小的顺序进行排列,重复步骤2,得到只含(n-2)个符号的缩减信源S2;
4、重复上述步骤,直至缩减信源只剩两个符号为止,此时所剩两个符号的概率之和必为1,将这两个符号各分配一个码元“0”和“1”后,从最后一级缩减信源开始,依编码路径向前返回,就得到各信源符号所对应的Huffman码字。
-Due to the current digital communication in general use binary symbols, so the Huffman coding of binary is the most common, the encoding procedure is as follows:1, the source symbols according to the probability from big to small order 2, to the two smallest source symbols of each is assigned a code "0" and "1", then the two source symbols are combined into a new symbol, and the two smallest probability and probability as a new symbol, the result is a only (n-1) new source source symbols (the original hypothesis number symbols required coding for n), called the first cut the source S1 source 3, cut the source S1 symbols according to probability from big to small order of rank, repeat steps 2, got only containing (n-2) a symbolic reduction source S2 4, repeat the above steps, until reduced source only two symbols, the remaining two symbol probability and will be 1, these two symbols each assigned a symbol "0" and "1", from the beginning of last stage reduced source, according to code pa
1、将信源符号按概率从大到小进行排列;
2、给两个概率最小的信源符号各分配一个码元“0”和“1”,然后将这两个信源符号合并成一个新符号,并用这两个最小的概率之和作为新符号的概率,结果得到一个只有(n-1)个信源符号的新信源(假设原来所需编码的符号数为n),称为信源的第一次缩减信源S1;
3、将缩减信源S1的符号仍按概率从大到小的顺序进行排列,重复步骤2,得到只含(n-2)个符号的缩减信源S2;
4、重复上述步骤,直至缩减信源只剩两个符号为止,此时所剩两个符号的概率之和必为1,将这两个符号各分配一个码元“0”和“1”后,从最后一级缩减信源开始,依编码路径向前返回,就得到各信源符号所对应的Huffman码字。
-Due to the current digital communication in general use binary symbols, so the Huffman coding of binary is the most common, the encoding procedure is as follows:1, the source symbols according to the probability from big to small order 2, to the two smallest source symbols of each is assigned a code "0" and "1", then the two source symbols are combined into a new symbol, and the two smallest probability and probability as a new symbol, the result is a only (n-1) new source source symbols (the original hypothesis number symbols required coding for n), called the first cut the source S1 source 3, cut the source S1 symbols according to probability from big to small order of rank, repeat steps 2, got only containing (n-2) a symbolic reduction source S2 4, repeat the above steps, until reduced source only two symbols, the remaining two symbol probability and will be 1, these two symbols each assigned a symbol "0" and "1", from the beginning of last stage reduced source, according to code pa
(系统自动生成,下载前可以参看下载内容)
下载文件列表
huffman.cpp