Improve LZMA compression parameters at extreme levels.
Fix incorrect thread calculation. Remove some cruft.
This commit is contained in:
parent
00d74e86c5
commit
db0c9ea9ac
3 changed files with 13 additions and 7 deletions
|
@ -31,8 +31,6 @@
|
|||
#include <allocator.h>
|
||||
|
||||
#define SZ_ERROR_DESTLEN 100
|
||||
#define LZMA_MAX_DICT (1 << 30)
|
||||
#define LZMA_DICT_THRESH (1 << 29)
|
||||
#define LZMA_DEFAULT_DICT (1 << 24)
|
||||
|
||||
CLzmaEncProps *p = NULL;
|
||||
|
@ -73,12 +71,20 @@ lzma_init(void **data, int *level, ssize_t chunksize)
|
|||
p->dictSize = 0;
|
||||
}
|
||||
/* Determine the fast bytes value. */
|
||||
if (*level < 7)
|
||||
if (*level < 7) {
|
||||
p->fb = 32;
|
||||
else if (*level < 10)
|
||||
|
||||
} else if (*level < 10) {
|
||||
p->fb = 64;
|
||||
else
|
||||
|
||||
} else if (*level < 13) {
|
||||
p->fb = 64;
|
||||
p->mc = 128;
|
||||
|
||||
} else {
|
||||
p->fb = 128;
|
||||
p->mc = 256;
|
||||
}
|
||||
p->level = *level;
|
||||
LzmaEncProps_Normalize(p);
|
||||
slab_cache_add(p->litprob_sz);
|
||||
|
|
2
main.c
2
main.c
|
@ -819,7 +819,7 @@ start_compress(const char *filename, uint64_t chunksize, int level)
|
|||
chunksize = sbuf.st_size;
|
||||
nthreads = 1;
|
||||
} else {
|
||||
if (nthreads > sbuf.st_size / chunksize) {
|
||||
if (nthreads == 0 || nthreads > sbuf.st_size / chunksize) {
|
||||
nthreads = sbuf.st_size / chunksize;
|
||||
if (sbuf.st_size % chunksize)
|
||||
nthreads++;
|
||||
|
|
|
@ -92,7 +92,7 @@ rabin_context_t *
|
|||
create_rabin_context(uint64_t chunksize, uint64_t real_chunksize, const char *algo) {
|
||||
rabin_context_t *ctx;
|
||||
unsigned char *current_window_data;
|
||||
uint32_t blknum, index;
|
||||
uint32_t blknum;
|
||||
int level = 14;
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue