Small changes to control->threads and memory overhead for LZMA.

This commit is contained in:
Peter Hyman 2019-11-25 07:31:29 -06:00
parent 02a7bdc6c4
commit 1e16f7bd02
2 changed files with 5 additions and 2 deletions

View file

@ -325,7 +325,8 @@ retry:
lzma_level, lzma_level,
0, /* dict size. set default, choose by level */ 0, /* dict size. set default, choose by level */
-1, -1, -1, -1, /* lc, lp, pb, fb */ -1, -1, -1, -1, /* lc, lp, pb, fb */
control->threads); control->threads > 1 ? 2: 1);
/* LZMA spec has threads = 1 or 2 only. */
if (lzma_ret != SZ_OK) { if (lzma_ret != SZ_OK) {
switch (lzma_ret) { switch (lzma_ret) {
case SZ_ERROR_MEM: case SZ_ERROR_MEM:

4
util.c
View file

@ -117,7 +117,9 @@ void setup_overhead(rzip_control *control)
i64 dictsize = (level <= 5 ? (1 << (level * 2 + 14)) : i64 dictsize = (level <= 5 ? (1 << (level * 2 + 14)) :
(level == 6 ? (1 << 25) : (1 << 26))); (level == 6 ? (1 << 25) : (1 << 26)));
control->overhead = (dictsize * 23 / 2) + (4 * 1024 * 1024); control->overhead = (dictsize * 23 / 2) + (6 * 1024 * 1024) + 16384;
/* LZMA spec shows memory requirements as 6MB, not 4MB and state size
* where default is 16KB */
} else if (ZPAQ_COMPRESS) } else if (ZPAQ_COMPRESS)
control->overhead = 112 * 1024 * 1024; control->overhead = 112 * 1024 * 1024;
} }