不同zlib压缩级别的压缩率 [英] Compression ratios for different zlib compression levels

查看:92
本文介绍了不同zlib压缩级别的压缩率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用哪种级别的zlib压缩,并且我对可以在zlib命令中指定的不同压缩级别的不同压缩率感到好奇. zlib手册具有以下用于指定压缩级别的常量:

I am considering what level of zlib compression to use, and I am curious about the different compression rates for the different compression levels that can be specified in zlib commands. The zlib manual has the following constants for specifying the compression level:

#define Z_NO_COMPRESSION         0
#define Z_BEST_SPEED             1
#define Z_BEST_COMPRESSION       9
#define Z_DEFAULT_COMPRESSION  (-1)

很明显,数字越小表示压缩和放气的延迟时间越短,但代价是压缩文件较少,而数字越大,则压缩效果越好,但代价是等待时间越长.

Clearly, a lower the number means lower latency for compression and deflation at the cost of a less-compressed file, while a higher number favors better compression at the cost of higher latency.

我的问题是,对于不同的压缩级别,可以预期什么压缩率??这

My question is, what compression ratios can be expected for the different compression levels? This zlib web page says, More typical zlib compression ratios are on the order of 2:1 to 5:1 in the context of maximum compression, but are there also compression ratios / ranges for the other compression factors as well?

推荐答案

您的问题没有与数据无关的答案.您不能仅根据各自的压缩级别来预测压缩率,也不能预测压缩率的比率.这些级别反映了压缩器在前32K数据中寻找匹配字符串的努力程度.就是这样.

There is no answer for your question that is independent of the data. You can predict neither compression ratios, nor ratios of compression ratios just from the respective compression levels. The levels reflect how hard the compressor looks for matching strings in the previous 32K of data. That's all.

这篇关于不同zlib压缩级别的压缩率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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