diff options
author | Jia Tan <jiat0218@gmail.com> | 2023-05-09 20:20:06 +0800 |
---|---|---|
committer | Jia Tan <jiat0218@gmail.com> | 2023-05-11 23:54:44 +0800 |
commit | 8f236574986e7c414c0ea059f441982d1387e6a4 (patch) | |
tree | a7f93f05e0905183658a452528c9d4bb9a4ebd81 /src/liblzma/lzma | |
parent | liblzma: Creates IS_ENC_DICT_SIZE_VALID() macro. (diff) | |
download | xz-8f236574986e7c414c0ea059f441982d1387e6a4.tar.xz |
liblzma: Exports lzma_mt_block_size() as an API function.
The lzma_mt_block_size() was previously just an internal function for
the multithreaded .xz encoder. It is used to provide a recommended Block
size for a given filter chain.
This function is helpful to determine the maximum Block size for the
multithreaded .xz encoder when one wants to change the filters between
blocks. Then, this determined Block size can be provided to
lzma_stream_encoder_mt() in the lzma_mt options parameter when
intializing the coder. This requires one to know all the filter chains
they are using before starting to encode (or at least the filter chain
that will need the largest Block size), but that isn't a bad limitation.
Diffstat (limited to 'src/liblzma/lzma')
-rw-r--r-- | src/liblzma/lzma/lzma2_encoder.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liblzma/lzma/lzma2_encoder.c b/src/liblzma/lzma/lzma2_encoder.c index 4b6b2311..5043a07e 100644 --- a/src/liblzma/lzma/lzma2_encoder.c +++ b/src/liblzma/lzma/lzma2_encoder.c @@ -409,6 +409,9 @@ lzma_lzma2_block_size(const void *options) { const lzma_options_lzma *const opt = options; + if (!IS_ENC_DICT_SIZE_VALID(opt->dict_size)) + return UINT64_MAX; + // Use at least 1 MiB to keep compression ratio better. return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20); } |