src/liblzma/api/lzma/lzma.h File Reference

LZMA1 and LZMA2 filters. More...

Data Structures

struct  lzma_options_lzma
 Options specific to the LZMA1 and LZMA2 filters. More...

Defines

#define LZMA_FILTER_LZMA1   LZMA_VLI_C(0x4000000000000001)
 LZMA1 Filter ID.
#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

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 }
 

LZMA compression modes.

More...

Functions

 LZMA_API (lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder) lzma_attr_const
 Test if given match finder is supported.

Variables

uint32_t preset

Detailed Description

LZMA1 and LZMA2 filters.

Author:
Copyright (C) 1999-2006 Igor Pavlov
Copyright (C) 2007 Lasse Collin

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.


Define Documentation

#define LZMA_FILTER_LZMA1   LZMA_VLI_C(0x4000000000000001)

LZMA1 Filter ID.

LZMA1 is the very same thing as what was called just LZMA in earlier LZMA Utils, 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from accidentally using LZMA when they actually want LZMA2.

Referenced by message_filters().

#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 (expands uncompressible data less), possibility to change lc/lp/pb in the middle of encoding, and some other internal improvements.

Referenced by message_filters().


Enumeration Type Documentation

Match finders.

Match finder has major effect on both speed and compression ratio. Usually hash chains are faster than binary trees.

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_memusage_encoder() to get more accurate estimate of memory usage.

Enumerator:
LZMA_MF_HC3 

Hash Chain with 2- and 3-byte hashing.

Minimum nice_len: 3

Memory usage:

  • dict_size <= 16 MiB: dict_size * 7.5
  • dict_size > 16 MiB: dict_size * 5.5 + 64 MiB
LZMA_MF_HC4 

Hash Chain with 2-, 3-, and 4-byte hashing.

Minimum nice_len: 4

Memory usage: dict_size * 7.5

LZMA_MF_BT2 

Binary Tree with 2-byte hashing.

Minimum nice_len: 2

Memory usage: dict_size * 9.5

LZMA_MF_BT3 

Binary Tree with 2- and 3-byte hashing.

Minimum nice_len: 3

Memory usage:

  • dict_size <= 16 MiB: dict_size * 11.5
  • dict_size > 16 MiB: dict_size * 9.5 + 64 MiB
LZMA_MF_BT4 

Binary Tree with 2-, 3-, and 4-byte hashing.

Minimum nice_len: 4

Memory usage: dict_size * 11.5

enum lzma_mode

LZMA compression modes.

This selects the function used to analyze the data produced by the match finder.

Enumerator:
LZMA_MODE_FAST 

Fast compression.

Fast mode is usually at its best when combined with a hash chain match finder.

LZMA_MODE_NORMAL 

Normal compression.

This is usually notably slower than fast mode. Use this together with binary tree match finders to expose the full potential of the LZMA encoder.


Function Documentation

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.

Returns 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.

Returns 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.

References init_current(), next_group(), previous_group(), and set_info().


Generated on Tue Oct 6 14:02:22 2009 for XZ Utils by  doxygen 1.6.1