]>
Commit | Line | Data |
---|---|---|
224ce89b WB |
1 | /********************************************************************** |
2 | Copyright(c) 2011-2017 Intel Corporation All rights reserved. | |
3 | ||
4 | Redistribution and use in source and binary forms, with or without | |
5 | modification, are permitted provided that the following conditions | |
6 | are met: | |
7 | * Redistributions of source code must retain the above copyright | |
8 | notice, this list of conditions and the following disclaimer. | |
9 | * Redistributions in binary form must reproduce the above copyright | |
10 | notice, this list of conditions and the following disclaimer in | |
11 | the documentation and/or other materials provided with the | |
12 | distribution. | |
13 | * Neither the name of Intel Corporation nor the names of its | |
14 | contributors may be used to endorse or promote products derived | |
15 | from this software without specific prior written permission. | |
16 | ||
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
28 | **********************************************************************/ | |
29 | ||
30 | #include <stdint.h> | |
31 | #include "igzip_lib.h" | |
32 | #include "encode_df.h" | |
f91f0fd5 | 33 | #include "igzip_level_buf_structs.h" |
224ce89b WB |
34 | |
35 | void isal_deflate_body_base(struct isal_zstream *stream); | |
36 | void isal_deflate_finish_base(struct isal_zstream *stream); | |
f91f0fd5 TL |
37 | void isal_deflate_icf_body_hash_hist_base(struct isal_zstream *stream); |
38 | void icf_body_hash1_fillgreedy_lazy(struct isal_zstream *stream); | |
39 | void isal_deflate_icf_finish_hash_hist_base(struct isal_zstream *stream); | |
40 | void isal_deflate_icf_finish_hash_map_base(struct isal_zstream *stream); | |
224ce89b WB |
41 | void isal_update_histogram_base(uint8_t * start_stream, int length, |
42 | struct isal_huff_histogram *histogram); | |
43 | struct deflate_icf *encode_deflate_icf_base(struct deflate_icf *next_in, | |
44 | struct deflate_icf *end_in, struct BitBuf2 *bb, | |
45 | struct hufftables_icf *hufftables); | |
f91f0fd5 TL |
46 | uint32_t adler32_base(uint32_t init, const unsigned char *buf, uint64_t len); |
47 | int decode_huffman_code_block_stateless_base(struct inflate_state *s, uint8_t * start_out); | |
48 | ||
49 | extern void isal_deflate_hash_base(uint16_t *, uint32_t, uint32_t, uint8_t *, uint32_t); | |
50 | ||
51 | void set_long_icf_fg_base(uint8_t * next_in, uint8_t * end_in, | |
52 | struct deflate_icf *match_lookup, struct level_buf *level_buf); | |
53 | void gen_icf_map_h1_base(struct isal_zstream *stream, | |
54 | struct deflate_icf *matches_icf_lookup, uint64_t input_size); | |
224ce89b WB |
55 | |
56 | void isal_deflate_body(struct isal_zstream *stream) | |
57 | { | |
58 | isal_deflate_body_base(stream); | |
59 | } | |
60 | ||
61 | void isal_deflate_finish(struct isal_zstream *stream) | |
62 | { | |
63 | isal_deflate_finish_base(stream); | |
64 | } | |
65 | ||
f91f0fd5 TL |
66 | void isal_deflate_icf_body_lvl1(struct isal_zstream *stream) |
67 | { | |
68 | isal_deflate_icf_body_hash_hist_base(stream); | |
69 | } | |
70 | ||
71 | void isal_deflate_icf_body_lvl2(struct isal_zstream *stream) | |
72 | { | |
73 | isal_deflate_icf_body_hash_hist_base(stream); | |
74 | } | |
75 | ||
76 | void isal_deflate_icf_body_lvl3(struct isal_zstream *stream) | |
224ce89b | 77 | { |
f91f0fd5 | 78 | icf_body_hash1_fillgreedy_lazy(stream); |
224ce89b WB |
79 | } |
80 | ||
f91f0fd5 | 81 | void isal_deflate_icf_finish_lvl1(struct isal_zstream *stream) |
224ce89b | 82 | { |
f91f0fd5 TL |
83 | isal_deflate_icf_finish_hash_hist_base(stream); |
84 | } | |
85 | ||
86 | void isal_deflate_icf_finish_lvl2(struct isal_zstream *stream) | |
87 | { | |
88 | isal_deflate_icf_finish_hash_hist_base(stream); | |
89 | } | |
90 | ||
91 | void isal_deflate_icf_finish_lvl3(struct isal_zstream *stream) | |
92 | { | |
93 | isal_deflate_icf_finish_hash_map_base(stream); | |
224ce89b WB |
94 | } |
95 | ||
96 | void isal_update_histogram(uint8_t * start_stream, int length, | |
97 | struct isal_huff_histogram *histogram) | |
98 | { | |
99 | isal_update_histogram_base(start_stream, length, histogram); | |
100 | } | |
101 | ||
102 | struct deflate_icf *encode_deflate_icf(struct deflate_icf *next_in, | |
103 | struct deflate_icf *end_in, struct BitBuf2 *bb, | |
104 | struct hufftables_icf *hufftables) | |
105 | { | |
106 | return encode_deflate_icf_base(next_in, end_in, bb, hufftables); | |
107 | } | |
108 | ||
f91f0fd5 TL |
109 | uint32_t isal_adler32(uint32_t init, const unsigned char *buf, uint64_t len) |
110 | { | |
111 | return adler32_base(init, buf, len); | |
112 | } | |
113 | ||
114 | int decode_huffman_code_block_stateless(struct inflate_state *s, uint8_t * start_out) | |
115 | { | |
116 | return decode_huffman_code_block_stateless_base(s, start_out); | |
117 | } | |
118 | ||
119 | void isal_deflate_hash_lvl0(uint16_t * hash_table, uint32_t hash_mask, | |
120 | uint32_t current_index, uint8_t * dict, uint32_t dict_len) | |
121 | { | |
122 | isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); | |
123 | } | |
124 | ||
125 | void isal_deflate_hash_lvl1(uint16_t * hash_table, uint32_t hash_mask, | |
126 | uint32_t current_index, uint8_t * dict, uint32_t dict_len) | |
127 | { | |
128 | isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); | |
129 | } | |
130 | ||
131 | void isal_deflate_hash_lvl2(uint16_t * hash_table, uint32_t hash_mask, | |
132 | uint32_t current_index, uint8_t * dict, uint32_t dict_len) | |
133 | { | |
134 | isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); | |
135 | } | |
136 | ||
137 | void isal_deflate_hash_lvl3(uint16_t * hash_table, uint32_t hash_mask, | |
138 | uint32_t current_index, uint8_t * dict, uint32_t dict_len) | |
139 | { | |
140 | isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); | |
141 | } | |
142 | ||
143 | void set_long_icf_fg(uint8_t * next_in, uint8_t * end_in, | |
144 | struct deflate_icf *match_lookup, struct level_buf *level_buf) | |
224ce89b | 145 | { |
f91f0fd5 | 146 | set_long_icf_fg_base(next_in, end_in, match_lookup, level_buf); |
224ce89b WB |
147 | } |
148 | ||
f91f0fd5 TL |
149 | void gen_icf_map_lh1(struct isal_zstream *stream, |
150 | struct deflate_icf *matches_icf_lookup, uint64_t input_size) | |
224ce89b | 151 | { |
f91f0fd5 | 152 | gen_icf_map_h1_base(stream, matches_icf_lookup, input_size); |
224ce89b | 153 | } |