115ab8c86SJohn Marino /** 215ab8c86SJohn Marino * \file lzma/lzma12.h 315ab8c86SJohn Marino * \brief LZMA1 and LZMA2 filters 415ab8c86SJohn Marino */ 515ab8c86SJohn Marino 615ab8c86SJohn Marino /* 715ab8c86SJohn Marino * Author: Lasse Collin 815ab8c86SJohn Marino * 915ab8c86SJohn Marino * This file has been put into the public domain. 1015ab8c86SJohn Marino * You can do whatever you want with this file. 1115ab8c86SJohn Marino * 1215ab8c86SJohn Marino * See ../lzma.h for information about liblzma as a whole. 1315ab8c86SJohn Marino */ 1415ab8c86SJohn Marino 1515ab8c86SJohn Marino #ifndef LZMA_H_INTERNAL 1615ab8c86SJohn Marino # error Never include this file directly. Use <lzma.h> instead. 1715ab8c86SJohn Marino #endif 1815ab8c86SJohn Marino 1915ab8c86SJohn Marino 2015ab8c86SJohn Marino /** 2115ab8c86SJohn Marino * \brief LZMA1 Filter ID 2215ab8c86SJohn Marino * 2315ab8c86SJohn Marino * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils, 2415ab8c86SJohn Marino * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from 2515ab8c86SJohn Marino * accidentally using LZMA when they actually want LZMA2. 2615ab8c86SJohn Marino * 2715ab8c86SJohn Marino * LZMA1 shouldn't be used for new applications unless you _really_ know 2815ab8c86SJohn Marino * what you are doing. LZMA2 is almost always a better choice. 2915ab8c86SJohn Marino */ 3015ab8c86SJohn Marino #define LZMA_FILTER_LZMA1 LZMA_VLI_C(0x4000000000000001) 3115ab8c86SJohn Marino 3215ab8c86SJohn Marino /** 3315ab8c86SJohn Marino * \brief LZMA2 Filter ID 3415ab8c86SJohn Marino * 3515ab8c86SJohn Marino * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds 3615ab8c86SJohn Marino * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion 3715ab8c86SJohn Marino * when trying to compress uncompressible data), possibility to change 3815ab8c86SJohn Marino * lc/lp/pb in the middle of encoding, and some other internal improvements. 3915ab8c86SJohn Marino */ 4015ab8c86SJohn Marino #define LZMA_FILTER_LZMA2 LZMA_VLI_C(0x21) 4115ab8c86SJohn Marino 4215ab8c86SJohn Marino 4315ab8c86SJohn Marino /** 4415ab8c86SJohn Marino * \brief Match finders 4515ab8c86SJohn Marino * 4615ab8c86SJohn Marino * Match finder has major effect on both speed and compression ratio. 4715ab8c86SJohn Marino * Usually hash chains are faster than binary trees. 4815ab8c86SJohn Marino * 4915ab8c86SJohn Marino * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better 5015ab8c86SJohn Marino * choice, because binary trees get much higher compression ratio penalty 5115ab8c86SJohn Marino * with LZMA_SYNC_FLUSH. 5215ab8c86SJohn Marino * 5315ab8c86SJohn Marino * The memory usage formulas are only rough estimates, which are closest to 5415ab8c86SJohn Marino * reality when dict_size is a power of two. The formulas are more complex 5515ab8c86SJohn Marino * in reality, and can also change a little between liblzma versions. Use 5615ab8c86SJohn Marino * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage. 5715ab8c86SJohn Marino */ 5815ab8c86SJohn Marino typedef enum { 5915ab8c86SJohn Marino LZMA_MF_HC3 = 0x03, 6015ab8c86SJohn Marino /**< 6115ab8c86SJohn Marino * \brief Hash Chain with 2- and 3-byte hashing 6215ab8c86SJohn Marino * 6315ab8c86SJohn Marino * Minimum nice_len: 3 6415ab8c86SJohn Marino * 6515ab8c86SJohn Marino * Memory usage: 6615ab8c86SJohn Marino * - dict_size <= 16 MiB: dict_size * 7.5 6715ab8c86SJohn Marino * - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB 6815ab8c86SJohn Marino */ 6915ab8c86SJohn Marino 7015ab8c86SJohn Marino LZMA_MF_HC4 = 0x04, 7115ab8c86SJohn Marino /**< 7215ab8c86SJohn Marino * \brief Hash Chain with 2-, 3-, and 4-byte hashing 7315ab8c86SJohn Marino * 7415ab8c86SJohn Marino * Minimum nice_len: 4 7515ab8c86SJohn Marino * 7615ab8c86SJohn Marino * Memory usage: 7715ab8c86SJohn Marino * - dict_size <= 32 MiB: dict_size * 7.5 7815ab8c86SJohn Marino * - dict_size > 32 MiB: dict_size * 6.5 7915ab8c86SJohn Marino */ 8015ab8c86SJohn Marino 8115ab8c86SJohn Marino LZMA_MF_BT2 = 0x12, 8215ab8c86SJohn Marino /**< 8315ab8c86SJohn Marino * \brief Binary Tree with 2-byte hashing 8415ab8c86SJohn Marino * 8515ab8c86SJohn Marino * Minimum nice_len: 2 8615ab8c86SJohn Marino * 8715ab8c86SJohn Marino * Memory usage: dict_size * 9.5 8815ab8c86SJohn Marino */ 8915ab8c86SJohn Marino 9015ab8c86SJohn Marino LZMA_MF_BT3 = 0x13, 9115ab8c86SJohn Marino /**< 9215ab8c86SJohn Marino * \brief Binary Tree with 2- and 3-byte hashing 9315ab8c86SJohn Marino * 9415ab8c86SJohn Marino * Minimum nice_len: 3 9515ab8c86SJohn Marino * 9615ab8c86SJohn Marino * Memory usage: 9715ab8c86SJohn Marino * - dict_size <= 16 MiB: dict_size * 11.5 9815ab8c86SJohn Marino * - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB 9915ab8c86SJohn Marino */ 10015ab8c86SJohn Marino 10115ab8c86SJohn Marino LZMA_MF_BT4 = 0x14 10215ab8c86SJohn Marino /**< 10315ab8c86SJohn Marino * \brief Binary Tree with 2-, 3-, and 4-byte hashing 10415ab8c86SJohn Marino * 10515ab8c86SJohn Marino * Minimum nice_len: 4 10615ab8c86SJohn Marino * 10715ab8c86SJohn Marino * Memory usage: 10815ab8c86SJohn Marino * - dict_size <= 32 MiB: dict_size * 11.5 10915ab8c86SJohn Marino * - dict_size > 32 MiB: dict_size * 10.5 11015ab8c86SJohn Marino */ 11115ab8c86SJohn Marino } lzma_match_finder; 11215ab8c86SJohn Marino 11315ab8c86SJohn Marino 11415ab8c86SJohn Marino /** 11515ab8c86SJohn Marino * \brief Test if given match finder is supported 11615ab8c86SJohn Marino * 11715ab8c86SJohn Marino * Return true if the given match finder is supported by this liblzma build. 11815ab8c86SJohn Marino * Otherwise false is returned. It is safe to call this with a value that 11915ab8c86SJohn Marino * isn't listed in lzma_match_finder enumeration; the return value will be 12015ab8c86SJohn Marino * false. 12115ab8c86SJohn Marino * 12215ab8c86SJohn Marino * There is no way to list which match finders are available in this 12315ab8c86SJohn Marino * particular liblzma version and build. It would be useless, because 12415ab8c86SJohn Marino * a new match finder, which the application developer wasn't aware, 12515ab8c86SJohn Marino * could require giving additional options to the encoder that the older 12615ab8c86SJohn Marino * match finders don't need. 12715ab8c86SJohn Marino */ 12815ab8c86SJohn Marino extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) 12915ab8c86SJohn Marino lzma_nothrow lzma_attr_const; 13015ab8c86SJohn Marino 13115ab8c86SJohn Marino 13215ab8c86SJohn Marino /** 13315ab8c86SJohn Marino * \brief Compression modes 13415ab8c86SJohn Marino * 13515ab8c86SJohn Marino * This selects the function used to analyze the data produced by the match 13615ab8c86SJohn Marino * finder. 13715ab8c86SJohn Marino */ 13815ab8c86SJohn Marino typedef enum { 13915ab8c86SJohn Marino LZMA_MODE_FAST = 1, 14015ab8c86SJohn Marino /**< 14115ab8c86SJohn Marino * \brief Fast compression 14215ab8c86SJohn Marino * 14315ab8c86SJohn Marino * Fast mode is usually at its best when combined with 14415ab8c86SJohn Marino * a hash chain match finder. 14515ab8c86SJohn Marino */ 14615ab8c86SJohn Marino 14715ab8c86SJohn Marino LZMA_MODE_NORMAL = 2 14815ab8c86SJohn Marino /**< 14915ab8c86SJohn Marino * \brief Normal compression 15015ab8c86SJohn Marino * 15115ab8c86SJohn Marino * This is usually notably slower than fast mode. Use this 15215ab8c86SJohn Marino * together with binary tree match finders to expose the 15315ab8c86SJohn Marino * full potential of the LZMA1 or LZMA2 encoder. 15415ab8c86SJohn Marino */ 15515ab8c86SJohn Marino } lzma_mode; 15615ab8c86SJohn Marino 15715ab8c86SJohn Marino 15815ab8c86SJohn Marino /** 15915ab8c86SJohn Marino * \brief Test if given compression mode is supported 16015ab8c86SJohn Marino * 16115ab8c86SJohn Marino * Return true if the given compression mode is supported by this liblzma 16215ab8c86SJohn Marino * build. Otherwise false is returned. It is safe to call this with a value 16315ab8c86SJohn Marino * that isn't listed in lzma_mode enumeration; the return value will be false. 16415ab8c86SJohn Marino * 16515ab8c86SJohn Marino * There is no way to list which modes are available in this particular 16615ab8c86SJohn Marino * liblzma version and build. It would be useless, because a new compression 16715ab8c86SJohn Marino * mode, which the application developer wasn't aware, could require giving 16815ab8c86SJohn Marino * additional options to the encoder that the older modes don't need. 16915ab8c86SJohn Marino */ 17015ab8c86SJohn Marino extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode) 17115ab8c86SJohn Marino lzma_nothrow lzma_attr_const; 17215ab8c86SJohn Marino 17315ab8c86SJohn Marino 17415ab8c86SJohn Marino /** 17515ab8c86SJohn Marino * \brief Options specific to the LZMA1 and LZMA2 filters 17615ab8c86SJohn Marino * 17715ab8c86SJohn Marino * Since LZMA1 and LZMA2 share most of the code, it's simplest to share 17815ab8c86SJohn Marino * the options structure too. For encoding, all but the reserved variables 17915ab8c86SJohn Marino * need to be initialized unless specifically mentioned otherwise. 18015ab8c86SJohn Marino * lzma_lzma_preset() can be used to get a good starting point. 18115ab8c86SJohn Marino * 18215ab8c86SJohn Marino * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and 18315ab8c86SJohn Marino * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb. 18415ab8c86SJohn Marino */ 18515ab8c86SJohn Marino typedef struct { 18615ab8c86SJohn Marino /** 18715ab8c86SJohn Marino * \brief Dictionary size in bytes 18815ab8c86SJohn Marino * 18915ab8c86SJohn Marino * Dictionary size indicates how many bytes of the recently processed 19015ab8c86SJohn Marino * uncompressed data is kept in memory. One method to reduce size of 19115ab8c86SJohn Marino * the uncompressed data is to store distance-length pairs, which 19215ab8c86SJohn Marino * indicate what data to repeat from the dictionary buffer. Thus, 19315ab8c86SJohn Marino * the bigger the dictionary, the better the compression ratio 19415ab8c86SJohn Marino * usually is. 19515ab8c86SJohn Marino * 19615ab8c86SJohn Marino * Maximum size of the dictionary depends on multiple things: 19715ab8c86SJohn Marino * - Memory usage limit 19815ab8c86SJohn Marino * - Available address space (not a problem on 64-bit systems) 19915ab8c86SJohn Marino * - Selected match finder (encoder only) 20015ab8c86SJohn Marino * 20115ab8c86SJohn Marino * Currently the maximum dictionary size for encoding is 1.5 GiB 20215ab8c86SJohn Marino * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit 20315ab8c86SJohn Marino * systems for certain match finder implementation reasons. In the 20415ab8c86SJohn Marino * future, there may be match finders that support bigger 20515ab8c86SJohn Marino * dictionaries. 20615ab8c86SJohn Marino * 20715ab8c86SJohn Marino * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e. 20815ab8c86SJohn Marino * UINT32_MAX), so increasing the maximum dictionary size of the 20915ab8c86SJohn Marino * encoder won't cause problems for old decoders. 21015ab8c86SJohn Marino * 21115ab8c86SJohn Marino * Because extremely small dictionaries sizes would have unneeded 21215ab8c86SJohn Marino * overhead in the decoder, the minimum dictionary size is 4096 bytes. 21315ab8c86SJohn Marino * 21415ab8c86SJohn Marino * \note When decoding, too big dictionary does no other harm 21515ab8c86SJohn Marino * than wasting memory. 21615ab8c86SJohn Marino */ 21715ab8c86SJohn Marino uint32_t dict_size; 21815ab8c86SJohn Marino # define LZMA_DICT_SIZE_MIN UINT32_C(4096) 21915ab8c86SJohn Marino # define LZMA_DICT_SIZE_DEFAULT (UINT32_C(1) << 23) 22015ab8c86SJohn Marino 22115ab8c86SJohn Marino /** 22215ab8c86SJohn Marino * \brief Pointer to an initial dictionary 22315ab8c86SJohn Marino * 22415ab8c86SJohn Marino * It is possible to initialize the LZ77 history window using 22515ab8c86SJohn Marino * a preset dictionary. It is useful when compressing many 22615ab8c86SJohn Marino * similar, relatively small chunks of data independently from 22715ab8c86SJohn Marino * each other. The preset dictionary should contain typical 22815ab8c86SJohn Marino * strings that occur in the files being compressed. The most 22915ab8c86SJohn Marino * probable strings should be near the end of the preset dictionary. 23015ab8c86SJohn Marino * 23115ab8c86SJohn Marino * This feature should be used only in special situations. For 23215ab8c86SJohn Marino * now, it works correctly only with raw encoding and decoding. 23315ab8c86SJohn Marino * Currently none of the container formats supported by 23415ab8c86SJohn Marino * liblzma allow preset dictionary when decoding, thus if 23515ab8c86SJohn Marino * you create a .xz or .lzma file with preset dictionary, it 23615ab8c86SJohn Marino * cannot be decoded with the regular decoder functions. In the 23715ab8c86SJohn Marino * future, the .xz format will likely get support for preset 23815ab8c86SJohn Marino * dictionary though. 23915ab8c86SJohn Marino */ 24015ab8c86SJohn Marino const uint8_t *preset_dict; 24115ab8c86SJohn Marino 24215ab8c86SJohn Marino /** 24315ab8c86SJohn Marino * \brief Size of the preset dictionary 24415ab8c86SJohn Marino * 24515ab8c86SJohn Marino * Specifies the size of the preset dictionary. If the size is 24615ab8c86SJohn Marino * bigger than dict_size, only the last dict_size bytes are 24715ab8c86SJohn Marino * processed. 24815ab8c86SJohn Marino * 24915ab8c86SJohn Marino * This variable is read only when preset_dict is not NULL. 25015ab8c86SJohn Marino * If preset_dict is not NULL but preset_dict_size is zero, 25115ab8c86SJohn Marino * no preset dictionary is used (identical to only setting 25215ab8c86SJohn Marino * preset_dict to NULL). 25315ab8c86SJohn Marino */ 25415ab8c86SJohn Marino uint32_t preset_dict_size; 25515ab8c86SJohn Marino 25615ab8c86SJohn Marino /** 25715ab8c86SJohn Marino * \brief Number of literal context bits 25815ab8c86SJohn Marino * 25915ab8c86SJohn Marino * How many of the highest bits of the previous uncompressed 26015ab8c86SJohn Marino * eight-bit byte (also known as `literal') are taken into 26115ab8c86SJohn Marino * account when predicting the bits of the next literal. 26215ab8c86SJohn Marino * 26315ab8c86SJohn Marino * E.g. in typical English text, an upper-case letter is 26415ab8c86SJohn Marino * often followed by a lower-case letter, and a lower-case 26515ab8c86SJohn Marino * letter is usually followed by another lower-case letter. 26615ab8c86SJohn Marino * In the US-ASCII character set, the highest three bits are 010 26715ab8c86SJohn Marino * for upper-case letters and 011 for lower-case letters. 26815ab8c86SJohn Marino * When lc is at least 3, the literal coding can take advantage of 26915ab8c86SJohn Marino * this property in the uncompressed data. 27015ab8c86SJohn Marino * 27115ab8c86SJohn Marino * There is a limit that applies to literal context bits and literal 27215ab8c86SJohn Marino * position bits together: lc + lp <= 4. Without this limit the 27315ab8c86SJohn Marino * decoding could become very slow, which could have security related 27415ab8c86SJohn Marino * results in some cases like email servers doing virus scanning. 27515ab8c86SJohn Marino * This limit also simplifies the internal implementation in liblzma. 27615ab8c86SJohn Marino * 27715ab8c86SJohn Marino * There may be LZMA1 streams that have lc + lp > 4 (maximum possible 27815ab8c86SJohn Marino * lc would be 8). It is not possible to decode such streams with 27915ab8c86SJohn Marino * liblzma. 28015ab8c86SJohn Marino */ 28115ab8c86SJohn Marino uint32_t lc; 28215ab8c86SJohn Marino # define LZMA_LCLP_MIN 0 28315ab8c86SJohn Marino # define LZMA_LCLP_MAX 4 28415ab8c86SJohn Marino # define LZMA_LC_DEFAULT 3 28515ab8c86SJohn Marino 28615ab8c86SJohn Marino /** 28715ab8c86SJohn Marino * \brief Number of literal position bits 28815ab8c86SJohn Marino * 28915ab8c86SJohn Marino * lp affects what kind of alignment in the uncompressed data is 29015ab8c86SJohn Marino * assumed when encoding literals. A literal is a single 8-bit byte. 29115ab8c86SJohn Marino * See pb below for more information about alignment. 29215ab8c86SJohn Marino */ 29315ab8c86SJohn Marino uint32_t lp; 29415ab8c86SJohn Marino # define LZMA_LP_DEFAULT 0 29515ab8c86SJohn Marino 29615ab8c86SJohn Marino /** 29715ab8c86SJohn Marino * \brief Number of position bits 29815ab8c86SJohn Marino * 29915ab8c86SJohn Marino * pb affects what kind of alignment in the uncompressed data is 30015ab8c86SJohn Marino * assumed in general. The default means four-byte alignment 30115ab8c86SJohn Marino * (2^ pb =2^2=4), which is often a good choice when there's 30215ab8c86SJohn Marino * no better guess. 30315ab8c86SJohn Marino * 304*e151908bSDaniel Fojt * When the alignment is known, setting pb accordingly may reduce 30515ab8c86SJohn Marino * the file size a little. E.g. with text files having one-byte 30615ab8c86SJohn Marino * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can 30715ab8c86SJohn Marino * improve compression slightly. For UTF-16 text, pb=1 is a good 30815ab8c86SJohn Marino * choice. If the alignment is an odd number like 3 bytes, pb=0 30915ab8c86SJohn Marino * might be the best choice. 31015ab8c86SJohn Marino * 31115ab8c86SJohn Marino * Even though the assumed alignment can be adjusted with pb and 31215ab8c86SJohn Marino * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment. 31315ab8c86SJohn Marino * It might be worth taking into account when designing file formats 31415ab8c86SJohn Marino * that are likely to be often compressed with LZMA1 or LZMA2. 31515ab8c86SJohn Marino */ 31615ab8c86SJohn Marino uint32_t pb; 31715ab8c86SJohn Marino # define LZMA_PB_MIN 0 31815ab8c86SJohn Marino # define LZMA_PB_MAX 4 31915ab8c86SJohn Marino # define LZMA_PB_DEFAULT 2 32015ab8c86SJohn Marino 32115ab8c86SJohn Marino /** Compression mode */ 32215ab8c86SJohn Marino lzma_mode mode; 32315ab8c86SJohn Marino 32415ab8c86SJohn Marino /** 32515ab8c86SJohn Marino * \brief Nice length of a match 32615ab8c86SJohn Marino * 32715ab8c86SJohn Marino * This determines how many bytes the encoder compares from the match 32815ab8c86SJohn Marino * candidates when looking for the best match. Once a match of at 32915ab8c86SJohn Marino * least nice_len bytes long is found, the encoder stops looking for 33015ab8c86SJohn Marino * better candidates and encodes the match. (Naturally, if the found 33115ab8c86SJohn Marino * match is actually longer than nice_len, the actual length is 33215ab8c86SJohn Marino * encoded; it's not truncated to nice_len.) 33315ab8c86SJohn Marino * 33415ab8c86SJohn Marino * Bigger values usually increase the compression ratio and 33515ab8c86SJohn Marino * compression time. For most files, 32 to 128 is a good value, 33615ab8c86SJohn Marino * which gives very good compression ratio at good speed. 33715ab8c86SJohn Marino * 33815ab8c86SJohn Marino * The exact minimum value depends on the match finder. The maximum 33915ab8c86SJohn Marino * is 273, which is the maximum length of a match that LZMA1 and 34015ab8c86SJohn Marino * LZMA2 can encode. 34115ab8c86SJohn Marino */ 34215ab8c86SJohn Marino uint32_t nice_len; 34315ab8c86SJohn Marino 34415ab8c86SJohn Marino /** Match finder ID */ 34515ab8c86SJohn Marino lzma_match_finder mf; 34615ab8c86SJohn Marino 34715ab8c86SJohn Marino /** 34815ab8c86SJohn Marino * \brief Maximum search depth in the match finder 34915ab8c86SJohn Marino * 35015ab8c86SJohn Marino * For every input byte, match finder searches through the hash chain 35115ab8c86SJohn Marino * or binary tree in a loop, each iteration going one step deeper in 35215ab8c86SJohn Marino * the chain or tree. The searching stops if 35315ab8c86SJohn Marino * - a match of at least nice_len bytes long is found; 35415ab8c86SJohn Marino * - all match candidates from the hash chain or binary tree have 35515ab8c86SJohn Marino * been checked; or 35615ab8c86SJohn Marino * - maximum search depth is reached. 35715ab8c86SJohn Marino * 35815ab8c86SJohn Marino * Maximum search depth is needed to prevent the match finder from 35915ab8c86SJohn Marino * wasting too much time in case there are lots of short match 36015ab8c86SJohn Marino * candidates. On the other hand, stopping the search before all 36115ab8c86SJohn Marino * candidates have been checked can reduce compression ratio. 36215ab8c86SJohn Marino * 36315ab8c86SJohn Marino * Setting depth to zero tells liblzma to use an automatic default 36415ab8c86SJohn Marino * value, that depends on the selected match finder and nice_len. 36515ab8c86SJohn Marino * The default is in the range [4, 200] or so (it may vary between 36615ab8c86SJohn Marino * liblzma versions). 36715ab8c86SJohn Marino * 36815ab8c86SJohn Marino * Using a bigger depth value than the default can increase 36915ab8c86SJohn Marino * compression ratio in some cases. There is no strict maximum value, 37015ab8c86SJohn Marino * but high values (thousands or millions) should be used with care: 37115ab8c86SJohn Marino * the encoder could remain fast enough with typical input, but 37215ab8c86SJohn Marino * malicious input could cause the match finder to slow down 37315ab8c86SJohn Marino * dramatically, possibly creating a denial of service attack. 37415ab8c86SJohn Marino */ 37515ab8c86SJohn Marino uint32_t depth; 37615ab8c86SJohn Marino 37715ab8c86SJohn Marino /* 37815ab8c86SJohn Marino * Reserved space to allow possible future extensions without 37915ab8c86SJohn Marino * breaking the ABI. You should not touch these, because the names 38015ab8c86SJohn Marino * of these variables may change. These are and will never be used 38115ab8c86SJohn Marino * with the currently supported options, so it is safe to leave these 38215ab8c86SJohn Marino * uninitialized. 38315ab8c86SJohn Marino */ 38415ab8c86SJohn Marino uint32_t reserved_int1; 38515ab8c86SJohn Marino uint32_t reserved_int2; 38615ab8c86SJohn Marino uint32_t reserved_int3; 38715ab8c86SJohn Marino uint32_t reserved_int4; 38815ab8c86SJohn Marino uint32_t reserved_int5; 38915ab8c86SJohn Marino uint32_t reserved_int6; 39015ab8c86SJohn Marino uint32_t reserved_int7; 39115ab8c86SJohn Marino uint32_t reserved_int8; 39215ab8c86SJohn Marino lzma_reserved_enum reserved_enum1; 39315ab8c86SJohn Marino lzma_reserved_enum reserved_enum2; 39415ab8c86SJohn Marino lzma_reserved_enum reserved_enum3; 39515ab8c86SJohn Marino lzma_reserved_enum reserved_enum4; 39615ab8c86SJohn Marino void *reserved_ptr1; 39715ab8c86SJohn Marino void *reserved_ptr2; 39815ab8c86SJohn Marino 39915ab8c86SJohn Marino } lzma_options_lzma; 40015ab8c86SJohn Marino 40115ab8c86SJohn Marino 40215ab8c86SJohn Marino /** 40315ab8c86SJohn Marino * \brief Set a compression preset to lzma_options_lzma structure 40415ab8c86SJohn Marino * 40515ab8c86SJohn Marino * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9 40615ab8c86SJohn Marino * of the xz command line tool. In addition, it is possible to bitwise-or 40715ab8c86SJohn Marino * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported. 40815ab8c86SJohn Marino * The flags are defined in container.h, because the flags are used also 40915ab8c86SJohn Marino * with lzma_easy_encoder(). 41015ab8c86SJohn Marino * 41115ab8c86SJohn Marino * The preset values are subject to changes between liblzma versions. 41215ab8c86SJohn Marino * 41315ab8c86SJohn Marino * This function is available only if LZMA1 or LZMA2 encoder has been enabled 41415ab8c86SJohn Marino * when building liblzma. 41515ab8c86SJohn Marino * 41615ab8c86SJohn Marino * \return On success, false is returned. If the preset is not 41715ab8c86SJohn Marino * supported, true is returned. 41815ab8c86SJohn Marino */ 41915ab8c86SJohn Marino extern LZMA_API(lzma_bool) lzma_lzma_preset( 42015ab8c86SJohn Marino lzma_options_lzma *options, uint32_t preset) lzma_nothrow; 421