Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
lz_encoder_mf.c File Reference

Match finders. More...

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

Macros

#define EMPTY_HASH_VALUE   0
 
#define MUST_NORMALIZE_POS   UINT32_MAX
 
#define header(is_bt, len_min, ret_op)
 
#define header_find(is_bt, len_min)
 
#define header_skip(is_bt, len_min)
 
#define call_find(func, len_best)
 

Functions

uint32_t lzma_mf_find (lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
 Find matches starting from the current byte.
 

Detailed Description

Match finders.

Macro Definition Documentation

◆ call_find

#define call_find ( func,
len_best )
Value:
do { \
matches_count = func(len_limit, pos, cur, cur_match, mf->depth, \
mf->son, mf->cyclic_pos, mf->cyclic_size, \
matches + matches_count, len_best) \
- matches; \
move_pos(mf); \
return matches_count; \
} while (0)

Calls hc_find_func() or bt_find_func() and calculates the total number of matches found. Updates the dictionary position and returns the number of matches found.

◆ EMPTY_HASH_VALUE

#define EMPTY_HASH_VALUE   0

Hash value to indicate unused element in the hash. Since we start the positions from dict_size + 1, zero is always too far to qualify as usable match position.

◆ header

#define header ( is_bt,
len_min,
ret_op )
Value:
uint32_t len_limit = mf_avail(mf); \
if (mf->nice_len <= len_limit) { \
len_limit = mf->nice_len; \
} else if (len_limit < (len_min) \
|| (is_bt && mf->action == LZMA_SYNC_FLUSH)) { \
assert(mf->action != LZMA_RUN); \
move_pending(mf); \
ret_op; \
} \
const uint8_t *cur = mf_ptr(mf); \
const uint32_t pos = mf->read_pos + mf->offset
@ LZMA_SYNC_FLUSH
Make all the input available at output.
Definition base.h:265
@ LZMA_RUN
Continue coding.
Definition base.h:251

Calculate len_limit and determine if there is enough input to run the actual match finder code. Sets up "cur" and "pos". This macro is used by all find functions and binary tree skip functions. Hash chain skip function doesn't need len_limit so a simpler code is used in them.

◆ header_find

#define header_find ( is_bt,
len_min )
Value:
header(is_bt, len_min, return 0); \
uint32_t matches_count = 0
#define header(is_bt, len_min, ret_op)
Definition lz_encoder_mf.c:191

Header for find functions. "return 0" indicates that zero matches were found.

◆ header_skip

#define header_skip ( is_bt,
len_min )
Value:
header(is_bt, len_min, continue)

Header for a loop in a skip function. "continue" tells to skip the rest of the code in the loop.

◆ MUST_NORMALIZE_POS

#define MUST_NORMALIZE_POS   UINT32_MAX

Normalization must be done when lzma_mf.offset + lzma_mf.read_pos reaches MUST_NORMALIZE_POS.

Function Documentation

◆ lzma_mf_find()

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

Find matches starting from the current byte.

Returns
The length of the longest match found