liblzma (XZ Utils) 5.4.4
|
LZMA1 and LZMA2 filters. More...
Data Structures | |
struct | lzma_options_lzma |
Options specific to the LZMA1 and LZMA2 filters. More... | |
Macros | |
#define | LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) |
LZMA1 Filter ID (for raw encoder/decoder only, not in .xz) | |
#define | LZMA_FILTER_LZMA1EXT LZMA_VLI_C(0x4000000000000002) |
LZMA1 Filter ID with extended options (for raw encoder/decoder) | |
#define | LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) |
LZMA2 Filter ID. | |
#define | LZMA_DICT_SIZE_MIN UINT32_C(4096) |
#define | LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23) |
#define | LZMA_LCLP_MIN 0 |
#define | LZMA_LCLP_MAX 4 |
#define | LZMA_LC_DEFAULT 3 |
#define | LZMA_LP_DEFAULT 0 |
#define | LZMA_PB_MIN 0 |
#define | LZMA_PB_MAX 4 |
#define | LZMA_PB_DEFAULT 2 |
#define | LZMA_LZMA1EXT_ALLOW_EOPM UINT32_C(0x01) |
#define | lzma_set_ext_size(opt_lzma2, u64size) |
Macro to set the 64-bit uncompressed size in ext_size_*. | |
Enumerations | |
enum | lzma_match_finder { LZMA_MF_HC3 = 0x03 , LZMA_MF_HC4 = 0x04 , LZMA_MF_BT2 = 0x12 , LZMA_MF_BT3 = 0x13 , LZMA_MF_BT4 = 0x14 } |
Match finders. More... | |
enum | lzma_mode { LZMA_MODE_FAST = 1 , LZMA_MODE_NORMAL = 2 } |
Compression modes. More... | |
Functions | |
lzma_bool | lzma_mf_is_supported (lzma_match_finder match_finder) lzma_nothrow lzma_attr_const |
Test if given match finder is supported. | |
lzma_bool | lzma_mode_is_supported (lzma_mode mode) lzma_nothrow lzma_attr_const |
Test if given compression mode is supported. | |
lzma_bool | lzma_lzma_preset (lzma_options_lzma *options, uint32_t preset) lzma_nothrow |
Set a compression preset to lzma_options_lzma structure. | |
LZMA1 and LZMA2 filters.
#define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) |
LZMA1 Filter ID (for raw encoder/decoder only, not in .xz)
LZMA1 is the very same thing as what was called just LZMA in LZMA Utils, 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from accidentally using LZMA when they actually want LZMA2.
#define LZMA_FILTER_LZMA1EXT LZMA_VLI_C(0x4000000000000002) |
LZMA1 Filter ID with extended options (for raw encoder/decoder)
This is like LZMA_FILTER_LZMA1 but with this ID a few extra options are supported in the lzma_options_lzma structure:
This allows handling file formats where LZMA1 streams are used but where the end marker isn't allowed or where it might not (always) be present. This extended LZMA1 functionality is provided as a Filter ID for raw encoder and decoder instead of adding new encoder and decoder initialization functions because this way it is possible to also use extra filters, for example, LZMA_FILTER_X86 in a filter chain with LZMA_FILTER_LZMA1EXT, which might be needed to handle some file formats.
#define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) |
LZMA2 Filter ID.
Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion when trying to compress incompressible data), possibility to change lc/lp/pb in the middle of encoding, and some other internal improvements.
#define lzma_set_ext_size | ( | opt_lzma2, | |
u64size | |||
) |
Macro to set the 64-bit uncompressed size in ext_size_*.
This might be convenient when decoding using LZMA_FILTER_LZMA1EXT. This isn't used with LZMA_FILTER_LZMA1 or LZMA_FILTER_LZMA2.
enum lzma_match_finder |
Match finders.
Match finder has major effect on both speed and compression ratio. Usually hash chains are faster than binary trees.
If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better choice, because binary trees get much higher compression ratio penalty with LZMA_SYNC_FLUSH.
The memory usage formulas are only rough estimates, which are closest to reality when dict_size is a power of two. The formulas are more complex in reality, and can also change a little between liblzma versions. Use lzma_raw_encoder_memusage() to get more accurate estimate of memory usage.
enum lzma_mode |
Compression modes.
This selects the function used to analyze the data produced by the match finder.
lzma_bool lzma_mf_is_supported | ( | lzma_match_finder | match_finder | ) | const |
Test if given match finder is supported.
It is safe to call this with a value that isn't listed in lzma_match_finder enumeration; the return value will be false.
There is no way to list which match finders are available in this particular liblzma version and build. It would be useless, because a new match finder, which the application developer wasn't aware, could require giving additional options to the encoder that the older match finders don't need.
match_finder | Match finder ID |
Test if given compression mode is supported.
It is safe to call this with a value that isn't listed in lzma_mode enumeration; the return value will be false.
There is no way to list which modes are available in this particular liblzma version and build. It would be useless, because a new compression mode, which the application developer wasn't aware, could require giving additional options to the encoder that the older modes don't need.
mode | Mode ID. |
lzma_bool lzma_lzma_preset | ( | lzma_options_lzma * | options, |
uint32_t | preset | ||
) |
Set a compression preset to lzma_options_lzma structure.
0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 of the xz command line tool. In addition, it is possible to bitwise-or flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. The flags are defined in container.h, because the flags are used also with lzma_easy_encoder().
The preset levels are subject to changes between liblzma versions.
This function is available only if LZMA1 or LZMA2 encoder has been enabled when building liblzma.
If features (like certain match finders) have been disabled at build time, then the function may return success (false) even though the resulting LZMA1/LZMA2 options may not be usable for encoder initialization (LZMA_OPTIONS_ERROR).
[out] | options | Pointer to LZMA1 or LZMA2 options to be filled |
preset | Preset level bitwse-ORed with preset flags |