lzma_encoder.c File Reference

LZMA encoder. More...

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

## Macros

#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_lzma1_encoder *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_lzma1_encoder *coder, const uint32_t pos_state, const uint32_t distance, const uint32_t len)
static void | rep_match (lzma_lzma1_encoder *coder, const uint32_t pos_state, const uint32_t rep, const uint32_t len)
static void | encode_symbol (lzma_lzma1_encoder *coder, lzma_mf *mf, uint32_t back, uint32_t len, uint32_t position)
static bool | encode_init (lzma_lzma1_encoder *coder, lzma_mf *mf)
static void | encode_eopm (lzma_lzma1_encoder *coder, uint32_t position)
lzma_ret | lzma_lzma_encode (lzma_lzma1_encoder *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 (void *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_lzma1_encoder *coder, const lzma_options_lzma *options)
lzma_ret | lzma_lzma_encoder_create (void **coder_ptr, const lzma_allocator *allocator, const lzma_options_lzma *options, lzma_lz_options *lz_options)
static lzma_ret | lzma_encoder_init (lzma_lz_encoder *lz, const lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options)
lzma_ret | lzma_lzma_encoder_init (lzma_next_coder *next, const 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. More...
lzma_bool | lzma_mode_is_supported (lzma_mode mode)
| Test if given compression mode is supported. More...

## Detailed Description

LZMA encoder.

## Macro Definition Documentation

## LOOP_INPUT_MAX

#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

## lzma_lzma_lclppb_encode()

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_mode_is_supported()

lzma_bool lzma_mode_is_supported | ( | lzma_mode | mode | ) | const

Test if given compression mode is supported.

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.

References LZMA_MODE_FAST, and LZMA_MODE_NORMAL.