lzma 知識點滴
LZMA(Lempel-Ziv-Markov chain-Algorithm的縮寫)是2001年以來得到發展的一個資料壓縮演算法,它用於7-Zip歸檔工具中的7z格式。它使用類似於LZ77的字典編碼機制,在一般的情況下壓縮率比bzip2高,用於壓縮的字典檔案大小可達4GB。
對比集中壓縮:
耗用時間 bzip >lzma2>lzma>gzip
壓縮率 lzma2>bzip>gzip>lzma
最後壓縮結果是 lzma的檔案最小 ,果然改進版的演算法有優勢。
這裡要看一下lzma的檔案頭資訊
看的方法可以直接用二進位制工具開啟.lzma檔案 ,更方便的方法是ubuntu中已經整合了lzma的檢視工具 ,利用命令列
lzmainfo XXX.lzma
就可以看到檔案頭資訊了:
a.lzma
Uncompressed size: 0 MB (20644 bytes)
Dictionary size: 8 MB (2^23 bytes)
Literal context bits (lc): 3
Literal pos bits (lp): 0
Number of pos bits (pb): 2
這裡就看到了檔案頭列印出來的資訊 ,在對比一下檔案的二進位制資訊
00h:5d 00 00 80 00 22 01 00 00 00 00 00 00 00 26 16
10h:85 bc .....
主要就是簽名這一段,這裡摘錄一段lzma的specification
The lzma file format layout:
Offset Size Description
0 1 LZMA model properties (lc, lp, pb) in encoded form
1 4 Dictionary size (32-bit unsigned integer, little-endian)
5 8 Uncompressed size (64-bit unsigned integer, little-endian)
13 Compressed data (LZMA stream)
LZMA properties:
name Range Description
lc [0, 8] the number of "literal context" bits
lp [0, 4] the number of "literal pos" bits
pb [0, 4] the number of "pos" bits
dictSize [0, 2^32 - 1] the dictionary size
這裡就是介紹清楚了,其他不封都應該能看懂,例如8M的Dictionary size 就在1-5這四個位元組 00 00 80 00
有一個lc lp pb 這個要說明一下,
p->lc = d % 9;
d /= 9;
p->pb = d / 5;
p->lp = d % 5;
這裡可以看出 在第一個位元組也就是5D裡面包含的資訊 lc pb lp 是以十進位制方式存放的 ,有興趣自己算一算就能明白了
相關文章
- 物化檢視知識點滴
- mysql--平日點滴知識隨筆(待續)MySql
- asm點滴ASM
- oracle點滴Oracle
- 知識點
- mailx使用點滴AI
- linux知識知識點總結Linux
- Promise知識點Promise
- 面試知識點面試
- Laravel 知識點Laravel
- 通用知識點
- 前端知識點前端
- ajax知識點
- rabbitmq 知識點MQ
- Redis知識點Redis
- SQL知識點(+)SQL
- JavaWeb知識點JavaWeb
- MySQL知識點MySql
- 知識點——terms
- Weex 知識點
- mybatis知識點MyBatis
- SASS知識點
- git 知識點Git
- KVO知識點
- iOS 知識點iOS
- Web知識點Web
- mongoDB知識點MongoDB
- qc知識點
- ASM知識點ASM
- JS知識點:ES6 中常見的知識點JS
- 工作點滴積累
- 前端點滴記錄前端
- 專題:點滴JavascriptJavaScript
- hp-ux點滴UX
- 浮點數小知識點
- 技能 |【點滴知識】 Linux平臺(bash) 檢視/設定/刪除 環境變數的方法。Linux變數
- Promise重要知識點Promise
- MongoDB知識要點MongoDB