Default compression level and window size on lzma is set to 7 which is the highest it goes.

Scale the 9 levels down to the 7 that lzma has.
This makes the default lzma compression level 5 which is what lzma normally has, and uses a lot less ram and is significantly faster than previously, but at the cost of giving slightly less compression.
This commit is contained in:
Con Kolivas 2010-12-08 20:53:26 +11:00
parent 13e443e23c
commit e0265b33e1

View file

@ -281,10 +281,11 @@ static void lzma_compress_buf(struct compress_thread *cthread)
* and receive properties in control->lzma_properties */
lzma_ret = LzmaCompress(c_buf, &dlen, cthread->s_buf,
(size_t)cthread->s_len, control.lzma_properties, &prop_size, control.compression_level,
0, /* dict size. set default */
-1, -1, -1, -1, /* lc, lp, pb, fb */
control.threads);
(size_t)cthread->s_len, control.lzma_properties, &prop_size,
control.compression_level * 7 / 9 ? : 1, /* only 7 levels with lzma, scale them */
0, /* dict size. set default, choose by level */
-1, -1, -1, -1, /* lc, lp, pb, fb */
control.threads);
if (lzma_ret != SZ_OK) {
switch (lzma_ret) {
case SZ_ERROR_MEM: