diff --git a/igzip/data_struct2.asm b/igzip/data_struct2.asm index ea908fc..a0d8a7b 100644 --- a/igzip/data_struct2.asm +++ b/igzip/data_struct2.asm @@ -96,6 +96,18 @@ FIELD _lit_len_table, 513 * HUFF_CODE_SIZE, HUFF_CODE_SIZE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +START_FIELDS ;; lvl1_buf + +;; name size align +FIELD _hash_table_lvl1, 2 * IGZIP_LVL1_HASH_SIZE, 2 + +%assign _lvl1_buf_size _FIELD_OFFSET +%assign _lvl1_buf_align _STRUCT_ALIGN + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + START_FIELDS ;; lvl2_buf ;; name size align @@ -117,6 +129,7 @@ START_FIELDS ;; level_buf ;; name size align FIELD _encode_tables, _hufftables_icf_size, _hufftables_icf_align +FIELD _hist, _isal_mod_hist_size, _isal_mod_hist_align FIELD _deflate_hdr_count, 4, 4 FIELD _deflate_hdr_extra_bits,4, 4 FIELD _deflate_hdr, DEF_MAX_HDR_SIZE, 1 @@ -128,10 +141,13 @@ FIELD _lvl_extra, _lvl2_buf_size, _lvl2_buf_align %assign _level_buf_base_size _FIELD_OFFSET %assign _level_buf_base_align _STRUCT_ALIGN +_lvl1_hash_table equ _lvl_extra + _hash_table_lvl1 _lvl2_hash_table equ _lvl_extra + _hash_table _lvl2_matches_next equ _lvl_extra + _matches_next _lvl2_matches_end equ _lvl_extra + _matches_end _lvl2_matches equ _lvl_extra + _matches +_hist_lit_len equ _hist+_ll_hist +_hist_dist equ _hist+_d_hist ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -151,7 +167,6 @@ FIELD _has_eob_hdr, 1, 1 FIELD _has_eob, 1, 1 FIELD _has_hist, 1, 1 FIELD _has_level_buf_init, 2, 2 -FIELD _hist, _isal_mod_hist_size, _isal_mod_hist_align FIELD _count, 4, 4 FIELD _tmp_out_buff, 16, 1 FIELD _tmp_out_start, 4, 4 @@ -169,8 +184,6 @@ _bitbuf_m_out_buf equ _bitbuf+_m_out_buf _bitbuf_m_out_end equ _bitbuf+_m_out_end _bitbuf_m_out_start equ _bitbuf+_m_out_start -_hist_lit_len equ _hist+_ll_hist -_hist_dist equ _hist+_d_hist ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -220,8 +233,6 @@ _internal_state_bitbuf_m_bit_count equ _internal_state+_bitbuf_m_bit_count _internal_state_bitbuf_m_out_buf equ _internal_state+_bitbuf_m_out_buf _internal_state_bitbuf_m_out_end equ _internal_state+_bitbuf_m_out_end _internal_state_bitbuf_m_out_start equ _internal_state+_bitbuf_m_out_start -_internal_state_hist_lit_len equ _internal_state+_hist_lit_len -_internal_state_hist_dist equ _internal_state+_hist_dist ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/igzip/igzip.c b/igzip/igzip.c index 08fc4aa..96c39b0 100644 --- a/igzip/igzip.c +++ b/igzip/igzip.c @@ -285,6 +285,9 @@ static int init_lvlX_buf(struct isal_zstream *stream) level_struct_size += sizeof(struct lvl2_buf); break; + case 1: + level_struct_size += sizeof(struct lvl1_buf); + break; } state->has_level_buf_init = 1; @@ -308,7 +311,7 @@ static void init_new_icf_block(struct isal_zstream *stream) level_buf->icf_buf_avail_out = stream->level_buf_size - level_struct_size - sizeof(struct deflate_icf); - memset(&state->hist, 0, sizeof(struct isal_mod_hist)); + memset(&level_buf->hist, 0, sizeof(struct isal_mod_hist)); state->state = ZSTATE_BODY; } @@ -345,7 +348,7 @@ static void create_icf_block_hdr(struct isal_zstream *stream) block_size = block_size ? block_size : TYPE0_BLK_HDR_LEN; /* Write EOB in icf_buf */ - state->hist.ll_hist[256] = 1; + level_buf->hist.ll_hist[256] = 1; level_buf->icf_buf_next->lit_len = 0x100; level_buf->icf_buf_next->lit_dist = NULL_DIST_SYM; level_buf->icf_buf_next->dist_extra = 0; @@ -368,7 +371,7 @@ static void create_icf_block_hdr(struct isal_zstream *stream) } bit_count = create_hufftables_icf(write_buf, &level_buf->encode_tables, - &state->hist, state->has_eob_hdr); + &level_buf->hist, state->has_eob_hdr); if (bit_count / 8 >= block_size && state->block_next >= state->total_in_start && block_size <= @@ -838,6 +841,10 @@ static inline void reset_match_history(struct isal_zstream *stream) hash_table = level_buf->lvl2.hash_table; hash_table_size = sizeof(level_buf->lvl2.hash_table); break; + case 1: + hash_table = level_buf->lvl1.hash_table; + hash_table_size = sizeof(level_buf->lvl1.hash_table); + break; default: hash_table = state->head; hash_table_size = sizeof(state->head); @@ -971,6 +978,10 @@ void isal_deflate_hash(struct isal_zstream *stream, uint8_t * dict, uint32_t dic memset(level_buf->lvl2.hash_table, -1, sizeof(level_buf->lvl2.hash_table)); isal_deflate_hash_lvl2(level_buf->lvl2.hash_table, LVL2_HASH_MASK, stream->total_in, dict, dict_len); + case 1: + memset(level_buf->lvl1.hash_table, -1, sizeof(level_buf->lvl1.hash_table)); + isal_deflate_hash_lvl0(level_buf->lvl1.hash_table, LVL1_HASH_MASK, + stream->total_in, dict, dict_len); default: memset(stream->internal_state.head, -1, sizeof(stream->internal_state.head)); isal_deflate_hash_lvl0(stream->internal_state.head, LVL0_HASH_MASK, @@ -1041,7 +1052,7 @@ int isal_deflate_stateless(struct isal_zstream *stream) if (stream->level == 1 && stream->level_buf == NULL) { /* Default to internal buffer if invalid size is supplied */ stream->level_buf = state->buffer; - stream->level_buf_size = sizeof(state->buffer); + stream->level_buf_size = sizeof(state->buffer) + sizeof(state->head); } else return level_check; } diff --git a/igzip/igzip_icf_base.c b/igzip/igzip_icf_base.c index a9e4b4c..0d57745 100644 --- a/igzip/igzip_icf_base.c +++ b/igzip/igzip_icf_base.c @@ -18,6 +18,8 @@ static inline void update_state(struct isal_zstream *stream, uint8_t * start_in, struct deflate_icf *start_out, struct deflate_icf *next_out, struct deflate_icf *end_out) { + struct level_buf *level_buf = (struct level_buf *)stream->level_buf; + if (next_in - start_in > 0) stream->internal_state.has_hist = IGZIP_HIST; @@ -26,8 +28,8 @@ static inline void update_state(struct isal_zstream *stream, uint8_t * start_in, stream->internal_state.block_end = stream->total_in; stream->avail_in = end_in - next_in; - ((struct level_buf *)stream->level_buf)->icf_buf_next = next_out; - ((struct level_buf *)stream->level_buf)->icf_buf_avail_out = end_out - next_out; + level_buf->icf_buf_next = next_out; + level_buf->icf_buf_avail_out = end_out - next_out; } void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream) @@ -39,7 +41,8 @@ void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream) uint32_t dist; uint32_t code, code2, extra_bits; struct isal_zstate *state = &stream->internal_state; - uint16_t *last_seen = state->head; + struct level_buf *level_buf = (struct level_buf *)stream->level_buf; + uint16_t *last_seen = level_buf->lvl1.hash_table; uint8_t *file_start = stream->next_in - stream->total_in; if (stream->avail_in == 0) { @@ -96,8 +99,8 @@ void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream) get_len_icf_code(match_length, &code); get_dist_icf_code(dist, &code2, &extra_bits); - state->hist.ll_hist[code]++; - state->hist.d_hist[code2]++; + level_buf->hist.ll_hist[code]++; + level_buf->hist.d_hist[code2]++; write_deflate_icf(next_out, code, code2, extra_bits); next_out++; @@ -108,7 +111,7 @@ void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream) } get_lit_icf_code(literal & 0xFF, &code); - state->hist.ll_hist[code]++; + level_buf->hist.ll_hist[code]++; write_deflate_icf(next_out, code, NULL_DIST_SYM, 0); next_out++; next_in++; @@ -133,7 +136,8 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream) uint32_t dist; uint32_t code, code2, extra_bits; struct isal_zstate *state = &stream->internal_state; - uint16_t *last_seen = state->head; + struct level_buf *level_buf = (struct level_buf *)stream->level_buf; + uint16_t *last_seen = level_buf->lvl1.hash_table; uint8_t *file_start = stream->next_in - stream->total_in; start_in = stream->next_in; @@ -185,8 +189,8 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream) get_len_icf_code(match_length, &code); get_dist_icf_code(dist, &code2, &extra_bits); - state->hist.ll_hist[code]++; - state->hist.d_hist[code2]++; + level_buf->hist.ll_hist[code]++; + level_buf->hist.d_hist[code2]++; write_deflate_icf(next_out, code, code2, extra_bits); @@ -198,7 +202,7 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream) } get_lit_icf_code(literal & 0xFF, &code); - state->hist.ll_hist[code]++; + level_buf->hist.ll_hist[code]++; write_deflate_icf(next_out, code, NULL_DIST_SYM, 0); next_out++; next_in++; @@ -215,7 +219,7 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream) literal = *next_in; get_lit_icf_code(literal & 0xFF, &code); - state->hist.ll_hist[code]++; + level_buf->hist.ll_hist[code]++; write_deflate_icf(next_out, code, NULL_DIST_SYM, 0); next_out++; next_in++; @@ -293,8 +297,8 @@ void isal_deflate_icf_finish_lvl2_base(struct isal_zstream *stream) get_len_icf_code(match_length, &code); get_dist_icf_code(dist, &code2, &extra_bits); - state->hist.ll_hist[code]++; - state->hist.d_hist[code2]++; + level_buf->hist.ll_hist[code]++; + level_buf->hist.d_hist[code2]++; write_deflate_icf(next_out, code, code2, extra_bits); @@ -306,7 +310,7 @@ void isal_deflate_icf_finish_lvl2_base(struct isal_zstream *stream) } get_lit_icf_code(literal & 0xFF, &code); - state->hist.ll_hist[code]++; + level_buf->hist.ll_hist[code]++; write_deflate_icf(next_out, code, NULL_DIST_SYM, 0); next_out++; next_in++; @@ -323,7 +327,7 @@ void isal_deflate_icf_finish_lvl2_base(struct isal_zstream *stream) literal = *next_in; get_lit_icf_code(literal & 0xFF, &code); - state->hist.ll_hist[code]++; + level_buf->hist.ll_hist[code]++; write_deflate_icf(next_out, code, NULL_DIST_SYM, 0); next_out++; next_in++; diff --git a/igzip/igzip_icf_body.c b/igzip/igzip_icf_body.c index 9cd1e14..8bce96a 100644 --- a/igzip/igzip_icf_body.c +++ b/igzip/igzip_icf_body.c @@ -155,14 +155,14 @@ struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream, code = *(uint64_t *) matches_next; lit_len = code & LIT_LEN_MASK; lit_len2 = (code >> ICF_CODE_LEN) & LIT_LEN_MASK; - state->hist.ll_hist[lit_len]++; + level_buf->hist.ll_hist[lit_len]++; if (lit_len >= LEN_START) { *(uint32_t *) level_buf->icf_buf_next = code; level_buf->icf_buf_next++; dist = (code >> ICF_DIST_OFFSET) & DIST_LIT_MASK; - state->hist.d_hist[dist]++; + level_buf->hist.d_hist[dist]++; lit_len -= LEN_OFFSET; matches_next += lit_len; @@ -170,10 +170,10 @@ struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream, *(uint64_t *) level_buf->icf_buf_next = code; level_buf->icf_buf_next += 2; - state->hist.ll_hist[lit_len2]++; + level_buf->hist.ll_hist[lit_len2]++; dist = (code >> (ICF_CODE_LEN + ICF_DIST_OFFSET)) & DIST_LIT_MASK; - state->hist.d_hist[dist]++; + level_buf->hist.d_hist[dist]++; lit_len2 -= LEN_OFFSET - 1; matches_next += lit_len2; @@ -182,7 +182,7 @@ struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream, *(uint32_t *) level_buf->icf_buf_next = code; level_buf->icf_buf_next++; - state->hist.ll_hist[lit_len2]++; + level_buf->hist.ll_hist[lit_len2]++; matches_next += 2; } @@ -194,10 +194,10 @@ struct deflate_icf *compress_icf_map_g(struct isal_zstream *stream, *(uint32_t *) level_buf->icf_buf_next = code; level_buf->icf_buf_next++; - state->hist.ll_hist[lit_len]++; + level_buf->hist.ll_hist[lit_len]++; if (lit_len >= LEN_START) { dist = (code >> 10) & 0x1ff; - state->hist.d_hist[dist]++; + level_buf->hist.d_hist[dist]++; lit_len -= LEN_OFFSET; matches_next += lit_len; } else { diff --git a/igzip/igzip_icf_body_h1_gr_bt.asm b/igzip/igzip_icf_body_h1_gr_bt.asm index f861ab3..c0bd8ae 100644 --- a/igzip/igzip_icf_body_h1_gr_bt.asm +++ b/igzip/igzip_icf_body_h1_gr_bt.asm @@ -52,7 +52,7 @@ global %1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %define file_start rdi %define file_length r15 -%define stream r14 +%define level_buf r14 %define f_i r10 %define m_out_buf r11 @@ -68,7 +68,6 @@ global %1 %define dist_code r12 %define tmp1 rsi - %define lit_code rsi %define curr_data2 r8 @@ -79,6 +78,7 @@ global %1 %define len_code rdx %define hash3 rdx +%define stream r13 %define tmp3 r13 %define hash rbp @@ -93,9 +93,9 @@ global %1 %define ytmp0 ymm0 ; tmp %define ytmp1 ymm1 ; tmp -%define hash_table stream + _internal_state_head -%define lit_len_hist stream + _internal_state_hist_lit_len -%define dist_hist stream + _internal_state_hist_dist +%define hash_table level_buf + _lvl1_hash_table +%define lit_len_hist level_buf + _hist_lit_len +%define dist_hist level_buf + _hist_dist ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -104,9 +104,10 @@ global %1 m_out_end equ 0 ; local variable (8 bytes) m_out_start equ 8 f_end_i_mem_offset equ 16 -gpr_save_mem_offset equ 24 ; gpr save area (8*8 bytes) -xmm_save_mem_offset equ 24 + 8*8 ; xmm save area (4*16 bytes) (16 byte aligned) -stack_size equ 3*8 + 8*8 + 4*16 +stream_offset equ 24 +gpr_save_mem_offset equ 32 ; gpr save area (8*8 bytes) +xmm_save_mem_offset equ gpr_save_mem_offset + 8*8 ; xmm save area (4*16 bytes) (16 byte aligned) +stack_size equ 5*8 + 8*8 + 4*16 ;;; 8 because stack address is odd multiple of 8 after a function call and ;;; we want it aligned to 16 bytes @@ -153,14 +154,16 @@ skip1: mov [rsp + gpr_save_mem_offset + 7*8], r15 mov stream, rcx + mov [rsp + stream_offset], stream + mov byte [stream + _internal_state_has_eob], 0 ; state->bitbuf.set_buf(stream->next_out, stream->avail_out); - mov tmp1, [stream + _level_buf] - mov m_out_buf, [tmp1 + _icf_buf_next] + mov level_buf, [stream + _level_buf] + mov m_out_buf, [level_buf + _icf_buf_next] mov [rsp + m_out_start], m_out_buf - mov tmp1, [tmp1 + _icf_buf_avail_out] + mov tmp1, [level_buf + _icf_buf_avail_out] add tmp1, m_out_buf sub tmp1, SLOP @@ -185,13 +188,13 @@ skip1: MARK __body_compute_hash_ %+ ARCH MOVDQU xdata, [file_start + f_i] mov curr_data, [file_start + f_i] - mov tmp3, curr_data - mov tmp4, curr_data + mov tmp1, curr_data + mov tmp2, curr_data compute_hash hash, curr_data - shr tmp3, 8 - compute_hash hash2, tmp3 + shr tmp1, 8 + compute_hash hash2, tmp1 and hash, LVL1_HASH_MASK and hash2, LVL1_HASH_MASK @@ -402,6 +405,7 @@ write_lit_bits: jl loop2 input_end: + mov stream, [rsp + stream_offset] mov tmp1, ZSTATE_FLUSH_READ_BUFFER mov tmp2, ZSTATE_BODY cmp word [stream + _end_of_stream], 0 @@ -413,6 +417,7 @@ input_end: jmp end output_end: + mov stream, [rsp + stream_offset] mov dword [stream + _internal_state_state], ZSTATE_CREATE_HDR end: @@ -426,10 +431,9 @@ end: mov [stream + _avail_in], file_length %+ d ;; update output buffer - mov tmp1, [stream + _level_buf] - mov [tmp1 + _icf_buf_next], m_out_buf + mov [level_buf + _icf_buf_next], m_out_buf sub m_out_buf, [rsp + m_out_start] - sub [tmp1 + _icf_buf_avail_out], m_out_buf %+ d + sub [level_buf + _icf_buf_avail_out], m_out_buf %+ d mov rbx, [rsp + gpr_save_mem_offset + 0*8] mov rsi, [rsp + gpr_save_mem_offset + 1*8] @@ -491,8 +495,8 @@ write_first_byte: mov [hash_table + 2 * hash], f_i %+ w mov hash, hash2 - shr tmp4, 16 - compute_hash hash2, tmp4 + shr tmp2, 16 + compute_hash hash2, tmp2 and curr_data, 0xff inc word [lit_len_hist + HIST_ELEM_SIZE*curr_data] diff --git a/igzip/igzip_icf_finish.asm b/igzip/igzip_icf_finish.asm index d56aabe..3e0c21c 100644 --- a/igzip/igzip_icf_finish.asm +++ b/igzip/igzip_icf_finish.asm @@ -63,6 +63,8 @@ %define m_out_buf r8 +%define level_buf r9 + %define dist r10 %define code2 r12 @@ -74,9 +76,10 @@ %define hufftables r15 -%define hash_table stream + _internal_state_head -%define lit_len_hist stream + _internal_state_hist_lit_len -%define dist_hist stream + _internal_state_hist_dist +%define hash_table level_buf + _lvl1_hash_table +%define lit_len_hist level_buf + _hist_lit_len +%define dist_hist level_buf + _hist_dist + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -98,10 +101,10 @@ isal_deflate_icf_finish_lvl1_01: %endif ; state->bitbuf.set_buf(stream->next_out, stream->avail_out); - mov tmp1, [stream + _level_buf] - mov m_out_buf, [tmp1 + _icf_buf_next] + mov level_buf, [stream + _level_buf] + mov m_out_buf, [level_buf + _icf_buf_next] mov [rsp + m_out_start], m_out_buf - mov tmp1, [tmp1 + _icf_buf_avail_out] + mov tmp1, [level_buf + _icf_buf_avail_out] add tmp1, m_out_buf sub tmp1, 4 @@ -286,14 +289,13 @@ end: mov [stream + _avail_in], f_end_i %+ d ;; Update output buffer - mov tmp1, [stream + _level_buf] - mov [tmp1 + _icf_buf_next], m_out_buf + mov [level_buf + _icf_buf_next], m_out_buf ; len = state->bitbuf.buffer_used(); sub m_out_buf, [rsp + m_out_start] ; stream->avail_out -= len; - sub [tmp1 + _icf_buf_avail_out], m_out_buf + sub [level_buf + _icf_buf_avail_out], m_out_buf add rsp, stack_size POP_ALL diff --git a/igzip/igzip_level_buf_structs.h b/igzip/igzip_level_buf_structs.h index 66d6143..b5f9c58 100644 --- a/igzip/igzip_level_buf_structs.h +++ b/igzip/igzip_level_buf_structs.h @@ -7,7 +7,11 @@ #define MATCH_BUF_SIZE (4 * 1024) -struct lvl2_buf{ +struct lvl1_buf { + uint16_t hash_table[IGZIP_LVL1_HASH_SIZE]; +}; + +struct lvl2_buf { uint16_t hash_table[IGZIP_LVL2_HASH_SIZE]; struct deflate_icf *matches_next; struct deflate_icf *matches_end; @@ -19,13 +23,17 @@ struct lvl2_buf{ struct level_buf { struct hufftables_icf encode_tables; + struct isal_mod_hist hist; uint32_t deflate_hdr_count; uint32_t deflate_hdr_extra_bits; uint8_t deflate_hdr[ISAL_DEF_MAX_HDR_SIZE]; struct deflate_icf *icf_buf_next; uint64_t icf_buf_avail_out; struct deflate_icf *icf_buf_start; - struct lvl2_buf lvl2; + union { + struct lvl1_buf lvl1; + struct lvl2_buf lvl2; + }; }; #endif diff --git a/include/igzip_lib.h b/include/igzip_lib.h index 2c3cfed..35ccb51 100644 --- a/include/igzip_lib.h +++ b/include/igzip_lib.h @@ -259,7 +259,7 @@ struct isal_mod_hist { /* Defines used set level data sizes */ /* has to be at least sizeof(struct level_buf) + sizeof(struct lvlX_buf */ #define ISAL_DEF_LVL0_REQ 0 -#define ISAL_DEF_LVL1_REQ 4 * IGZIP_K +#define ISAL_DEF_LVL1_REQ (4 * IGZIP_K + 2 * IGZIP_LVL1_HASH_SIZE) #define ISAL_DEF_LVL1_TOKEN_SIZE 4 #define ISAL_DEF_LVL2_REQ 4 * IGZIP_K + 4 * 4 * IGZIP_K + 2 * IGZIP_LVL2_HASH_SIZE #define ISAL_DEF_LVL2_TOKEN_SIZE 4 @@ -317,7 +317,6 @@ struct isal_zstate { uint8_t has_eob; //!< keeps track of eob on the last deflate block uint8_t has_hist; //!< flag to track if there is match history uint16_t has_level_buf_init; //!< flag to track if user supplied memory has been initialized. - struct isal_mod_hist hist; uint32_t count; //!< used for partial header/trailer writes uint8_t tmp_out_buff[16]; //!< temporary array uint32_t tmp_out_start; //!< temporary variable