有限宇宙中的行程长度编码
Run-Length Encoding in a Finite Universe
摘要:
文本压缩方案和紧凑数据结构通常将复杂的概率模型与基本编码方法相结合,其平均码字长度与已知分布的熵紧密匹配。在基本编码表示具有概率$p$(即几何分布$\Pr(i)=p^i(1-p)$)的结果的游程长度的常见情况下,\emph{Golomb code}是最佳瞬时码,其具有额外的优点,即可以仅使用从$p$计算的整数参数来计算码字,而不需要大的或复杂的数据结构。然而,Golomb编码不能优雅地处理游程长度由已知整数~ $n$限制的情况。在这种情况下,为情况$i>n$分配的码字被浪费。虽然对于大的$n$可以忽略,但是这使得Golomb编码在$n$递归地小的情况下没有吸引力,例如,当表示从有限范围中抽取的整数的许多短列表时,或者当通过递归算法缩小$n$的范围时。我们解决的问题,选择一个代码的情况下,从信息理论和计算的角度考虑效率,并在一个简单的代码,允许计算一个码字只使用$O(1)$简单的计算机操作和$O(1)$机器字。我们的实验表明,所得到的表示长度是非常接近(在大多数测试情况下相等)的最佳霍夫曼码,在某种程度上,预期的差异几乎可以忽略不计。我们描述了有效的分支无实现的编码和解码。
英文摘要:
Text compression schemes and compact data structures usually combine sophisticated probability models with basic coding methods whose average codeword length closely match the entropy of known distributions. In the frequent case where basic coding represents run-lengths of outcomes that have probability $p$, i.e. the geometric distribution $\Pr(i)=p^i(1-p)$, a \emph{Golomb code} is an optimal instantaneous code, which has the additional advantage that codewords can be computed using only an integer parameter calculated from $p$, without need for a large or sophisticated data structure. Golomb coding does not, however, gracefully handle the case where run-lengths are bounded by a known integer~$n$. In this case, codewords allocated for the case $i>n$ are wasted. While negligible for large $n$, this makes Golomb coding unattractive in situations where $n$ is recurrently small, e.g., when representing many short lists of integers drawn from limited ranges, or when the range of $n$ is narrowed down by a recursive algorithm. We address the problem of choosing a code for this case, considering efficiency from both information-theoretic and computational perspectives, and arrive at a simple code that allows computing a codeword using only $O(1)$ simple computer operations and $O(1)$ machine words. We demonstrate experimentally that the resulting representation length is very close (equal in a majority of tested cases) to the optimal Huffman code, to the extent that the expected difference is practically negligible. We describe efficient branch-free implementation of encoding and decoding.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。