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) |
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_API (lzma_bool) |
LZ in 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.
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_OK, 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.