src/liblzma/lzma/lzma_encoder.c File Reference

LZMA encoder. More...

#include "lzma2_encoder.h"
#include "lzma_encoder_private.h"
#include "fastpos.h"

Defines

#define LOOP_INPUT_MAX   (OPTS + 1)

Functions

static void literal_matched (lzma_range_encoder *rc, probability *subcoder, uint32_t match_byte, uint32_t symbol)
static void literal (lzma_coder *coder, lzma_mf *mf, uint32_t position)
static void length_update_prices (lzma_length_encoder *lc, const uint32_t pos_state)
static void length (lzma_range_encoder *rc, lzma_length_encoder *lc, const uint32_t pos_state, uint32_t len, const bool fast_mode)
static void match (lzma_coder *coder, const uint32_t pos_state, const uint32_t distance, const uint32_t len)
static void rep_match (lzma_coder *coder, const uint32_t pos_state, const uint32_t rep, const uint32_t len)
static void encode_symbol (lzma_coder *coder, lzma_mf *mf, uint32_t back, uint32_t len, uint32_t position)
static bool encode_init (lzma_coder *coder, lzma_mf *mf)
static void encode_eopm (lzma_coder *coder, uint32_t position)
lzma_ret lzma_lzma_encode (lzma_coder *restrict coder, lzma_mf *restrict mf, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, uint32_t limit)
static lzma_ret lzma_encode (lzma_coder *restrict coder, lzma_mf *restrict mf, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size)
static bool is_options_valid (const lzma_options_lzma *options)
static void set_lz_options (lzma_lz_options *lz_options, const lzma_options_lzma *options)
static void length_encoder_reset (lzma_length_encoder *lencoder, const uint32_t num_pos_states, const bool fast_mode)
lzma_ret lzma_lzma_encoder_reset (lzma_coder *coder, const lzma_options_lzma *options)
lzma_ret lzma_lzma_encoder_create (lzma_coder **coder_ptr, lzma_allocator *allocator, const lzma_options_lzma *options, lzma_lz_options *lz_options)
static lzma_ret lzma_encoder_init (lzma_lz_encoder *lz, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)
lzma_ret lzma_lzma_encoder_init (lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters)
uint64_t lzma_lzma_encoder_memusage (const void *options)
bool lzma_lzma_lclppb_encode (const lzma_options_lzma *options, uint8_t *byte)
 Encodes lc/lp/pb into one byte. Returns false on success and true on error.
 LZMA_API (lzma_bool)
 Test if the given Check ID is supported.


Detailed Description

LZMA encoder.


Define Documentation

#define LOOP_INPUT_MAX   (OPTS + 1)

Number of bytes that a single encoding loop in lzma_lzma_encode() can consume from the dictionary. This limit comes from lzma_lzma_optimum() and may need to be updated if that function is significantly modified.


Function Documentation

bool lzma_lzma_lclppb_encode ( const lzma_options_lzma options,
uint8_t *  byte 
)

Encodes lc/lp/pb into one byte. Returns false on success and true on error.

References is_lclppb_valid(), lzma_options_lzma::lc, lzma_options_lzma::lp, and lzma_options_lzma::pb.

LZMA_API ( lzma_bool   ) 

Test if the given Check ID is supported.

Test if given match finder is supported.

Test if the given Filter ID is supported for encoding.

Set a compression preset to lzma_options_lzma structure.

Test if given compression mode is supported.

Compare if two Index lists are identical.

Locate a Record.

Test if the given Filter ID is supported for decoding.

Returns true if the given Check ID is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that is not in the range [0, 15]; in that case the return value is always false.

You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if liblzma is built with limited features).

Returns true if the give Filter ID is supported for decoding by this liblzma build. Otherwise false is returned.

When the Index is available, it is possible to do random-access reading with granularity of Block size.

Parameters:
i Pointer to lzma_index structure
record Pointer to a structure to hold the search results
target Uncompressed target offset which the caller would like to locate from the Stream
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
  • Information about the Record containing the requested uncompressed offset is stored into *record.
  • Read offset will be adjusted so that calling lzma_index_read() can be used to read subsequent Records.
  • This function returns false.

If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.

Returns:
True if *a and *b are equal, false otherwise.
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.

Test if the given Check ID is supported.

Compare if two Index lists are identical.

Locate a Record.

When the Index is available, it is possible to do random-access reading with granularity of Block size.

Parameters:
i Pointer to lzma_index structure
record Pointer to a structure to hold the search results
target Uncompressed target offset which the caller would like to locate from the Stream
If the target is smaller than the uncompressed size of the Stream (can be checked with lzma_index_uncompressed_size()):
  • Information about the Record containing the requested uncompressed offset is stored into *record.
  • Read offset will be adjusted so that calling lzma_index_read() can be used to read subsequent Records.
  • This function returns false.

If target is greater than the uncompressed size of the Stream, *record and the read position are not modified, and this function returns true.

Returns:
True if *a and *b are equal, false otherwise.


Generated on Wed May 25 10:35:47 2011 for XZ Utils by  doxygen 1.5.5