![]() |
Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
|
Go to the source code of this file.
Data Structures | |
struct | lzma_mt |
Multithreading options. More... | |
Macros | |
#define | LZMA_PRESET_DEFAULT UINT32_C(6) |
Default compression preset. | |
#define | LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F) |
Mask for preset level. | |
#define | LZMA_PRESET_EXTREME (UINT32_C(1) << 31) |
Extreme compression preset. | |
#define | LZMA_TELL_NO_CHECK UINT32_C(0x01) |
#define | LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02) |
#define | LZMA_TELL_ANY_CHECK UINT32_C(0x04) |
#define | LZMA_IGNORE_CHECK UINT32_C(0x10) |
#define | LZMA_CONCATENATED UINT32_C(0x08) |
#define | LZMA_FAIL_FAST UINT32_C(0x20) |
Functions | |
LZMA_API (uint64_t) lzma_easy_encoder_memusage(uint32_t preset) lzma_nothrow lzma_attr_pure | |
Calculate approximate memory usage of easy encoder. | |
LZMA_API (lzma_ret) lzma_easy_encoder(lzma_stream *strm | |
Initialize .xz Stream encoder using a preset number. | |
LZMA_API (size_t) lzma_stream_buffer_bound(size_t uncompressed_size) lzma_nothrow | |
Calculate output buffer size for single-call Stream encoder. | |
Variables | |
uint32_t | preset |
uint32_t lzma_check check lzma_nothrow | lzma_attr_warn_unused_result |
lzma_check | check |
lzma_check const lzma_allocator * | allocator |
lzma_check const lzma_allocator const uint8_t * | in |
lzma_check const lzma_allocator const uint8_t size_t | in_size |
lzma_check const lzma_allocator const uint8_t size_t uint8_t * | out |
lzma_check const lzma_allocator const uint8_t size_t uint8_t size_t * | out_pos |
lzma_check const lzma_allocator const uint8_t size_t uint8_t size_t size_t out_size | lzma_nothrow |
const lzma_filter * | filters |
uint64_t | memlimit |
uint32_t | flags |
uint32_t const lzma_allocator const uint8_t size_t * | in_pos |
uint64_t | comp_size |
uint64_t uint64_t | uncomp_size |
uint64_t uint64_t lzma_bool | uncomp_size_is_exact |
#define LZMA_CONCATENATED UINT32_C(0x08) |
This flag enables decoding of concatenated files with file formats that allow concatenating compressed files as is. From the formats currently supported by liblzma, only the .xz and .lz formats allow concatenated files. Concatenated files are not allowed with the legacy .lzma format.
This flag also affects the usage of the 'action' argument for lzma_code(). When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END unless LZMA_FINISH is used as 'action'. Thus, the application has to set LZMA_FINISH in the same way as it does when encoding.
If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH as 'action' for lzma_code(), but the usage of LZMA_FINISH isn't required.
#define LZMA_FAIL_FAST UINT32_C(0x20) |
This flag makes the threaded decoder report errors (like LZMA_DATA_ERROR) as soon as they are detected. This saves time when the application has no interest in a partially decompressed truncated or corrupt file. Note that due to timing randomness, if the same truncated or corrupt input is decompressed multiple times with this flag, a different amount of output may be produced by different runs, and even the error code might vary.
When using LZMA_FAIL_FAST, it is recommended to use LZMA_FINISH to tell the decoder when no more input will be coming because it can help fast detection and reporting of truncated files. Note that in this situation truncated files might be diagnosed with LZMA_DATA_ERROR instead of LZMA_OK or LZMA_BUF_ERROR!
Without this flag the threaded decoder will provide as much output as possible at first and then report the pending error. This default behavior matches the single-threaded decoder and provides repeatable behavior with truncated or corrupt input. There are a few special cases where the behavior can still differ like memory allocation failures (LZMA_MEM_ERROR).
Single-threaded decoders currently ignore this flag.
Support for this flag was added in liblzma 5.3.3alpha. Note that in older versions this flag isn't supported (LZMA_OPTIONS_ERROR) even by functions that ignore this flag in newer liblzma versions.
#define LZMA_IGNORE_CHECK UINT32_C(0x10) |
This flag makes lzma_code() not calculate and verify the integrity check of the compressed data in .xz files. This means that invalid integrity check values won't be detected and LZMA_DATA_ERROR won't be returned in such cases.
This flag only affects the checks of the compressed data itself; the CRC32 values in the .xz headers will still be verified normally.
Don't use this flag unless you know what you are doing. Possible reasons to use this flag:
Support for this flag was added in liblzma 5.1.4beta.
#define LZMA_PRESET_DEFAULT UINT32_C(6) |
Default compression preset.
It's not straightforward to recommend a default preset, because in some cases keeping the resource usage relatively low is more important that getting the maximum compression ratio.
#define LZMA_PRESET_EXTREME (UINT32_C(1) << 31) |
Extreme compression preset.
This flag modifies the preset to make the encoding significantly slower while improving the compression ratio only marginally. This is useful when you don't mind spending time to get as small result as possible.
This flag doesn't affect the memory usage requirements of the decoder (at least not significantly). The memory usage of the encoder may be increased a little but only at the lowest preset levels (0-3).
#define LZMA_PRESET_LEVEL_MASK UINT32_C(0x1F) |
Mask for preset level.
This is useful only if you need to extract the level from the preset variable. That should be rare.
#define LZMA_TELL_ANY_CHECK UINT32_C(0x04) |
This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type of the integrity check is known. The type can then be got with lzma_get_check().
#define LZMA_TELL_NO_CHECK UINT32_C(0x01) |
This flag makes lzma_code() return LZMA_NO_CHECK if the input stream being decoded has no integrity check. Note that when used with lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK if LZMA_TELL_NO_CHECK is used.
#define LZMA_TELL_UNSUPPORTED_CHECK UINT32_C(0x02) |
This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input stream has an integrity check, but the type of the integrity check is not supported by this liblzma version or build. Such files can still be decoded, but the integrity check cannot be verified.
|
extern |
Initialize .xz Stream encoder using a preset number.
MicroLZMA decoder.
Single-call .xz Stream decoder.
Initialize .lz (lzip) decoder (a foreign file format)
Initialize .lzma decoder (legacy file format)
Decode .xz, .lzma, and .lz (lzip) files with autodetection.
Initialize multithreaded .xz Stream decoder.
Initialize .xz Stream decoder.
MicroLZMA encoder.
Single-call .xz Stream encoder.
Initialize .lzma encoder (legacy file format)
Initialize multithreaded .xz Stream encoder.
Initialize .xz Stream encoder using a custom filter chain.
Single-call .xz Stream encoding using a preset number.
This function is intended for those who just want to use the basic features of liblzma (that is, most developers out there).
If initialization fails (return value is not LZMA_OK), all the memory allocated for *strm by liblzma is always freed. Thus, there is no need to call lzma_end() after failed initialization.
If initialization succeeds, use lzma_code() to do the actual encoding. Valid values for 'action' (the second argument of lzma_code()) are LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future, there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
preset | Compression preset to use. A preset consist of level number and zero or more flags. Usually flags aren't used, so preset is simply a number [0, 9] which match the options -0 ... -9 of the xz command line tool. Additional flags can be be set using bitwise-or with the preset level number, e.g. 6 | LZMA_PRESET_EXTREME. |
check | Integrity check type to use. See check.h for available checks. The xz command line tool defaults to LZMA_CHECK_CRC64, which is a good choice if you are unsure. LZMA_CHECK_CRC32 is good too as long as the uncompressed file is not many gigabytes. |
The maximum required output buffer size can be calculated with lzma_stream_buffer_bound().
preset | Compression preset to use. See the description in lzma_easy_encoder(). | |
check | Type of the integrity check to calculate from uncompressed data. | |
allocator | lzma_allocator for custom allocator functions. Set to NULL to use malloc() and free(). | |
in | Beginning of the input buffer | |
in_size | Size of the input buffer | |
[out] | out | Beginning of the output buffer |
[out] | out_pos | The next byte will be written to out[*out_pos]. *out_pos is updated only if encoding succeeds. |
out_size | Size of the out buffer; the first byte into which no data is written to is out[out_size]. |
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
filters | Array of filters terminated with .id == LZMA_VLI_UNKNOWN. See filters.h for more information. |
check | Type of the integrity check to calculate from uncompressed data. |
This provides the functionality of lzma_easy_encoder() and lzma_stream_encoder() as a single function for multithreaded use.
The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be added in the future.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
options | Pointer to multithreaded compression options |
The .lzma format is sometimes called the LZMA_Alone format, which is the reason for the name of this function. The .lzma format supports only the LZMA1 filter. There is no support for integrity checks like CRC32.
Use this function if and only if you need to create files readable by legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format is strongly recommended.
The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH. No kind of flushing is supported, because the file format doesn't make it possible.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
options | Pointer to encoder options |
filters | Array of filters terminated with .id == LZMA_VLI_UNKNOWN. See filters.h for more information. | |
check | Type of the integrity check to calculate from uncompressed data. | |
allocator | lzma_allocator for custom allocator functions. Set to NULL to use malloc() and free(). | |
in | Beginning of the input buffer | |
in_size | Size of the input buffer | |
[out] | out | Beginning of the output buffer |
[out] | out_pos | The next byte will be written to out[*out_pos]. *out_pos is updated only if encoding succeeds. |
out_size | Size of the out buffer; the first byte into which no data is written to is out[out_size]. |
The MicroLZMA format is a raw LZMA stream whose first byte (always 0x00) has been replaced with bitwise-negation of the LZMA properties (lc/lp/pb). This encoding ensures that the first byte of MicroLZMA stream is never 0x00. There is no end of payload marker and thus the uncompressed size must be stored separately. For the best error detection the dictionary size should be stored separately as well but alternatively one may use the uncompressed size as the dictionary size when decoding.
With the MicroLZMA encoder, lzma_code() behaves slightly unusually. The action argument must be LZMA_FINISH and the return value will never be LZMA_OK. Thus the encoding is always done with a single lzma_code() after the initialization. The benefit of the combination of initialization function and lzma_code() is that memory allocations can be re-used for better performance.
lzma_code() will try to encode as much input as is possible to fit into the given output buffer. If not all input can be encoded, the stream will be finished without encoding all the input. The caller must check both input and output buffer usage after lzma_code() (total_in and total_out in lzma_stream can be convenient). Often lzma_code() can fill the output buffer completely if there is a lot of input, but sometimes a few bytes may remain unused because the next LZMA symbol would require more space.
lzma_stream.avail_out must be at least 6. Otherwise LZMA_PROG_ERROR will be returned.
The LZMA dictionary should be reasonably low to speed up the encoder re-initialization. A good value is bigger than the resulting uncompressed size of most of the output chunks. For example, if output size is 4 KiB, dictionary size of 32 KiB or 64 KiB is good. If the data compresses extremely well, even 128 KiB may be useful.
The MicroLZMA format and this encoder variant were made with the EROFS file system in mind. This format may be convenient in other embedded uses too where many small streams are needed. XZ Embedded includes a decoder for this format.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
options | Pointer to encoder options |
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
memlimit | Memory usage limit as bytes. Use UINT64_MAX to effectively disable the limiter. liblzma 5.2.3 and earlier don't allow 0 here and return LZMA_PROG_ERROR; later versions treat 0 as if 1 had been specified. |
flags | Bitwise-or of zero or more of the decoder flags: LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, LZMA_CONCATENATED, LZMA_FAIL_FAST |
The decoder can decode multiple Blocks in parallel. This requires that each Block Header contains the Compressed Size and Uncompressed size fields which are added by the multi-threaded encoder, see lzma_stream_encoder_mt().
A Stream with one Block will only utilize one thread. A Stream with multiple Blocks but without size information in Block Headers will be processed in single-threaded mode in the same way as done by lzma_stream_decoder(). Concatenated Streams are processed one Stream at a time; no inter-Stream parallelization is done.
This function behaves like lzma_stream_decoder() when options->threads == 1 and options->memlimit_threading <= 1.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
options | Pointer to multithreaded compression options |
This decoder autodetects between the .xz, .lzma, and .lz file formats, and calls lzma_stream_decoder(), lzma_alone_decoder(), or lzma_lzip_decoder() once the type of the input file has been detected.
Support for .lz was added in 5.4.0.
If the flag LZMA_CONCATENATED is used and the input is a .lzma file: For historical reasons concatenated .lzma files aren't supported. If there is trailing data after one .lzma stream, lzma_code() will return LZMA_DATA_ERROR. (lzma_alone_decoder() doesn't have such a check as it doesn't support any decoder flags. It will return LZMA_STREAM_END after one .lzma stream.)
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
memlimit | Memory usage limit as bytes. Use UINT64_MAX to effectively disable the limiter. liblzma 5.2.3 and earlier don't allow 0 here and return LZMA_PROG_ERROR; later versions treat 0 as if 1 had been specified. |
flags | Bitwise-or of zero or more of the decoder flags: LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, LZMA_TELL_ANY_CHECK, LZMA_IGNORE_CHECK, LZMA_CONCATENATED, LZMA_FAIL_FAST |
Valid 'action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH. There is no need to use LZMA_FINISH, but it's allowed because it may simplify certain types of applications.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
memlimit | Memory usage limit as bytes. Use UINT64_MAX to effectively disable the limiter. liblzma 5.2.3 and earlier don't allow 0 here and return LZMA_PROG_ERROR; later versions treat 0 as if 1 had been specified. |
This decoder supports the .lz format version 0 and the unextended .lz format version 1:
Just like with lzma_stream_decoder() for .xz files, LZMA_CONCATENATED should be used when decompressing normal standalone .lz files.
The .lz format allows putting non-.lz data at the end of a file after at least one valid .lz member. That is, one can append custom data at the end of a .lz file and the decoder is required to ignore it. In liblzma this is relevant only when LZMA_CONCATENATED is used. In that case lzma_code() will return LZMA_STREAM_END and leave lzma_stream.next_in pointing to the first byte of the non-.lz data. An exception to this is if the first 1-3 bytes of the non-.lz data are identical to the .lz magic bytes (0x4C, 0x5A, 0x49, 0x50; "LZIP" in US-ASCII). In such a case the 1-3 bytes will have been ignored by lzma_code(). If one wishes to locate the non-.lz data reliably, one must ensure that the first byte isn't 0x4C. Actually one should ensure that none of the first four bytes of trailing data are equal to the magic bytes because lzip >= 1.20 requires it by default.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
memlimit | Memory usage limit as bytes. Use UINT64_MAX to effectively disable the limiter. |
flags | Bitwise-or of flags, or zero for no flags. All decoder flags listed above are supported although only LZMA_CONCATENATED and (in very rare cases) LZMA_IGNORE_CHECK are actually useful. LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_FAIL_FAST do nothing. LZMA_TELL_ANY_CHECK is supported for consistency only as CRC32 is always used in the .lz format. |
memlimit | Pointer to how much memory the decoder is allowed to allocate. The value pointed by this pointer is modified if and only if LZMA_MEMLIMIT_ERROR is returned. | |
flags | Bitwise-or of zero or more of the decoder flags: LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK, LZMA_IGNORE_CHECK, LZMA_CONCATENATED, LZMA_FAIL_FAST. Note that LZMA_TELL_ANY_CHECK is not allowed and will return LZMA_PROG_ERROR. | |
allocator | lzma_allocator for custom allocator functions. Set to NULL to use malloc() and free(). | |
in | Beginning of the input buffer | |
in_pos | The next byte will be read from in[*in_pos]. *in_pos is updated only if decoding succeeds. | |
in_size | Size of the input buffer; the first byte that won't be read is in[in_size]. | |
[out] | out | Beginning of the output buffer |
[out] | out_pos | The next byte will be written to out[*out_pos]. *out_pos is updated only if decoding succeeds. |
out_size | Size of the out buffer; the first byte into which no data is written to is out[out_size]. |
See lzma_microlzma_encoder() for more information.
The lzma_code() usage with this decoder is completely normal. The special behavior of lzma_code() applies to lzma_microlzma_encoder() only.
strm | Pointer to lzma_stream that is at least initialized with LZMA_STREAM_INIT. |
comp_size | Compressed size of the MicroLZMA stream. The caller must somehow know this exactly. |
uncomp_size | Uncompressed size of the MicroLZMA stream. If the exact uncompressed size isn't known, this can be set to a value that is at most as big as the exact uncompressed size would be, but then the next argument uncomp_size_is_exact must be false. |
uncomp_size_is_exact | If true, uncomp_size must be exactly correct. This will improve error detection at the end of the stream. If the exact uncompressed size isn't known, this must be false. uncomp_size must still be at most as big as the exact uncompressed size is. Setting this to false when the exact size is known will work but error detection at the end of the stream will be weaker. |
dict_size | LZMA dictionary size that was used when compressing the data. It is OK to use a bigger value too but liblzma will then allocate more memory than would actually be required and error detection will be slightly worse. (Note that with the implementation in XZ Embedded it doesn't affect the memory usage if one specifies bigger dictionary than actually required.) |
|
extern |
Calculate output buffer size for single-call Stream encoder.
When trying to compress incompressible data, the encoded size will be slightly bigger than the input data. This function calculates how much output buffer space is required to be sure that lzma_stream_buffer_encode() doesn't return LZMA_BUF_ERROR.
The calculated value is not exact, but it is guaranteed to be big enough. The actual maximum output space required may be slightly smaller (up to about 100 bytes). This should not be a problem in practice.
If the calculated maximum size doesn't fit into size_t or would make the Stream grow past LZMA_VLI_MAX (which should never happen in practice), zero is returned to indicate the error.
uncompressed_size | Size in bytes of the uncompressed input data |
Calculate output buffer size for single-call Stream encoder.
This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks. See the documentation of lzma_stream_buffer_bound().
|
extern |
Calculate approximate memory usage of easy encoder.
Calculate recommended Block size for multithreaded .xz encoder.
Calculate approximate memory usage of multithreaded .xz encoder.
Calculate approximate decoder memory usage of a preset.
This function is a wrapper for lzma_raw_encoder_memusage().
preset | Compression preset (level and possible flags) |
This function is a wrapper for lzma_raw_decoder_memusage().
preset | Compression preset (level and possible flags) |
Since doing the encoding in threaded mode doesn't affect the memory requirements of single-threaded decompressor, you can use lzma_easy_decoder_memusage(options->preset) or lzma_raw_decoder_memusage(options->filters) to calculate the decompressor memory requirements.
options | Compression options |
This calculates a recommended Block size for multithreaded encoding given a filter chain. This is used internally by lzma_stream_encoder_mt() to determine the Block size if the block_size member is not set to the special value of 0 in the lzma_mt options struct.
If one wishes to change the filters between Blocks, this function is helpful to set the block_size member of the lzma_mt struct before calling lzma_stream_encoder_mt(). Since the block_size member represents the maximum possible Block size for the multithreaded .xz encoder, one can use this function to find the maximum recommended Block size based on all planned filter chains. Otherwise, the multithreaded encoder will base its maximum Block size on the first filter chain used (if the block_size member is not set), which may unnecessarily limit the Block size for a later filter chain.
filters | Array of filters terminated with .id == LZMA_VLI_UNKNOWN. |
Get the total amount of physical memory (RAM) in bytes.
Calculate approximate memory usage of easy encoder.
Get the uncompressed size of the file.
Get the total size of the file.
Get the total size of the Blocks.
Get the total size of the Stream.
Get the size of the Index field as bytes.
Get the number of Blocks.
Get the number of Streams.
Calculate the memory usage of an existing lzma_index.
On disk, the size of the Index field depends on both the number of Records stored and how big values the Records store (due to variable-length integer encoding). When the Index is kept in lzma_index structure, the memory usage depends only on the number of Records/Blocks stored in the Index(es), and in case of concatenated lzma_indexes, the number of Streams. The size in RAM is almost always significantly bigger than in the encoded form on disk.
This function calculates an approximate amount of memory needed hold the given number of Streams and Blocks in lzma_index structure. This value may vary between CPU architectures and also between liblzma versions if the internal implementation is modified.
This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), lzma_index_block_count(i)).
This returns the total number of Blocks in lzma_index. To get number of Blocks in individual Streams, use lzma_index_iter.
This is needed to verify the Backward Size field in the Stream Footer.
If multiple lzma_indexes have been combined, this works as if the Blocks were in a single Stream. This is useful if you are going to combine Blocks from multiple Streams into a single new Stream.
This doesn't include the Stream Header, Stream Footer, Stream Padding, or Index fields.
When no lzma_indexes have been combined with lzma_index_cat() and there is no Stream Padding, this function is identical to lzma_index_stream_size(). If multiple lzma_indexes have been combined, this includes also the headers of each separate Stream and the possible Stream Padding fields.
Get the total amount of physical memory (RAM) in bytes.
Calculate approximate memory usage of multithreaded .xz encoder.
Calculate approximate decoder memory usage of a preset.
This function is a wrapper for lzma_raw_encoder_memusage().
preset | Compression preset (level and possible flags) |
This function is a wrapper for lzma_raw_decoder_memusage().
preset | Compression preset (level and possible flags) |
Since doing the encoding in threaded mode doesn't affect the memory requirements of single-threaded decompressor, you can use lzma_easy_decoder_memusage(options->preset) or lzma_raw_decoder_memusage(options->filters) to calculate the decompressor memory requirements.
options | Compression options |
Calculate approximate memory usage of easy encoder.
Get the uncompressed size of the file.
Get the total size of the file.
Get the total size of the Blocks.
Get the total size of the Stream.
Get the size of the Index field as bytes.
Get the number of Blocks.
Get the number of Streams.
Calculate the memory usage of an existing lzma_index.
On disk, the size of the Index field depends on both the number of Records stored and how big values the Records store (due to variable-length integer encoding). When the Index is kept in lzma_index structure, the memory usage depends only on the number of Records/Blocks stored in the Index(es), and in case of concatenated lzma_indexes, the number of Streams. The size in RAM is almost always significantly bigger than in the encoded form on disk.
This function calculates an approximate amount of memory needed hold the given number of Streams and Blocks in lzma_index structure. This value may vary between CPU architectures and also between liblzma versions if the internal implementation is modified.
This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), lzma_index_block_count(i)).
This returns the total number of Blocks in lzma_index. To get number of Blocks in individual Streams, use lzma_index_iter.
This is needed to verify the Backward Size field in the Stream Footer.
If multiple lzma_indexes have been combined, this works as if the Blocks were in a single Stream. This is useful if you are going to combine Blocks from multiple Streams into a single new Stream.
This doesn't include the Stream Header, Stream Footer, Stream Padding, or Index fields.
When no lzma_indexes have been combined with lzma_index_cat() and there is no Stream Padding, this function is identical to lzma_index_stream_size(). If multiple lzma_indexes have been combined, this includes also the headers of each separate Stream and the possible Stream Padding fields.
Get the total amount of physical memory (RAM) in bytes.
Calculate approximate memory usage of easy encoder.
Get the uncompressed size of the file.
Get the total size of the file.
Get the total size of the Blocks.
Get the total size of the Stream.
Get the size of the Index field as bytes.
Get the number of Blocks.
Get the number of Streams.
Calculate the memory usage of an existing lzma_index.
On disk, the size of the Index field depends on both the number of Records stored and the size of the Records (due to variable-length integer encoding). When the Index is kept in lzma_index structure, the memory usage depends only on the number of Records/Blocks stored in the Index(es), and in case of concatenated lzma_indexes, the number of Streams. The size in RAM is almost always significantly bigger than in the encoded form on disk.
This function calculates an approximate amount of memory needed to hold the given number of Streams and Blocks in lzma_index structure. This value may vary between CPU architectures and also between liblzma versions if the internal implementation is modified.
streams | Number of Streams |
blocks | Number of Blocks |
This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), lzma_index_block_count(i)).
i | Pointer to lzma_index structure |
i | Pointer to lzma_index structure |
This returns the total number of Blocks in lzma_index. To get number of Blocks in individual Streams, use lzma_index_iter.
i | Pointer to lzma_index structure |
This is needed to verify the Backward Size field in the Stream Footer.
i | Pointer to lzma_index structure |
If multiple lzma_indexes have been combined, this works as if the Blocks were in a single Stream. This is useful if you are going to combine Blocks from multiple Streams into a single new Stream.
i | Pointer to lzma_index structure |
This doesn't include the Stream Header, Stream Footer, Stream Padding, or Index fields.
i | Pointer to lzma_index structure |
When no lzma_indexes have been combined with lzma_index_cat() and there is no Stream Padding, this function is identical to lzma_index_stream_size(). If multiple lzma_indexes have been combined, this includes also the headers of each separate Stream and the possible Stream Padding fields.
i | Pointer to lzma_index structure |
i | Pointer to lzma_index structure |
Get the total amount of physical memory (RAM) in bytes.
Calculate approximate memory usage of multithreaded .xz encoder.
Calculate approximate decoder memory usage of a preset.
This function is a wrapper for lzma_raw_encoder_memusage().
preset | Compression preset (level and possible flags) |
This function is a wrapper for lzma_raw_decoder_memusage().
preset | Compression preset (level and possible flags) |
Since doing the encoding in threaded mode doesn't affect the memory requirements of single-threaded decompressor, you can use lzma_easy_decoder_memusage(options->preset) or lzma_raw_decoder_memusage(options->filters) to calculate the decompressor memory requirements.
options | Compression options |
Calculate approximate memory usage of easy encoder.
Get the uncompressed size of the file.
Get the total size of the file.
Get the total size of the Blocks.
Get the total size of the Stream.
Get the size of the Index field as bytes.
Get the number of Blocks.
Get the number of Streams.
Calculate the memory usage of an existing lzma_index.
On disk, the size of the Index field depends on both the number of Records stored and how big values the Records store (due to variable-length integer encoding). When the Index is kept in lzma_index structure, the memory usage depends only on the number of Records/Blocks stored in the Index(es), and in case of concatenated lzma_indexes, the number of Streams. The size in RAM is almost always significantly bigger than in the encoded form on disk.
This function calculates an approximate amount of memory needed hold the given number of Streams and Blocks in lzma_index structure. This value may vary between CPU architectures and also between liblzma versions if the internal implementation is modified.
This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), lzma_index_block_count(i)).
This returns the total number of Blocks in lzma_index. To get number of Blocks in individual Streams, use lzma_index_iter.
This is needed to verify the Backward Size field in the Stream Footer.
If multiple lzma_indexes have been combined, this works as if the Blocks were in a single Stream. This is useful if you are going to combine Blocks from multiple Streams into a single new Stream.
This doesn't include the Stream Header, Stream Footer, Stream Padding, or Index fields.
When no lzma_indexes have been combined with lzma_index_cat() and there is no Stream Padding, this function is identical to lzma_index_stream_size(). If multiple lzma_indexes have been combined, this includes also the headers of each separate Stream and the possible Stream Padding fields.
Calculate approximate memory usage of easy encoder.
Get the uncompressed size of the file.
Get the total size of the file.
Get the total size of the Blocks.
Get the total size of the Stream.
Get the size of the Index field as bytes.
Get the number of Blocks.
Get the number of Streams.
Calculate the memory usage of an existing lzma_index.
On disk, the size of the Index field depends on both the number of Records stored and the size of the Records (due to variable-length integer encoding). When the Index is kept in lzma_index structure, the memory usage depends only on the number of Records/Blocks stored in the Index(es), and in case of concatenated lzma_indexes, the number of Streams. The size in RAM is almost always significantly bigger than in the encoded form on disk.
This function calculates an approximate amount of memory needed to hold the given number of Streams and Blocks in lzma_index structure. This value may vary between CPU architectures and also between liblzma versions if the internal implementation is modified.
streams | Number of Streams |
blocks | Number of Blocks |
This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i), lzma_index_block_count(i)).
i | Pointer to lzma_index structure |
i | Pointer to lzma_index structure |
This returns the total number of Blocks in lzma_index. To get number of Blocks in individual Streams, use lzma_index_iter.
i | Pointer to lzma_index structure |
This is needed to verify the Backward Size field in the Stream Footer.
i | Pointer to lzma_index structure |
If multiple lzma_indexes have been combined, this works as if the Blocks were in a single Stream. This is useful if you are going to combine Blocks from multiple Streams into a single new Stream.
i | Pointer to lzma_index structure |
This doesn't include the Stream Header, Stream Footer, Stream Padding, or Index fields.
i | Pointer to lzma_index structure |
When no lzma_indexes have been combined with lzma_index_cat() and there is no Stream Padding, this function is identical to lzma_index_stream_size(). If multiple lzma_indexes have been combined, this includes also the headers of each separate Stream and the possible Stream Padding fields.
i | Pointer to lzma_index structure |
i | Pointer to lzma_index structure |
uint32_t const lzma_allocator* allocator |
lzma_check check |
uint64_t comp_size |
const lzma_filter* filters |
uint32_t flags |
uint32_t const lzma_allocator const uint8_t* in |
uint32_t const lzma_allocator const uint8_t size_t* in_pos |
uint32_t const lzma_allocator const uint8_t size_t size_t in_size |
uint32_t const lzma_allocator const uint8_t size_t size_t uint8_t size_t size_t out_size lzma_nothrow lzma_attr_warn_unused_result |
uint64_t memlimit |
uint32_t const lzma_allocator const uint8_t size_t size_t uint8_t* out |
uint32_t const lzma_allocator const uint8_t size_t size_t uint8_t size_t* out_pos |
uint32_t preset |
uint64_t uint64_t uncomp_size |
uint64_t uint64_t lzma_bool uncomp_size_is_exact |