LZMA SDK 9.20(与C相关)

LZMA SDK 9.20是7-Zip压缩项目的组成部分,提供了高压缩率和快速解压的LZMA压缩方法。该SDK包含ANSI-C/C++/C#/Java源码,以及预编译的Windows文件。C文件夹下有各种解码和编码所需的文件,如LzmaDec和LzmaEnc。利用Util文件夹下的LzmaLib可以进行DLL调用。使用LZMA SDK需要将相关头文件和C文件集成到项目中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.概述

lzma是7-Zip压缩项目中7z格式的默认与通用压缩方法,压缩率高,解压速度快,需要的内存小。目录中包括ANSI-C/C++/C#/Java源码,以及用于windows的编译好的文件,以及几个文档:

  • lzma.txt - LZMA SDK描述文件
  • 7zFormat.txt - 7z格式描述文件
  • 7zC.txt - 7z ANSI-C解码描述文件
  • methods.txt - .7z文件的压缩方式
  • lzma.exe - 编译好的文件,用于windows下文件到文件的解压缩
  • 7zr.exe - 编译好的7-Zip,支持7z/lzma/xz等格式
  • history.txt - LZMA SDK的历史版本

2.C文件

C文件夹下:
- 7zCrc*.* - CRC code
- Alloc.* - Memory allocation functions
- Bra*.* - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
- LzFind.* - Match finder for LZ (LZMA) encoders
- LzFindMt.* - Match finder for LZ (LZMA) encoders for multithreading encoding
- LzHash.h - Additional file for LZ match finder
- LzmaDec.* - LZMA decoding
- LzmaEnc.* - LZMA encoding
- LzmaLib.* - LZMA Library for DLL calling
- Types.h - Basic types for another .c files
- Threads.* - The code for multithreading.

Util文件夹下:

  • LzmaLib - LZMA库 (.DLL for Windows)
  • Lzma - LZMA使用方法 (文件到文件的 LZMA encoder/decoder).
  • 7z - 7z ANSI-C 解码器

3.用法

LZMA <e|d> inputFile outputFile [<switches>...]

e: encode file

d: decode file

<Switches>
  -a{N}:  压缩模式 0 = fast, 1 = normal
          default: 1 (normal)

  -d{N}:  字典大小 - [0, 30], default: 23 (8MB)
          字典大小最大值为 1 GB = 2^30 bytes.
          计算方式为 DictionarySize = 2^N bytes. 
          对于用LZMA压缩的文件解压,字典大小为 D = 2^N 就需要 D bytes 内存(RAM)

  -fb{N}: fast bytes 数 - [5, 273], default: 128
          这个数越大,压缩比越大,速度也越慢

  -lc{N}: literal context bits 数 - [0, 8], default: 3
          对于大文件,通常设置 lc=4.

  -lp{N}: literal pos bits 数 - [0, 4], default: 0
          当周期为 2^N 时,预留给周期数据. 
          例如,对于 32-bit (4 bytes),可以设 lp=2. 
          如果这里有变化,通常要设置 lc0.

  -pb{N}: pos bits 数 - [0, 4], default: 2
          当周期为 2^N 时,预留给周期数据.

  -mf{MF_ID}: Match Finder. Default: bt4. 
              hc* 组算法压缩比不好, 但当与fast mode(-a0)结合时速度很快.
              内存需求取决于字典大小(下表中的参数"d"). 
MF_ID Memory Description
bt2 d * 9.5 + 4MB Binary Tree with 2 bytes hashing.
bt3 d * 11.5 + 4MB Binary Tree with 3 bytes hashing.
bt4 d * 11.5 + 4MB Binary Tree with 4 bytes hashing
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值