diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-11 19:16:30 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-11 19:16:30 +0300 |
commit | 5eefc0086d24a65e136352f8c1d19cefb0cbac7a (patch) | |
tree | 2c6a2cf69b82b1775563acaf1fbca3d1de2b8113 /src | |
parent | liblzma: Don't create an empty Block in lzma_stream_buffer_encode(). (diff) | |
download | xz-5eefc0086d24a65e136352f8c1d19cefb0cbac7a.tar.xz |
liblzma: Add an internal function lzma_mt_block_size().
This is based lzma_chunk_size() that was included in some
development version of liblzma.
Diffstat (limited to 'src')
-rw-r--r-- | src/liblzma/common/filter_encoder.c | 46 | ||||
-rw-r--r-- | src/liblzma/common/filter_encoder.h | 4 |
2 files changed, 24 insertions, 26 deletions
diff --git a/src/liblzma/common/filter_encoder.c b/src/liblzma/common/filter_encoder.c index 635d8122..4ba652b7 100644 --- a/src/liblzma/common/filter_encoder.c +++ b/src/liblzma/common/filter_encoder.c @@ -30,11 +30,11 @@ typedef struct { /// invalid, UINT64_MAX is returned. uint64_t (*memusage)(const void *options); - /// Calculates the minimum sane size for Blocks (or other types of - /// chunks) to which the input data can be split to make - /// multithreaded encoding possible. If this is NULL, it is assumed - /// that the encoder is fast enough with single thread. - lzma_vli (*chunk_size)(const void *options); + /// Calculates the recommended Uncompressed Size for .xz Blocks to + /// which the input data can be split to make multithreaded + /// encoding possible. If this is NULL, it is assumed that + /// the encoder is fast enough with single thread. + uint64_t (*block_size)(const void *options); /// Tells the size of the Filter Properties field. If options are /// invalid, UINT32_MAX is returned. If this is NULL, props_size_fixed @@ -59,7 +59,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_LZMA1, .init = &lzma_lzma_encoder_init, .memusage = &lzma_lzma_encoder_memusage, - .chunk_size = NULL, // FIXME + .block_size = NULL, // FIXME .props_size_get = NULL, .props_size_fixed = 5, .props_encode = &lzma_lzma_props_encode, @@ -70,7 +70,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_LZMA2, .init = &lzma_lzma2_encoder_init, .memusage = &lzma_lzma2_encoder_memusage, - .chunk_size = NULL, // FIXME + .block_size = &lzma_lzma2_block_size, // FIXME .props_size_get = NULL, .props_size_fixed = 1, .props_encode = &lzma_lzma2_props_encode, @@ -81,7 +81,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_X86, .init = &lzma_simple_x86_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -91,7 +91,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_POWERPC, .init = &lzma_simple_powerpc_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -101,7 +101,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_IA64, .init = &lzma_simple_ia64_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -111,7 +111,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_ARM, .init = &lzma_simple_arm_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -121,7 +121,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_ARMTHUMB, .init = &lzma_simple_armthumb_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -131,7 +131,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_SPARC, .init = &lzma_simple_sparc_encoder_init, .memusage = NULL, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = &lzma_simple_props_size, .props_encode = &lzma_simple_props_encode, }, @@ -141,7 +141,7 @@ static const lzma_filter_encoder encoders[] = { .id = LZMA_FILTER_DELTA, .init = &lzma_delta_encoder_init, .memusage = &lzma_delta_coder_memusage, - .chunk_size = NULL, + .block_size = NULL, .props_size_get = NULL, .props_size_fixed = 1, .props_encode = &lzma_delta_props_encode, @@ -226,20 +226,19 @@ lzma_raw_encoder_memusage(const lzma_filter *filters) } -/* -extern LZMA_API(lzma_vli) -lzma_chunk_size(const lzma_filter *filters) +extern uint64_t +lzma_mt_block_size(const lzma_filter *filters) { - lzma_vli max = 0; + uint64_t max = 0; for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) { const lzma_filter_encoder *const fe = encoder_find(filters[i].id); - if (fe->chunk_size != NULL) { - const lzma_vli size - = fe->chunk_size(filters[i].options); - if (size == LZMA_VLI_UNKNOWN) - return LZMA_VLI_UNKNOWN; + if (fe->block_size != NULL) { + const uint64_t size + = fe->block_size(filters[i].options); + if (size == 0) + return 0; if (size > max) max = size; @@ -248,7 +247,6 @@ lzma_chunk_size(const lzma_filter *filters) return max; } -*/ extern LZMA_API(lzma_ret) diff --git a/src/liblzma/common/filter_encoder.h b/src/liblzma/common/filter_encoder.h index 5bc137f6..82fb0d9e 100644 --- a/src/liblzma/common/filter_encoder.h +++ b/src/liblzma/common/filter_encoder.h @@ -16,8 +16,8 @@ #include "common.h" -// FIXME: Might become a part of the public API once finished. -// extern lzma_vli lzma_chunk_size(const lzma_filter *filters); +// FIXME: Might become a part of the public API. +extern uint64_t lzma_mt_block_size(const lzma_filter *filters); extern lzma_ret lzma_raw_encoder_init( |