diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-11 21:15:07 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-11 21:15:07 +0300 |
commit | 25fe729532cdf4b8fed56a4519b73cf31efaec50 (patch) | |
tree | 3cc4d203a9b4b2862beabf4547be00fe97557e83 /src/liblzma/lz | |
parent | liblzma: Document lzma_easy_(enc|dec)oder_memusage() better too. (diff) | |
download | xz-25fe729532cdf4b8fed56a4519b73cf31efaec50.tar.xz |
liblzma: Add the forgotten lzma_lzma2_block_size().
This should have been in 5eefc0086d24a65e136352f8c1d19cefb0cbac7a.
Diffstat (limited to '')
-rw-r--r-- | src/liblzma/lzma/lzma2_encoder.c | 10 | ||||
-rw-r--r-- | src/liblzma/lzma/lzma2_encoder.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/liblzma/lzma/lzma2_encoder.c b/src/liblzma/lzma/lzma2_encoder.c index e734bc53..28442c32 100644 --- a/src/liblzma/lzma/lzma2_encoder.c +++ b/src/liblzma/lzma/lzma2_encoder.c @@ -391,3 +391,13 @@ lzma_lzma2_props_encode(const void *options, uint8_t *out) return LZMA_OK; } + + +extern uint64_t +lzma_lzma2_block_size(const void *options) +{ + const lzma_options_lzma *const opt = options; + + // Use at least 1 MiB to keep compression ratio better. + return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20); +} diff --git a/src/liblzma/lzma/lzma2_encoder.h b/src/liblzma/lzma/lzma2_encoder.h index ca19ef46..12881364 100644 --- a/src/liblzma/lzma/lzma2_encoder.h +++ b/src/liblzma/lzma/lzma2_encoder.h @@ -38,4 +38,6 @@ extern uint64_t lzma_lzma2_encoder_memusage(const void *options); extern lzma_ret lzma_lzma2_props_encode(const void *options, uint8_t *out); +extern uint64_t lzma_lzma2_block_size(const void *options); + #endif |