Further improve LZMA compression parameters to utilize all the 14 levels.
Tweak some Rabin parmeters for better reduction with zlib and Bzip2.
This commit is contained in:
parent
7ff2cb74c4
commit
203008def9
2 changed files with 22 additions and 5 deletions
|
@ -64,26 +64,38 @@ lzma_init(void **data, int *level, ssize_t chunksize)
|
|||
* compression.
|
||||
*/
|
||||
p->dictSize = LZMA_DEFAULT_DICT;
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Let LZMA determine best dict size.
|
||||
*/
|
||||
p->dictSize = 0;
|
||||
}
|
||||
/* Determine the fast bytes value. */
|
||||
|
||||
/* Determine the fast bytes value and also adjust dict size further. */
|
||||
if (*level < 7) {
|
||||
p->fb = 32;
|
||||
|
||||
} else if (*level < 10) {
|
||||
p->fb = 64;
|
||||
|
||||
} else if (*level < 13) {
|
||||
} else if (*level == 11) {
|
||||
p->fb = 64;
|
||||
p->mc = 128;
|
||||
|
||||
} else {
|
||||
} else if (*level == 12) {
|
||||
p->fb = 128;
|
||||
p->mc = 256;
|
||||
|
||||
} else if (*level == 13) {
|
||||
p->fb = 64;
|
||||
p->mc = 128;
|
||||
p->dictSize = (1 << 27);
|
||||
|
||||
} else if (*level == 14) {
|
||||
p->fb = 128;
|
||||
p->mc = 256;
|
||||
p->dictSize = (1 << 28);
|
||||
}
|
||||
if (*level > 9) *level = 9;
|
||||
p->level = *level;
|
||||
|
|
|
@ -120,7 +120,8 @@ create_rabin_context(uint64_t chunksize, uint64_t real_chunksize, const char *al
|
|||
|
||||
if (((memcmp(algo, "lzma", 4) == 0 || memcmp(algo, "adapt", 5) == 0) &&
|
||||
chunksize <= LZMA_WINDOW_MAX) || delta_flag) {
|
||||
if (memcmp(algo, "lzfx", 4) == 0 || memcmp(algo, "lz4", 3) == 0) {
|
||||
if (memcmp(algo, "lzfx", 4) == 0 || memcmp(algo, "lz4", 3) == 0 ||
|
||||
memcmp(algo, "zlib", 4) == 0) {
|
||||
ctx->rabin_poly_min_block_size = RAB_POLYNOMIAL_MIN_BLOCK_SIZE2;
|
||||
ctx->rabin_avg_block_mask = RAB_POLYNOMIAL_AVG_BLOCK_MASK2;
|
||||
ctx->rabin_poly_avg_block_size = RAB_POLYNOMIAL_AVG_BLOCK_SIZE2;
|
||||
|
@ -129,8 +130,12 @@ create_rabin_context(uint64_t chunksize, uint64_t real_chunksize, const char *al
|
|||
ctx->rabin_poly_min_block_size = RAB_POLYNOMIAL_MIN_BLOCK_SIZE;
|
||||
ctx->rabin_avg_block_mask = RAB_POLYNOMIAL_AVG_BLOCK_MASK;
|
||||
ctx->rabin_poly_avg_block_size = RAB_POLYNOMIAL_AVG_BLOCK_SIZE;
|
||||
if (memcmp(algo, "bzip2", 5) == 0) {
|
||||
ctx->rabin_break_patt = 0;
|
||||
} else {
|
||||
ctx->rabin_break_patt = RAB_POLYNOMIAL_CONST;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ctx->rabin_poly_min_block_size = RAB_POLYNOMIAL_MIN_BLOCK_SIZE2;
|
||||
ctx->rabin_avg_block_mask = RAB_POLYNOMIAL_AVG_BLOCK_MASK2;
|
||||
|
|
Loading…
Reference in a new issue