mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 17:33:50 +01:00
igzip: Remove file_start from zstate
Change-Id: Ia4cb6dc86da54cc771f25a6d958bea730caa4801 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
parent
0fe95360bb
commit
59b9990a39
@ -119,7 +119,6 @@ FIELD _icf_buf_start, 0, 0
|
||||
START_FIELDS ;; isal_zstate
|
||||
|
||||
;; name size align
|
||||
FIELD _file_start, 8, 8
|
||||
FIELD _bitbuf, _BitBuf2_size, _BitBuf2_align
|
||||
FIELD _crc, 4, 4
|
||||
FIELD _state, 4, 4
|
||||
@ -175,7 +174,6 @@ FIELD _internal_state, _isal_zstate_size, _isal_zstate_align
|
||||
|
||||
_internal_state_b_bytes_valid equ _internal_state+_b_bytes_valid
|
||||
_internal_state_b_bytes_processed equ _internal_state+_b_bytes_processed
|
||||
_internal_state_file_start equ _internal_state+_file_start
|
||||
_internal_state_crc equ _internal_state+_crc
|
||||
_internal_state_bitbuf equ _internal_state+_bitbuf
|
||||
_internal_state_state equ _internal_state+_state
|
||||
|
@ -630,7 +630,6 @@ static int isal_deflate_int_stateless(struct isal_zstream *stream)
|
||||
reset_match_history(stream);
|
||||
}
|
||||
|
||||
state->file_start = stream->next_in - stream->total_in;
|
||||
isal_deflate_pass(stream);
|
||||
|
||||
} else if (stream->level == 1) {
|
||||
@ -644,7 +643,6 @@ static int isal_deflate_int_stateless(struct isal_zstream *stream)
|
||||
reset_match_history(stream);
|
||||
|
||||
state->count = 0;
|
||||
state->file_start = stream->next_in - stream->total_in;
|
||||
isal_deflate_icf_pass(stream);
|
||||
|
||||
} else
|
||||
@ -970,8 +968,6 @@ int isal_deflate_stateless(struct isal_zstream *stream)
|
||||
return COMP_OK;
|
||||
else {
|
||||
if (stream->flush == FULL_FLUSH) {
|
||||
stream->internal_state.file_start =
|
||||
(uint8_t *) & stream->internal_state.buffer;
|
||||
reset_match_history(stream);
|
||||
}
|
||||
stream->internal_state.has_eob_hdr = 0;
|
||||
@ -1049,7 +1045,6 @@ int isal_deflate(struct isal_zstream *stream)
|
||||
|
||||
stream->next_in = &state->buffer[state->b_bytes_processed];
|
||||
stream->avail_in = state->b_bytes_valid - state->b_bytes_processed;
|
||||
state->file_start = stream->next_in - stream->total_in;
|
||||
processed += stream->avail_in;
|
||||
|
||||
if (stream->avail_in > IGZIP_HIST_SIZE
|
||||
@ -1082,8 +1077,6 @@ int isal_deflate(struct isal_zstream *stream)
|
||||
stream->next_in = next_in - stream->avail_in;
|
||||
stream->avail_in = avail_in + stream->avail_in;
|
||||
|
||||
state->file_start = stream->next_in - stream->total_in;
|
||||
|
||||
if (stream->avail_in > 0 && stream->avail_out > 0)
|
||||
isal_deflate_int(stream);
|
||||
|
||||
@ -1104,8 +1097,6 @@ int isal_deflate(struct isal_zstream *stream)
|
||||
stream->total_in += state->b_bytes_valid - state->b_bytes_processed;
|
||||
stream->next_in = next_in;
|
||||
stream->avail_in = avail_in;
|
||||
state->file_start = stream->next_in - stream->total_in;
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -32,6 +32,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
|
||||
uint64_t code, code_len, code2, code_len2;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
|
||||
if (stream->avail_in == 0) {
|
||||
if (stream->end_of_stream || stream->flush != NO_FLUSH)
|
||||
@ -54,8 +55,8 @@ void isal_deflate_body_base(struct isal_zstream *stream)
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
dist = (next_in - state->file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - state->file_start);
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
/* The -1 are to handle the case when dist = 0 */
|
||||
if (dist - 1 < IGZIP_HIST_SIZE - 1) {
|
||||
@ -75,8 +76,7 @@ void isal_deflate_body_base(struct isal_zstream *stream)
|
||||
for (; next_hash < end; next_hash++) {
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
last_seen[hash] =
|
||||
(uint64_t) (next_hash - state->file_start);
|
||||
last_seen[hash] = (uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
get_len_code(stream->hufftables, match_length, &code,
|
||||
@ -118,6 +118,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
|
||||
uint64_t code, code_len, code2, code_len2;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
|
||||
set_buf(&state->bitbuf, stream->next_out, stream->avail_out);
|
||||
|
||||
@ -134,8 +135,8 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
dist = (next_in - state->file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - state->file_start);
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
if (dist - 1 < IGZIP_HIST_SIZE - 1) { /* The -1 are to handle the case when dist = 0 */
|
||||
match_length =
|
||||
@ -154,7 +155,7 @@ void isal_deflate_finish_base(struct isal_zstream *stream)
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
last_seen[hash] =
|
||||
(uint64_t) (next_hash - state->file_start);
|
||||
(uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
get_len_code(stream->hufftables, match_length, &code,
|
||||
|
@ -36,6 +36,7 @@ void isal_deflate_icf_body_base(struct isal_zstream *stream)
|
||||
uint32_t code, code2, extra_bits;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
|
||||
if (stream->avail_in == 0) {
|
||||
if (stream->end_of_stream || stream->flush != NO_FLUSH)
|
||||
@ -64,8 +65,8 @@ void isal_deflate_icf_body_base(struct isal_zstream *stream)
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
dist = (next_in - state->file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - state->file_start);
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
/* The -1 are to handle the case when dist = 0 */
|
||||
if (dist - 1 < IGZIP_HIST_SIZE - 1) {
|
||||
@ -85,8 +86,7 @@ void isal_deflate_icf_body_base(struct isal_zstream *stream)
|
||||
for (; next_hash < end; next_hash++) {
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
last_seen[hash] =
|
||||
(uint64_t) (next_hash - state->file_start);
|
||||
last_seen[hash] = (uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
get_len_icf_code(match_length, &code);
|
||||
@ -130,6 +130,7 @@ void isal_deflate_icf_finish_base(struct isal_zstream *stream)
|
||||
uint32_t code, code2, extra_bits;
|
||||
struct isal_zstate *state = &stream->internal_state;
|
||||
uint16_t *last_seen = state->head;
|
||||
uint8_t *file_start = stream->next_in - stream->total_in;
|
||||
|
||||
start_in = stream->next_in;
|
||||
end_in = start_in + stream->avail_in;
|
||||
@ -150,8 +151,8 @@ void isal_deflate_icf_finish_base(struct isal_zstream *stream)
|
||||
|
||||
literal = *(uint32_t *) next_in;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
dist = (next_in - state->file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - state->file_start);
|
||||
dist = (next_in - file_start - last_seen[hash]) & 0xFFFF;
|
||||
last_seen[hash] = (uint64_t) (next_in - file_start);
|
||||
|
||||
if (dist - 1 < IGZIP_HIST_SIZE - 1) { /* The -1 are to handle the case when dist = 0 */
|
||||
match_length = compare258(next_in - dist, next_in, end_in - next_in);
|
||||
@ -168,8 +169,7 @@ void isal_deflate_icf_finish_base(struct isal_zstream *stream)
|
||||
for (; next_hash < end - 3; next_hash++) {
|
||||
literal = *(uint32_t *) next_hash;
|
||||
hash = compute_hash(literal) & HASH_MASK;
|
||||
last_seen[hash] =
|
||||
(uint64_t) (next_hash - state->file_start);
|
||||
last_seen[hash] = (uint64_t) (next_hash - file_start);
|
||||
}
|
||||
|
||||
get_len_icf_code(match_length, &code);
|
||||
|
@ -284,7 +284,6 @@ struct BitBuf2 {
|
||||
|
||||
/** @brief Holds the internal state information for input and output compression streams*/
|
||||
struct isal_zstate {
|
||||
uint8_t *file_start; //!< pointer to where file would logically start
|
||||
struct BitBuf2 bitbuf; //!< Bit Buffer
|
||||
uint32_t crc; //!< Current crc
|
||||
enum isal_zstate_state state; //!< Current state in processing the data stream
|
||||
|
Loading…
Reference in New Issue
Block a user