ckolivas / lrzip

Long Range Zip
http://lrzip.kolivas.org
GNU General Public License v2.0
618 stars 76 forks source link

compression level and zpaq #56

Closed shrx closed 8 years ago

shrx commented 8 years ago

The help output suggests that we can choose a compression level with -L # switch when using lzma/bzip2/gzip compression.

Low level options: -L level set lzma/bzip2/gzip compression level (1-9, default 7)

However, -L also affects the compression level when using the ZPAQ compression with -z. ZPAQ's number of compression levels varies with version number [1]. What ZPAQ compression levels do the lrzip's compression levels 1-9 correspond to?

omegadrh commented 8 years ago

The usage info, manpage, README, etc, should probably be updated to include this information, but here's my understanding of the situation as a starting point.

When ZPAQ compression is used, there are actually only three predefined compression models; method 1 and 2 (the "fast" methods) described on the zpaq page apparently aren't available through libzpaq[1]. This leaves us with just methods 3, 4, and 5.

As you noted, the lrzip program requires that the level argument be 1-9; with ZPAQ compression, this gets mapped to libzpaq levels 1-3 in stream.c:184 as compression_level / 4 + 1 (obviously rounded to an integer).

What this ultimately means the 1-9 -L options for lrzip map out accordingly:

lrzip -L libzpaq level zpaq -method equivalent
1 1 3
2 2 4
3 2 4
4 2 4
5 2 4
6 3 5
7 3 5
8 3 5
9 3 5


[1]: From libzpaq.h:457 in the zpaq source code

It does not work with the fast method type arguments to compress() or compressBlock(). Levels 1, 2, and 3 correspond approximately to "3", "4", and "5".

shrx commented 8 years ago

Thanks for your explanation.