跳转到内容

指数哥伦布码

本页使用了标题或全文手工转换
维基百科,自由的百科全书

指数哥伦布码Exponential-Golomb coding)是一种无损数据压缩方法。

用来表示非负整数的k阶指数哥伦布码可用如下步骤生成:

  1. 将数字以二进制形式写出(B),去掉最低的k个位元(D),之后加1 (A = B + 1)
  2. 计算A的位元个数(C),将此数减一,即是需要增加的前导零个数(Z = C -1)
  3. 将第一步中去掉的最低k个位元位补回位元串尾部 (ExpG = Z个0 + A + D)

0阶指数哥伦布码如下所示:

      Step 1                         Step 2           Step 3 
 0 => B = 0   ,D = None, A = 1    => C = 1 , Z = 0 => 1
 1 => B = 1   ,D = None, A = 10   => C = 2 , Z = 1 => 010
 2 => B = 10  ,D = None ,A = 11   => C = 2 , Z = 1 => 011
 3 => B = 11  ,D = None ,A = 100  => C = 3 , Z = 2 => 00100
 4 => B = 100 ,D = None ,A = 101  => C = 3 , Z = 2 => 00101
 5 => B = 101 ,D = None ,A = 110  => C = 3 , Z = 2 => 00110
 6 => B = 110 ,D = None ,A = 111  => C = 3 , Z = 2 => 00111
 7 => B = 111 ,D = None ,A = 1000 => C = 4 , Z = 3 => 0001000
 8 => B = 1000,D = None ,A = 1001 => C = 4 , Z = 3 => 0001001

以数字9为例, (1)2进制值B 为1001,因为K为0阶,去除0个位元,故D值为空,把B值加1 得到 A,值为 1010, (2)计算A的位元个数,得到C值为4,故减1后得到前导零Z ,值为3 (3)最后组合 Z + A + D之后,得到 000+1010 + 空 ,故Exp-G值为 0001010


1阶指数哥伦布码如下所示:

      Step 1                      Step 2           Step 3
 0 => B = 0   ,D = 0 , A = 1   => C = 1 , Z = 0 => 10
 1 => B = 1   ,D = 1 , A = 1   => C = 1 , Z = 0 => 11
 2 => B = 10  ,D = 0 , A = 10  => C = 2 , Z = 1 => 0100
 3 => B = 11  ,D = 1 , A = 10  => C = 2 , Z = 1 => 0101
 4 => B = 100 ,D = 0 , A = 11  => C = 2 , Z = 1 => 0110
 5 => B = 101 ,D = 1 , A = 11  => C = 2 , Z = 1 => 0111
 6 => B = 110 ,D = 0 , A = 100 => C = 3 , Z = 2 => 001000
 7 => B = 111 ,D = 1 , A = 100 => C = 3 , Z = 2 => 001001
 8 => B = 1000,D = 0 , A = 101 => C = 3 , Z = 2 => 001010