Rizin
unix-like reverse engineering framework and cli tools
|
LZMA1 and LZMA2 filters. More...
Go to the source code of this file.
Classes | |
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. More... | |
#define | LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) |
LZMA2 Filter ID. More... | |
#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 |
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_API (lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) lzma_nothrow lzma_attr_const | |
Test if given match finder is supported. More... | |
Variables | |
uint32_t preset | lzma_nothrow |
LZMA1 and LZMA2 filters.
Definition in file lzma12.h.
#define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) |
LZMA1 Filter ID.
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.
LZMA1 shouldn't be used for new applications unless you really know what you are doing. LZMA2 is almost always a better choice.
#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 uncompressible data), possibility to change lc/lp/pb in the middle of encoding, and some other internal improvements.
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.
Definition at line 58 of file lzma12.h.
enum lzma_mode |
Compression modes.
This selects the function used to analyze the data produced by the match finder.
Definition at line 138 of file lzma12.h.
LZMA_API | ( | lzma_bool | ) |
Test if given match finder is supported.
Test if the given Filter ID is supported for encoding.
Test if the given Check ID is supported.
Set a compression preset to lzma_options_lzma structure.
Test if given compression mode is supported.
Return true if the given match finder is supported by this liblzma build. Otherwise false is returned. 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.
Return true if the given compression mode is supported by this liblzma build. Otherwise false is returned. 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.
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 values are subject to changes between liblzma versions.
This function is available only if LZMA1 or LZMA2 encoder has been enabled when building liblzma.
Definition at line 81 of file index.c.
References assert(), i, index_tree_locate(), ITER_GROUP, ITER_INDEX, ITER_RECORD, iter_set_info(), ITER_STREAM, index_group::last, NULL, pos, index_group::records, lzma_index_s::streams, lzma_index_s::uncompressed_size, and index_record::uncompressed_sum.