XZ Utils 5.4.0
Data Structures | Macros | Typedefs | Functions
lz_encoder.h File Reference

LZ in window and match finder API. More...

#include "common.h"

Data Structures

struct  lzma_match
 
struct  lzma_mf_s
 
struct  lzma_lz_options
 
struct  lzma_lz_encoder
 

Macros

#define mf_find   lzma_mf_find
 Since everything else begins with mf_, use it also for lzma_mf_find(). More...
 

Typedefs

typedef struct lzma_mf_s lzma_mf
 

Functions

static uint32_t mf_get_hash_bytes (lzma_match_finder match_finder)
 
static const uint8_t * mf_ptr (const lzma_mf *mf)
 Get pointer to the first byte not ran through the match finder. More...
 
static uint32_t mf_avail (const lzma_mf *mf)
 Get the number of bytes that haven't been ran through the match finder yet. More...
 
static uint32_t mf_unencoded (const lzma_mf *mf)
 
static uint32_t mf_position (const lzma_mf *mf)
 
static void mf_skip (lzma_mf *mf, uint32_t amount)
 
static void mf_read (lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size, size_t *left)
 
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, lzma_vli id, const void *options, lzma_lz_options *lz_options))
 
uint64_t lzma_lz_encoder_memusage (const lzma_lz_options *lz_options)
 
uint32_t lzma_mf_find (lzma_mf *mf, uint32_t *count, lzma_match *matches)
 Find matches starting from the current byte. More...
 
uint32_t lzma_mf_hc3_find (lzma_mf *dict, lzma_match *matches)
 
void lzma_mf_hc3_skip (lzma_mf *dict, uint32_t amount)
 
uint32_t lzma_mf_hc4_find (lzma_mf *dict, lzma_match *matches)
 
void lzma_mf_hc4_skip (lzma_mf *dict, uint32_t amount)
 
uint32_t lzma_mf_bt2_find (lzma_mf *dict, lzma_match *matches)
 
void lzma_mf_bt2_skip (lzma_mf *dict, uint32_t amount)
 
uint32_t lzma_mf_bt3_find (lzma_mf *dict, lzma_match *matches)
 
void lzma_mf_bt3_skip (lzma_mf *dict, uint32_t amount)
 
uint32_t lzma_mf_bt4_find (lzma_mf *dict, lzma_match *matches)
 
void lzma_mf_bt4_skip (lzma_mf *dict, uint32_t amount)
 

Detailed Description

LZ in window and match finder API.

Macro Definition Documentation

◆ mf_find

#define mf_find   lzma_mf_find

Since everything else begins with mf_, use it also for lzma_mf_find().

Function Documentation

◆ mf_get_hash_bytes()

static uint32_t mf_get_hash_bytes ( lzma_match_finder  match_finder)
inlinestatic

Get how many bytes the match finder hashes in its initial step. This is also the minimum nice_len value with the match finder.

◆ mf_ptr()

static const uint8_t * mf_ptr ( const lzma_mf mf)
inlinestatic

Get pointer to the first byte not ran through the match finder.

References lzma_mf_s::buffer, and lzma_mf_s::read_pos.

◆ mf_avail()

static uint32_t mf_avail ( const lzma_mf mf)
inlinestatic

Get the number of bytes that haven't been ran through the match finder yet.

References lzma_mf_s::read_pos, and lzma_mf_s::write_pos.

◆ mf_unencoded()

static uint32_t mf_unencoded ( const lzma_mf mf)
inlinestatic

Get the number of bytes that haven't been encoded yet (some of these bytes may have been ran through the match finder though).

References lzma_mf_s::read_ahead, lzma_mf_s::read_pos, and lzma_mf_s::write_pos.

◆ mf_position()

static uint32_t mf_position ( const lzma_mf mf)
inlinestatic

Calculate the absolute offset from the beginning of the most recent dictionary reset. Only the lowest four bits are important, so there's no problem that we don't know the 64-bit size of the data encoded so far.

NOTE: When moving the input window, we need to do it so that the lowest bits of dict->read_pos are not modified to keep this macro working as intended.

References lzma_mf_s::read_ahead, and lzma_mf_s::read_pos.

◆ mf_skip()

static void mf_skip ( lzma_mf mf,
uint32_t  amount 
)
inlinestatic

Skip the given number of bytes. This is used when a good match was found. For example, if mf_find() finds a match of 200 bytes long, the first byte of that match was already consumed by mf_find(), and the rest 199 bytes have to be skipped with mf_skip(mf, 199).

References lzma_mf_s::read_ahead, and lzma_mf_s::skip.

◆ mf_read()

static void mf_read ( lzma_mf mf,
uint8_t *  out,
size_t *  out_pos,
size_t  out_size,
size_t *  left 
)
inlinestatic

Copies at most *left number of bytes from the history buffer to out[]. This is needed by LZMA2 to encode uncompressed chunks.

◆ lzma_mf_find()

uint32_t lzma_mf_find ( lzma_mf mf,
uint32_t *  count_ptr,
lzma_match matches 
)

Find matches starting from the current byte.

Returns
The length of the longest match found

References lzma_mf_s::find.