]> wimlib.net Git - wimlib/blob - include/wimlib/lcpit_matchfinder.h
Use more comprehensive public domain dedications
[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  * The following copying information applies to this specific source code file:
8  *
9  * Written in 2014-2015 by Eric Biggers <ebiggers3@gmail.com>
10  *
11  * To the extent possible under law, the author(s) have dedicated all copyright
12  * and related and neighboring rights to this software to the public domain
13  * worldwide via the Creative Commons Zero 1.0 Universal Public Domain
14  * Dedication (the "CC0").
15  *
16  * This software is distributed in the hope that it will be useful, but WITHOUT
17  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  * FOR A PARTICULAR PURPOSE. See the CC0 for more details.
19  *
20  * You should have received a copy of the CC0 along with this software; if not
21  * see <http://creativecommons.org/publicdomain/zero/1.0/>.
22  */
23
24 #ifndef _LCPIT_MATCHFINDER_H
25 #define _LCPIT_MATCHFINDER_H
26
27 #include "wimlib/types.h"
28
29 struct lcpit_matchfinder {
30         bool huge_mode;
31         u32 cur_pos;
32         u32 *pos_data;
33         union {
34                 u32 *intervals;
35                 u64 *intervals64;
36         };
37         u32 min_match_len;
38         u32 nice_match_len;
39         u32 next[2];
40 };
41
42 struct lz_match {
43         u32 length;
44         u32 offset;
45 };
46
47 extern u64
48 lcpit_matchfinder_get_needed_memory(size_t max_bufsize);
49
50 extern bool
51 lcpit_matchfinder_init(struct lcpit_matchfinder *mf, size_t max_bufsize,
52                        u32 min_match_len, u32 nice_match_len);
53
54 extern void
55 lcpit_matchfinder_load_buffer(struct lcpit_matchfinder *mf, const u8 *T, u32 n);
56
57 extern u32
58 lcpit_matchfinder_get_matches(struct lcpit_matchfinder *mf,
59                               struct lz_match *matches);
60
61 extern void
62 lcpit_matchfinder_skip_bytes(struct lcpit_matchfinder *mf, u32 count);
63
64 extern void
65 lcpit_matchfinder_destroy(struct lcpit_matchfinder *mf);
66
67 #endif /* _LCPIT_MATCHFINDER_H */