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