我在MATLAB中实现了霍夫曼编码,后来它将在FPGA中实现。在硬件中,每个值由16位表示。现在我想找到编码数据后实现的压缩率。由于非必需品也必须与解码数据一起转移,我应该将其大小包含在数据的总大小中吗?如果是,我应该怎么做?
以下是字典(16位有符号整数及其代码字)的样子:
-88 [1,1,1,0,1,0,1]
-76 [1,1,1,0,1,0,0]
-66 [1,1,1,0,1,1,1]
-59 [1,1,1,0,1,1,0]
-48 [1,1,1,0,0,0,1]
-38 [1,1,0,0,1,0,1]
-30 [1,1,1,0,0,0,0]
-27 [1,1,1,0,0,1,1]
-23 [1,1,1,0,0,1,0]
-18 [1,1,1,1,1,0,1]
-9 [1,1,1,1,1,0,0]
-8 [1,1,0,0,1,0,0]
-7 [1,1,1,1,1,1,1]
-5 [1,1,1,1,1,1,0]
-4 [1,1,0,0,1,1,1]
-3 [1,1,1,1,0,0,1]
-2 [1,1,1,1,0,0,0]
-1 [1,0,1]
0 0
1 [1,0,0]
2 [1,1,0,0,1,1,0]
4 [1,1,0,0,0,0,1]
6 [1,1,1,1,0,1,1]
7 [1,1,1,1,0,1,0]
8 [1,1,0,1,0,1,0,1]
9 [1,1,0,0,0,0,0]
12 [1,1,0,1,1,1]
13 [1,1,0,0,0,1,1]
15 [1,1,0,1,0,1,0,0]
16 [1,1,0,1,0,1,1,1]
22 [1,1,0,1,0,1,1,0]
23 [1,1,0,1,0,0,0,1]
27 [1,1,0,0,0,1,0]
30 [1,1,0,1,0,0,0,0]
31 [1,1,0,1,0,0,1,1]
35 [1,1,0,1,1,0,1]
41 [1,1,0,1,1,0,0]
83 [1,1,0,1,0,0,1,0]
其次,我不想发送整棵树(因为它需要更多的空间),所以你能建议我这么简单吗?我已经读过Deflate和Adaptive Huffman了。
谢谢!