jpeg - 处理填充/填充位熵编码的 JPEG

标签 jpeg huffman-code

decoding entropy encoded DC values in JPEG (或 entropy encoded prediction differences in lossless JPEG ),如何区分已填充以填充标记前字节的 1 位和霍夫曼编码值?

例如,如果我看到:

0xAF 0xFF 0xD9

并且我已经使用了 [0xA] 中的位,我如何判断下一个 0xF 是被填充还是应该被解码?

这是来自 JPEG 规范:

F.1.2.3 Byte stuffing

In order to provide code space for marker codes which can be located in the compressed image data without decoding, byte stuffing is used.

Whenever, in the course of normal encoding, the byte value X’FF’ is created in the code string, a X’00’ byte is stuffed into the code string. If a X’00’ byte is detected after a X’FF’ byte, the decoder must discard it. If the byte is not zero, a marker has been detected, and shall be interpreted to the extent needed to complete the decoding of the scan.

Byte alignment of markers is achieved by padding incomplete bytes with 1-bits. If padding with 1-bits creates a X’FF’ value, a zero byte is stuffed before adding the marker.

最佳答案

压缩数据流中FF值只有两种可能。

  1. 重新启动标记;或
  2. FF00代表FF。

如果您正在解码流,您将从重启间隔知道何时需要重启标记。当您到达解码中应该找到重新开始标记的位置时,您将丢弃当前字节中的剩余位。

关于jpeg - 处理填充/填充位熵编码的 JPEG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27949420/

相关文章:

php - 使用 PHP 从办公文件(.doc .ppt 等)生成 JPG

algorithm - 构建哈夫曼树时如何选择优先级?

java - 哈夫曼编码完成后如何用Java写入文件

haskell - 解码霍夫曼树时出现非详尽模式错误?

Java 图像质量 (JPEG)

video - 如何在ffmpeg中为从静态图像生成的视频设置帧速率

python - 在 Python (PIL) 中确定 JPG 质量

python - 将 ASCII 二进制序列写入二进制 python

algorithm - 哈夫曼算法中的二进制前缀码

c# - 将 postscript 转换为 jpeg