Data Structures | Functions

/tmp/buildd/xz-utils-5.0.0/src/liblzma/lz/lz_encoder.c File Reference

LZ in window. More...

#include "lz_encoder.h"
#include "lz_encoder_hash.h"

Data Structures

struct  lzma_coder_s

Functions

static void move_window (lzma_mf *mf)
 Moves the data in the input window to free space for new data.
static lzma_ret fill_window (lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in, size_t *in_pos, size_t in_size, lzma_action action)
 Tries to fill the input window (mf->buffer).
static lzma_ret lz_encode (lzma_coder *coder, lzma_allocator *allocator, const uint8_t *restrict in, size_t *restrict in_pos, size_t in_size, uint8_t *restrict out, size_t *restrict out_pos, size_t out_size, lzma_action action)
static bool lz_encoder_prepare (lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options)
static bool lz_encoder_init (lzma_mf *mf, lzma_allocator *allocator, const lzma_lz_options *lz_options)
uint64_t lzma_lz_encoder_memusage (const lzma_lz_options *lz_options)
static void lz_encoder_end (lzma_coder *coder, lzma_allocator *allocator)
static lzma_ret lz_encoder_update (lzma_coder *coder, lzma_allocator *allocator, const lzma_filter *filters_null lzma_attribute((unused)), const lzma_filter *reversed_filters)
lzma_ret lzma_lz_encoder_init (lzma_next_coder *next, lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret(*lz_init)(lzma_lz_encoder *lz, lzma_allocator *allocator, const void *options, lzma_lz_options *lz_options))
lzma_bool lzma_mf_is_supported (lzma_match_finder mf)
 Test if given match finder is supported.

Detailed Description

LZ in window.


Function Documentation

static void move_window ( lzma_mf mf  )  [static]

Moves the data in the input window to free space for new data.

mf->buffer is a sliding input window, which keeps mf->keep_size_before bytes of input history available all the time. Now and then we need to "slide" the buffer to make space for the new data to the end of the buffer. At the same time, data older than keep_size_before is dropped.

References lzma_mf_s::buffer, lzma_mf_s::keep_size_before, lzma_mf_s::offset, lzma_mf_s::read_limit, lzma_mf_s::read_pos, and lzma_mf_s::write_pos.

Referenced by fill_window().

static lzma_ret fill_window ( lzma_coder coder,
lzma_allocator allocator,
const uint8_t *  in,
size_t *  in_pos,
size_t  in_size,
lzma_action  action 
) [static]

Tries to fill the input window (mf->buffer).

If we are the last encoder in the chain, our input data is in in[]. Otherwise we call the next filter in the chain to process in[] and write its output to mf->buffer.

This function must not be called once it has returned LZMA_STREAM_END.

References lzma_mf_s::action, lzma_mf_s::buffer, lzma_next_coder_s::code, lzma_next_coder_s::coder, lzma_mf_s::keep_size_after, LZMA_RUN, LZMA_STREAM_END, lzma_coder_s::mf, move_window(), lzma_coder_s::next, lzma_mf_s::pending, lzma_mf_s::read_limit, lzma_mf_s::read_pos, lzma_mf_s::size, lzma_mf_s::skip, and lzma_mf_s::write_pos.

lzma_bool lzma_mf_is_supported ( lzma_match_finder  match_finder  )  const

Test if given match finder 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.

References LZMA_MF_BT2, LZMA_MF_BT3, LZMA_MF_BT4, LZMA_MF_HC3, and LZMA_MF_HC4.