mirror of
https://github.com/intel/isa-l.git
synced 2025-11-01 21:13:09 +01:00
igzip: Separate defines for LVL1 and LVL0 hash tables
Change-Id: I19bdec8d2d0c74083bc1695763c9630516995885 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
@@ -77,6 +77,7 @@
|
||||
#define INVALID_HUFFCODE 1
|
||||
|
||||
#define LVL0_HASH_MASK (IGZIP_LVL0_HASH_SIZE - 1)
|
||||
#define LVL1_HASH_MASK (IGZIP_LVL1_HASH_SIZE - 1)
|
||||
#define LVL2_HASH_MASK (IGZIP_LVL2_HASH_SIZE - 1)
|
||||
#define SHORTEST_MATCH 4
|
||||
|
||||
|
@@ -68,7 +68,7 @@ void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream)
|
||||
}
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & LVL0_HASH_MASK;
|
||||
hash = compute_hash(literal) & LVL1_HASH_MASK;
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
@@ -89,7 +89,7 @@ void isal_deflate_icf_body_lvl1_base(struct isal_zstream *stream)
|
||||
|
||||
for (; next_hash < end; next_hash++) {
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & LVL0_HASH_MASK;
|
||||
hash = compute_hash(literal) & LVL1_HASH_MASK;
|
||||
last_seen[hash] = (uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream)
|
||||
}
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & LVL0_HASH_MASK;
|
||||
hash = compute_hash(literal) & LVL1_HASH_MASK;
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
@@ -178,7 +178,7 @@ void isal_deflate_icf_finish_lvl1_base(struct isal_zstream *stream)
|
||||
|
||||
for (; next_hash < end - 3; next_hash++) {
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & LVL0_HASH_MASK;
|
||||
hash = compute_hash(literal) & LVL1_HASH_MASK;
|
||||
last_seen[hash] = (uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
|
@@ -190,8 +190,8 @@ MARK __body_compute_hash_ %+ ARCH
|
||||
shr tmp3, 8
|
||||
compute_hash hash2, tmp3
|
||||
|
||||
and hash, LVL0_HASH_MASK
|
||||
and hash2, LVL0_HASH_MASK
|
||||
and hash, LVL1_HASH_MASK
|
||||
and hash2, LVL1_HASH_MASK
|
||||
|
||||
cmp byte [stream + _internal_state_has_hist], IGZIP_NO_HIST
|
||||
je write_first_byte
|
||||
@@ -220,7 +220,7 @@ loop2:
|
||||
mov tmp2, curr_data
|
||||
shr curr_data, 16
|
||||
compute_hash hash, curr_data
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
|
||||
mov dist2 %+ w, f_i %+ w
|
||||
dec dist2
|
||||
@@ -233,7 +233,7 @@ loop2:
|
||||
|
||||
shr tmp2, 24
|
||||
compute_hash hash2, tmp2
|
||||
and hash2 %+ d, LVL0_HASH_MASK
|
||||
and hash2 %+ d, LVL1_HASH_MASK
|
||||
|
||||
and dist2 %+ d, (D-1)
|
||||
neg dist2
|
||||
@@ -286,7 +286,7 @@ len_dist_lit_huffman:
|
||||
|
||||
shr curr_data, 24
|
||||
compute_hash hash3, curr_data
|
||||
and hash3, LVL0_HASH_MASK
|
||||
and hash3, LVL1_HASH_MASK
|
||||
|
||||
mov curr_data, tmp1
|
||||
shr tmp1, 8
|
||||
@@ -318,9 +318,9 @@ len_dist_lit_huffman:
|
||||
and dist_code2, 0x1F
|
||||
inc word [stream + _internal_state_hist_dist + HIST_ELEM_SIZE*dist_code2]
|
||||
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL0_HASH_MASK;
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash2 %+ d, LVL0_HASH_MASK
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL1_HASH_MASK;
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
and hash2 %+ d, LVL1_HASH_MASK
|
||||
|
||||
; continue
|
||||
cmp f_i, file_length
|
||||
@@ -371,9 +371,9 @@ len_dist_huffman:
|
||||
and dist_code, 0x1F
|
||||
inc word [stream + _internal_state_hist_dist + HIST_ELEM_SIZE*dist_code]
|
||||
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL0_HASH_MASK;
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash2 %+ d, LVL0_HASH_MASK
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL1_HASH_MASK;
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
and hash2 %+ d, LVL1_HASH_MASK
|
||||
|
||||
; continue
|
||||
cmp f_i, file_length
|
||||
@@ -501,14 +501,9 @@ write_first_byte:
|
||||
MOVDQU xdata, [file_start + f_i + 1]
|
||||
add f_i, 1
|
||||
mov curr_data, [file_start + f_i]
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash2 %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
and hash2 %+ d, LVL1_HASH_MASK
|
||||
|
||||
cmp f_i, file_length
|
||||
jl loop2
|
||||
jmp input_end
|
||||
|
||||
section .data
|
||||
align 16
|
||||
mask: dd LVL0_HASH_MASK, LVL0_HASH_MASK, LVL0_HASH_MASK, LVL0_HASH_MASK
|
||||
const_D: dq D
|
||||
|
@@ -129,7 +129,7 @@ isal_deflate_icf_finish_lvl1_01:
|
||||
ja end_loop_2
|
||||
|
||||
compute_hash hash, curr_data
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
mov [stream + _internal_state_head + 2 * hash], f_i %+ w
|
||||
mov byte [stream + _internal_state_has_hist], IGZIP_HIST
|
||||
jmp encode_literal
|
||||
@@ -141,10 +141,10 @@ loop2:
|
||||
cmp m_out_buf, [rsp + m_out_end]
|
||||
ja end_loop_2
|
||||
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL0_HASH_MASK;
|
||||
; hash = compute_hash(state->file_start + f_i) & LVL1_HASH_MASK;
|
||||
mov curr_data %+ d, [file_start + f_i]
|
||||
compute_hash hash, curr_data
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
|
||||
; f_index = state->head[hash];
|
||||
movzx f_index %+ d, word [stream + _internal_state_head + 2 * hash]
|
||||
@@ -203,19 +203,19 @@ loop2:
|
||||
|
||||
; only update hash twice
|
||||
|
||||
; hash = compute_hash(state->file_start + k) & LVL0_HASH_MASK;
|
||||
; hash = compute_hash(state->file_start + k) & LVL1_HASH_MASK;
|
||||
mov tmp6 %+ d, dword [file_start + tmp3]
|
||||
compute_hash hash, tmp6
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
; state->head[hash] = k;
|
||||
mov [stream + _internal_state_head + 2 * hash], tmp3 %+ w
|
||||
|
||||
add tmp3, 1
|
||||
|
||||
; hash = compute_hash(state->file_start + k) & LVL0_HASH_MASK;
|
||||
; hash = compute_hash(state->file_start + k) & LVL1_HASH_MASK;
|
||||
mov tmp6 %+ d, dword [file_start + tmp3]
|
||||
compute_hash hash, tmp6
|
||||
and hash %+ d, LVL0_HASH_MASK
|
||||
and hash %+ d, LVL1_HASH_MASK
|
||||
; state->head[hash] = k;
|
||||
mov [stream + _internal_state_head + 2 * hash], tmp3 %+ w
|
||||
|
||||
|
@@ -42,11 +42,16 @@
|
||||
%assign IGZIP_LVL0_HASH_SIZE (8 * K)
|
||||
%endif
|
||||
|
||||
%ifndef IGZIP_LVL1_HASH_SIZE
|
||||
%assign IGZIP_LVL1_HASH_SIZE (8 * K)
|
||||
%endif
|
||||
|
||||
%ifndef IGZIP_LVL2_HASH_SIZE
|
||||
%assign IGZIP_LVL2_HASH_SIZE IGZIP_HIST_SIZE
|
||||
%endif
|
||||
|
||||
%assign LVL0_HASH_MASK (IGZIP_LVL0_HASH_SIZE - 1)
|
||||
%assign LVL1_HASH_MASK (IGZIP_LVL1_HASH_SIZE - 1)
|
||||
%assign LVL2_HASH_MASK (IGZIP_LVL2_HASH_SIZE - 1)
|
||||
|
||||
%assign MIN_DEF_MATCH 3 ; Minimum length of a match in deflate
|
||||
|
@@ -119,6 +119,10 @@ extern "C" {
|
||||
#define IGZIP_LVL0_HASH_SIZE (8 * IGZIP_K)
|
||||
#endif
|
||||
|
||||
#ifndef IGZIP_LVL1_HASH_SIZE
|
||||
#define IGZIP_LVL1_HASH_SIZE (8 * IGZIP_K)
|
||||
#endif
|
||||
|
||||
#ifndef IGZIP_LVL2_HASH_SIZE
|
||||
#define IGZIP_LVL2_HASH_SIZE IGZIP_HIST_SIZE
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user