]> wimlib.net Git - wimlib/blob - include/wimlib/lcpit_matchfinder.h
WIMBoot / system compression: try WOFADK in addition to WOF
[wimlib] / include / wimlib / lcpit_matchfinder.h
1 /*
2  * lcpit_matchfinder.h
3  *
4  * A match-finder for Lempel-Ziv compression based on bottom-up construction and
5  * traversal of the Longest Common Prefix (LCP) interval tree.
6  *
7  * Author:      Eric Biggers
8  * Year:        2014, 2015
9  *
10  * The author dedicates this file to the public domain.
11  * You can do whatever you want with this file.
12  */
13
14 #ifndef _LCPIT_MATCHFINDER_H
15 #define _LCPIT_MATCHFINDER_H
16
17 #include "wimlib/types.h"
18
19 struct lcpit_matchfinder {
20         bool huge_mode;
21         u32 cur_pos;
22         u32 *pos_data;
23         union {
24                 u32 *intervals;
25                 u64 *intervals64;
26         };
27         u32 min_match_len;
28         u32 nice_match_len;
29 };
30
31 struct lz_match {
32         u32 length;
33         u32 offset;
34 };
35
36 extern u64
37 lcpit_matchfinder_get_needed_memory(size_t max_bufsize);
38
39 extern bool
40 lcpit_matchfinder_init(struct lcpit_matchfinder *mf, size_t max_bufsize,
41                        u32 min_match_len, u32 nice_match_len);
42
43 extern void
44 lcpit_matchfinder_load_buffer(struct lcpit_matchfinder *mf, const u8 *T, u32 n);
45
46 extern u32
47 lcpit_matchfinder_get_matches(struct lcpit_matchfinder *mf,
48                               struct lz_match *matches);
49
50 extern void
51 lcpit_matchfinder_skip_bytes(struct lcpit_matchfinder *mf, u32 count);
52
53 extern void
54 lcpit_matchfinder_destroy(struct lcpit_matchfinder *mf);
55
56 #endif /* _LCPIT_MATCHFINDER_H */