PNG文件中的Adler-32校验和 [英] Adler-32 checksum(s) in a PNG file

查看:186
本文介绍了PNG文件中的Adler-32校验和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编写一个C程序,该程序从另一个程序生成的数据文件中构建PNG图像.该图像是调色板类型.

I am currently writing a C program that builds a PNG image from a data file generated by another. The image is a palette type.

Adler-32校验和是针对...的未压缩数据计算的吗?

Is the Adler-32 checksum calculated on the uncompressed data for...

a)IDAT数据块中的每个压缩块?

a) each compressed block within an IDAT data chunk?

b)IDAT数据块中的所有压缩块?

b) all compressed blocks within an IDAT data chunk?

c)跨越所有IDAT数据块的所有压缩块?

c) all compressed blocks spanning all IDAT data chunks?

摘自 http://www.w3.org/TR/PNG/, http://tools.ietf.org/html/rfc1950 和rfc1951(在同一位置我认为上面的情况是'c',允许一个人的deflate实现斩波并更改每个块的数据压缩方式,而不必考虑如何在连续的IDAT块之间拆分压缩的块.

From the documents at http://www.w3.org/TR/PNG/, http://tools.ietf.org/html/rfc1950 and rfc1951 (at the same address as previuos) I am of the opinion that it is case 'c' above, allowing one's deflate implementation to chop and change how the data are compressed for each block and disregard how the compressed blocks are split between consecutive IDAT chunks.

这正确吗?

推荐答案

PNG文件中只能有一个压缩图像数据流,并且是单个zlib流,最后带有一个Adler-32检查,即所有未压缩数据的Adler-32(由过滤器和隔行扫描预处理).该zlib流可能会也可能不会分成多个IDAT块.每个IDAT块都有其自己的CRC-32,它是块类型代码"IDAT"的CRC-32和其中的压缩数据.

There can be only one compressed image data stream in a PNG file, and that is a single zlib stream with a single Adler-32 check at the end that is the Adler-32 of all of the uncompressed data (as pre-processed by the filters and interlacing). That zlib stream may or may not be broken up into multiple IDAT chunks. Each IDAT chunk has its own CRC-32, which is the CRC-32 of the chunk type code "IDAT" and the compressed data within.

我不确定允许一个人的deflate实现斩波并更改每个块的数据压缩方式"是什么意思.有效PNG文件的deflate实现必须将所有过滤后的图像数据压缩为单个zlib流.

I'm not sure what you mean by "allowing one's deflate implementation to chop and change how the data are compressed for each block". The deflate implementation for a valid PNG file must compress all of the filtered image data as a single zlib stream.

将其压缩为单个zlib流后,可以将其分解为一系列IDAT块或单个IDAT块.

After you've compressed it as a single zlib stream, you can break up that stream however you like into a series of IDAT chunks, or as a single IDAT chunk.

这篇关于PNG文件中的Adler-32校验和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆