mirror of
https://github.com/cuberite/libdeflate.git
synced 2025-08-03 17:56:17 -04:00
deflate_compress: improve block splitting in near-optimal compressor
When choosing which literals and matches to use for the block split statistics in deflate_compress_near_optimal(), take into account the min_len heuristic. This should give slightly more accurate results.
This commit is contained in:
parent
ea536bcce2
commit
074ef7db98
@ -3362,8 +3362,12 @@ deflate_compress_near_optimal(struct libdeflate_compressor * restrict c,
|
||||
const u8 * const in_max_block_end = choose_max_block_end(
|
||||
in_next, in_end, SOFT_MAX_BLOCK_LENGTH);
|
||||
const u8 *next_observation = in_next;
|
||||
unsigned min_len;
|
||||
|
||||
deflate_near_optimal_begin_block(c, in_block_begin == in);
|
||||
min_len = calculate_min_match_len(in_next,
|
||||
in_max_block_end - in_next,
|
||||
c->max_search_depth);
|
||||
|
||||
/*
|
||||
* Find matches until we decide to end the block. We end the
|
||||
@ -3421,7 +3425,7 @@ deflate_compress_near_optimal(struct libdeflate_compressor * restrict c,
|
||||
}
|
||||
c->freqs.litlen[*in_next]++;
|
||||
if (in_next >= next_observation) {
|
||||
if (best_len >= 4) {
|
||||
if (best_len >= min_len) {
|
||||
observe_match(&c->split_stats,
|
||||
best_len);
|
||||
next_observation = in_next + best_len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user