1 ///////////////////////////////////////////////////////////////////////////////
4 /// \brief Finds out the minimal reasonable chunk size for a filter chain
6 // Author: Lasse Collin
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
11 ///////////////////////////////////////////////////////////////////////////////
17 * \brief Finds out the minimal reasonable chunk size for a filter chain
19 * This function helps determining the Uncompressed Sizes of the Blocks when
20 * doing multi-threaded encoding.
22 * When compressing a large file on a system having multiple CPUs or CPU
23 * cores, the file can be split into smaller chunks, that are compressed
24 * independently into separate Blocks in the same .lzma Stream.
26 * \return Minimum reasonable Uncompressed Size of a Block. The
27 * recommended minimum Uncompressed Size is between this value
28 * and the value times two.
30 Zero if the Uncompressed Sizes of Blocks don't matter
32 extern LZMA_API(size_t)
33 lzma_chunk_size(const lzma_options_filter *filters)
35 while (filters->id != LZMA_VLI_UNKNOWN) {
36 switch (filters->id) {
37 // TODO LZMA_FILTER_SPARSE
39 case LZMA_FILTER_COPY:
40 case LZMA_FILTER_SUBBLOCK:
42 case LZMA_FILTER_POWERPC:
43 case LZMA_FILTER_IA64:
45 case LZMA_FILTER_ARMTHUMB:
46 case LZMA_FILTER_SPARC:
47 // These are very fast, thus there is no point in
48 // splitting the data into smaller blocks.
51 case LZMA_FILTER_LZMA1:
52 // The block sizes of the possible next filters in
53 // the chain are irrelevant after the LZMA filter.
54 return ((lzma_options_lzma *)(filters->options))
65 // Indicate that splitting would be useless.