lz_encoder.c File Reference

LZ in window. More...

`#include "lz_encoder.h"`
`#include "lz_encoder_hash.h"`
`#include "memcmplen.h"`

## Data Structures

struct | lzma_coder

## Functions

static void | move_window (lzma_mf *mf)
| Moves the data in the input window to free space for new data. More...
static lzma_ret | fill_window (lzma_coder *coder, const 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) More...
static lzma_ret | lz_encode (void *coder_ptr, const 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, const lzma_allocator *allocator, const lzma_lz_options *lz_options)
static bool | lz_encoder_init (lzma_mf *mf, const 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 (void *coder_ptr, const lzma_allocator *allocator)
static lzma_ret | lz_encoder_update (void *coder_ptr, const 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, const lzma_allocator *allocator, const lzma_filter_info *filters, lzma_ret(*lz_init)(lzma_lz_encoder *lz, const 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. More...

## Detailed Description

LZ in window.

## Function Documentation

## move_window()

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.

## fill_window()

static lzma_ret fill_window | ( | lzma_coder * | coder,
|  | const 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.

## lzma_mf_is_supported()

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.