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" 33 #include "igzip_level_buf_structs.h" 34 35 void 36 isal_deflate_body_base(struct isal_zstream *stream); 37 void 38 isal_deflate_finish_base(struct isal_zstream *stream); 39 void 40 isal_deflate_icf_body_hash_hist_base(struct isal_zstream *stream); 41 void 42 icf_body_hash1_fillgreedy_lazy(struct isal_zstream *stream); 43 void 44 isal_deflate_icf_finish_hash_hist_base(struct isal_zstream *stream); 45 void 46 isal_deflate_icf_finish_hash_map_base(struct isal_zstream *stream); 47 void 48 isal_update_histogram_base(uint8_t *start_stream, int length, 49 struct isal_huff_histogram *histogram); 50 struct deflate_icf * 51 encode_deflate_icf_base(struct deflate_icf *next_in, struct deflate_icf *end_in, struct BitBuf2 *bb, 52 struct hufftables_icf *hufftables); 53 uint32_t 54 adler32_base(uint32_t init, const unsigned char *buf, uint64_t len); 55 int 56 decode_huffman_code_block_stateless_base(struct inflate_state *s, uint8_t *start_out); 57 58 extern void 59 isal_deflate_hash_base(uint16_t *, uint32_t, uint32_t, uint8_t *, uint32_t); 60 61 void 62 set_long_icf_fg_base(uint8_t *next_in, uint64_t processed, uint64_t input_size, 63 struct deflate_icf *match_lookup); 64 65 uint64_t 66 gen_icf_map_h1_base(struct isal_zstream *stream, struct deflate_icf *matches_icf_lookup, 67 uint64_t input_size); 68 69 void 70 isal_deflate_body(struct isal_zstream *stream) 71 { 72 isal_deflate_body_base(stream); 73 } 74 75 void 76 isal_deflate_finish(struct isal_zstream *stream) 77 { 78 isal_deflate_finish_base(stream); 79 } 80 81 void 82 isal_deflate_icf_body_lvl1(struct isal_zstream *stream) 83 { 84 isal_deflate_icf_body_hash_hist_base(stream); 85 } 86 87 void 88 isal_deflate_icf_body_lvl2(struct isal_zstream *stream) 89 { 90 isal_deflate_icf_body_hash_hist_base(stream); 91 } 92 93 void 94 isal_deflate_icf_body_lvl3(struct isal_zstream *stream) 95 { 96 icf_body_hash1_fillgreedy_lazy(stream); 97 } 98 99 void 100 isal_deflate_icf_finish_lvl1(struct isal_zstream *stream) 101 { 102 isal_deflate_icf_finish_hash_hist_base(stream); 103 } 104 105 void 106 isal_deflate_icf_finish_lvl2(struct isal_zstream *stream) 107 { 108 isal_deflate_icf_finish_hash_hist_base(stream); 109 } 110 111 void 112 isal_deflate_icf_finish_lvl3(struct isal_zstream *stream) 113 { 114 isal_deflate_icf_finish_hash_map_base(stream); 115 } 116 117 void 118 isal_update_histogram(uint8_t *start_stream, int length, struct isal_huff_histogram *histogram) 119 { 120 isal_update_histogram_base(start_stream, length, histogram); 121 } 122 123 struct deflate_icf * 124 encode_deflate_icf(struct deflate_icf *next_in, struct deflate_icf *end_in, struct BitBuf2 *bb, 125 struct hufftables_icf *hufftables) 126 { 127 return encode_deflate_icf_base(next_in, end_in, bb, hufftables); 128 } 129 130 uint32_t 131 isal_adler32(uint32_t init, const unsigned char *buf, uint64_t len) 132 { 133 return adler32_base(init, buf, len); 134 } 135 136 int 137 decode_huffman_code_block_stateless(struct inflate_state *s, uint8_t *start_out) 138 { 139 return decode_huffman_code_block_stateless_base(s, start_out); 140 } 141 142 void 143 isal_deflate_hash_lvl0(uint16_t *hash_table, uint32_t hash_mask, uint32_t current_index, 144 uint8_t *dict, uint32_t dict_len) 145 { 146 isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); 147 } 148 149 void 150 isal_deflate_hash_lvl1(uint16_t *hash_table, uint32_t hash_mask, uint32_t current_index, 151 uint8_t *dict, uint32_t dict_len) 152 { 153 isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); 154 } 155 156 void 157 isal_deflate_hash_lvl2(uint16_t *hash_table, uint32_t hash_mask, uint32_t current_index, 158 uint8_t *dict, uint32_t dict_len) 159 { 160 isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); 161 } 162 163 void 164 isal_deflate_hash_lvl3(uint16_t *hash_table, uint32_t hash_mask, uint32_t current_index, 165 uint8_t *dict, uint32_t dict_len) 166 { 167 isal_deflate_hash_base(hash_table, hash_mask, current_index, dict, dict_len); 168 } 169 170 void 171 set_long_icf_fg(uint8_t *next_in, uint64_t processed, uint64_t input_size, 172 struct deflate_icf *match_lookup) 173 { 174 set_long_icf_fg_base(next_in, processed, input_size, match_lookup); 175 } 176 177 uint64_t 178 gen_icf_map_lh1(struct isal_zstream *stream, struct deflate_icf *matches_icf_lookup, 179 uint64_t input_size) 180 { 181 return gen_icf_map_h1_base(stream, matches_icf_lookup, input_size); 182 } 183