For faster navigation, this Iframe is preloading the Wikiwand page for 格伦布编码.

格伦布编码

本条目存在以下问题,请协助改善本条目或在讨论页针对议题发表看法。 此条目已列出参考文献,但因为没有文内引注而使来源仍然不明。 (2014年6月27日)请加上合适的文内引注来改善这篇条目。 此条目需要编修,以确保文法、用词、语气格式标点等使用恰当。 (2014年6月27日)请按照校对指引,帮助编辑这个条目。(帮助讨论) 此条目缺少有关应用的信息。 (2022年12月27日)请扩充此条目相关信息。讨论页可能有详细细节。

格伦布编码(英语:Golomb coding)是一种无失真资料压缩方法,由数学家所罗门·格伦布在1960年代提出。其优点为易于编码与解码,另外对于拥有几率分布为几何分布的资料,格伦布编码是最佳的前缀码,且能无限逼近该资料的,目前广泛用于无损影像压缩

编码的建立

令输入值为正整数,参数值为正整数 ,输出值格伦布码为 ,其中 由两种编码组合而成,

一进制编码,截断二进制编码

计算

一进制编码,截断二进制编码即可得到

格伦布-莱斯编码中的商数指示了所在区块,而指示所在区块内部的位置。如上图,对整数 做格伦布-莱斯编码, 代表区块、 表示区块内部位置、 为参数,每个区块的大小皆相等且长度为 ,特别注意当编码方式为格伦布-莱斯编码时,即 的整数次方,所有编码长度相等。

参数 伯努利过程的函数,其中伯努利过程的参数 定义为 ,则 的所在区间为此伯努利过程中位数-1到中位数+1之间。如下式:

足够大时,我们可以将其表示成,

使用符号整数

格伦布编码主要是针对非负整数进行编码,但也可以使用重叠(Overlap)与交错(Interleave)扩展至对所有整数进行编码。令一串用于编号的数列,(0,1,2,...),给予非负整数偶数编号,给予负整数奇数编号,使得排列方式如下,(0,-1,1,-2,2,...),即非负整数 映射,负整数 映射

莱斯编码

莱斯编码(Rice coding,由Robert F. Rice所提出),为一种前缀码,归属于格伦布编码的子集合,参数 的整数次方,即 。此种特例未必是所有格伦布编码中的最佳编码方式,但由于目前电脑为二进制运算,莱斯编码能快速且有效地以二进制运算实现。

性质

范氏霍夫曼编码

格伦布编码为一种范氏霍夫曼编码

算法

  1. 选择参数
  2. 待编码数值为 ,计算:
    1. 商数:
    2. 余数:
  3. 编码
    1. 商数编码,对 进行一进制编码,得到
    2. 余数编码,对 进行截断二进制编码,得到
    3. 合并,
  4. 输出

范例

M = 10。则 .

商数编码
q 输出位元
0 0
1 10
2 110
3 1110
4 11110
5 111110
6 1111110
N
余数编码
r 偏移 二进制 输出位元
0 0 0000 000
1 1 0001 001
2 2 0010 010
3 3 0011 011
4 4 0100 100
5 5 0101 101
6 12 1100 1100
7 13 1101 1101
8 14 1110 1110
9 15 1111 1111

选择42作为编码时,42会被拆成 ,编码为11110010,而商数编码尾数必为0,能标示商数编码位元的结束。

参考来源


{{bottomLinkPreText}} {{bottomLinkText}}
格伦布编码
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?