mirror of
https://github.com/intel/isa-l.git
synced 2025-10-29 12:18:00 +01:00
include: reformat using new code style
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
committed by
Pablo de Lara
parent
55fbfabfc6
commit
fa5b8baf84
@@ -80,17 +80,17 @@ extern "C" {
|
||||
/******************************************************************************/
|
||||
/* Deflate Compression Standard Defines */
|
||||
/******************************************************************************/
|
||||
#define IGZIP_K 1024
|
||||
#define ISAL_DEF_MAX_HDR_SIZE 328
|
||||
#define ISAL_DEF_MAX_CODE_LEN 15
|
||||
#define ISAL_DEF_HIST_SIZE (32*IGZIP_K)
|
||||
#define IGZIP_K 1024
|
||||
#define ISAL_DEF_MAX_HDR_SIZE 328
|
||||
#define ISAL_DEF_MAX_CODE_LEN 15
|
||||
#define ISAL_DEF_HIST_SIZE (32 * IGZIP_K)
|
||||
#define ISAL_DEF_MAX_HIST_BITS 15
|
||||
#define ISAL_DEF_MAX_MATCH 258
|
||||
#define ISAL_DEF_MIN_MATCH 3
|
||||
#define ISAL_DEF_MAX_MATCH 258
|
||||
#define ISAL_DEF_MIN_MATCH 3
|
||||
|
||||
#define ISAL_DEF_LIT_SYMBOLS 257
|
||||
#define ISAL_DEF_LEN_SYMBOLS 29
|
||||
#define ISAL_DEF_DIST_SYMBOLS 30
|
||||
#define ISAL_DEF_LIT_SYMBOLS 257
|
||||
#define ISAL_DEF_LEN_SYMBOLS 29
|
||||
#define ISAL_DEF_DIST_SYMBOLS 30
|
||||
#define ISAL_DEF_LIT_LEN_SYMBOLS (ISAL_DEF_LIT_SYMBOLS + ISAL_DEF_LEN_SYMBOLS)
|
||||
|
||||
/* Max repeat length, rounded up to 32 byte boundary */
|
||||
@@ -118,53 +118,53 @@ extern "C" {
|
||||
|
||||
#define ISAL_LIMIT_HASH_UPDATE
|
||||
|
||||
#define IGZIP_HASH8K_HASH_SIZE (8 * IGZIP_K)
|
||||
#define IGZIP_HASH_HIST_SIZE IGZIP_HIST_SIZE
|
||||
#define IGZIP_HASH8K_HASH_SIZE (8 * IGZIP_K)
|
||||
#define IGZIP_HASH_HIST_SIZE IGZIP_HIST_SIZE
|
||||
#define IGZIP_HASH_MAP_HASH_SIZE IGZIP_HIST_SIZE
|
||||
|
||||
#define IGZIP_LVL0_HASH_SIZE (8 * IGZIP_K)
|
||||
#define IGZIP_LVL1_HASH_SIZE IGZIP_HASH8K_HASH_SIZE
|
||||
#define IGZIP_LVL2_HASH_SIZE IGZIP_HASH_HIST_SIZE
|
||||
#define IGZIP_LVL3_HASH_SIZE IGZIP_HASH_MAP_HASH_SIZE
|
||||
#define IGZIP_LVL0_HASH_SIZE (8 * IGZIP_K)
|
||||
#define IGZIP_LVL1_HASH_SIZE IGZIP_HASH8K_HASH_SIZE
|
||||
#define IGZIP_LVL2_HASH_SIZE IGZIP_HASH_HIST_SIZE
|
||||
#define IGZIP_LVL3_HASH_SIZE IGZIP_HASH_MAP_HASH_SIZE
|
||||
|
||||
#ifdef LONGER_HUFFTABLE
|
||||
enum {IGZIP_DIST_TABLE_SIZE = 8*1024};
|
||||
enum { IGZIP_DIST_TABLE_SIZE = 8 * 1024 };
|
||||
|
||||
/* DECODE_OFFSET is dist code index corresponding to DIST_TABLE_SIZE + 1 */
|
||||
enum { IGZIP_DECODE_OFFSET = 26 };
|
||||
#else
|
||||
enum {IGZIP_DIST_TABLE_SIZE = 2};
|
||||
enum { IGZIP_DIST_TABLE_SIZE = 2 };
|
||||
/* DECODE_OFFSET is dist code index corresponding to DIST_TABLE_SIZE + 1 */
|
||||
enum { IGZIP_DECODE_OFFSET = 0 };
|
||||
#endif
|
||||
enum {IGZIP_LEN_TABLE_SIZE = 256};
|
||||
enum {IGZIP_LIT_TABLE_SIZE = ISAL_DEF_LIT_SYMBOLS};
|
||||
enum { IGZIP_LEN_TABLE_SIZE = 256 };
|
||||
enum { IGZIP_LIT_TABLE_SIZE = ISAL_DEF_LIT_SYMBOLS };
|
||||
|
||||
#define IGZIP_HUFFTABLE_CUSTOM 0
|
||||
#define IGZIP_HUFFTABLE_CUSTOM 0
|
||||
#define IGZIP_HUFFTABLE_DEFAULT 1
|
||||
#define IGZIP_HUFFTABLE_STATIC 2
|
||||
#define IGZIP_HUFFTABLE_STATIC 2
|
||||
|
||||
/* Flush Flags */
|
||||
#define NO_FLUSH 0 /* Default */
|
||||
#define SYNC_FLUSH 1
|
||||
#define FULL_FLUSH 2
|
||||
#define FINISH_FLUSH 0 /* Deprecated */
|
||||
#define NO_FLUSH 0 /* Default */
|
||||
#define SYNC_FLUSH 1
|
||||
#define FULL_FLUSH 2
|
||||
#define FINISH_FLUSH 0 /* Deprecated */
|
||||
|
||||
/* Gzip Flags */
|
||||
#define IGZIP_DEFLATE 0 /* Default */
|
||||
#define IGZIP_GZIP 1
|
||||
#define IGZIP_GZIP_NO_HDR 2
|
||||
#define IGZIP_ZLIB 3
|
||||
#define IGZIP_ZLIB_NO_HDR 4
|
||||
#define IGZIP_DEFLATE 0 /* Default */
|
||||
#define IGZIP_GZIP 1
|
||||
#define IGZIP_GZIP_NO_HDR 2
|
||||
#define IGZIP_ZLIB 3
|
||||
#define IGZIP_ZLIB_NO_HDR 4
|
||||
|
||||
/* Compression Return values */
|
||||
#define COMP_OK 0
|
||||
#define INVALID_FLUSH -7
|
||||
#define INVALID_PARAM -8
|
||||
#define STATELESS_OVERFLOW -1
|
||||
#define COMP_OK 0
|
||||
#define INVALID_FLUSH -7
|
||||
#define INVALID_PARAM -8
|
||||
#define STATELESS_OVERFLOW -1
|
||||
#define ISAL_INVALID_OPERATION -9
|
||||
#define ISAL_INVALID_STATE -3
|
||||
#define ISAL_INVALID_LEVEL -4 /* Invalid Compression level set */
|
||||
#define ISAL_INVALID_STATE -3
|
||||
#define ISAL_INVALID_LEVEL -4 /* Invalid Compression level set */
|
||||
#define ISAL_INVALID_LEVEL_BUF -5 /* Invalid buffer specified for the compression level */
|
||||
|
||||
/**
|
||||
@@ -172,35 +172,34 @@ enum {IGZIP_LIT_TABLE_SIZE = ISAL_DEF_LIT_SYMBOLS};
|
||||
* @brief Compression State please note ZSTATE_TRL only applies for GZIP compression
|
||||
*/
|
||||
|
||||
|
||||
/* When the state is set to ZSTATE_NEW_HDR or TMP_ZSTATE_NEW_HEADER, the
|
||||
* hufftable being used for compression may be swapped
|
||||
*/
|
||||
enum isal_zstate_state {
|
||||
ZSTATE_NEW_HDR, //!< Header to be written
|
||||
ZSTATE_HDR, //!< Header state
|
||||
ZSTATE_CREATE_HDR, //!< Header to be created
|
||||
ZSTATE_BODY, //!< Body state
|
||||
ZSTATE_FLUSH_READ_BUFFER, //!< Flush buffer
|
||||
ZSTATE_FLUSH_ICF_BUFFER,
|
||||
ZSTATE_TYPE0_HDR, //! Type0 block header to be written
|
||||
ZSTATE_TYPE0_BODY, //!< Type0 block body to be written
|
||||
ZSTATE_SYNC_FLUSH, //!< Write sync flush block
|
||||
ZSTATE_FLUSH_WRITE_BUFFER, //!< Flush bitbuf
|
||||
ZSTATE_TRL, //!< Trailer state
|
||||
ZSTATE_END, //!< End state
|
||||
ZSTATE_TMP_NEW_HDR, //!< Temporary Header to be written
|
||||
ZSTATE_TMP_HDR, //!< Temporary Header state
|
||||
ZSTATE_TMP_CREATE_HDR, //!< Temporary Header to be created state
|
||||
ZSTATE_TMP_BODY, //!< Temporary Body state
|
||||
ZSTATE_TMP_FLUSH_READ_BUFFER, //!< Flush buffer
|
||||
ZSTATE_TMP_FLUSH_ICF_BUFFER,
|
||||
ZSTATE_TMP_TYPE0_HDR, //! Temporary Type0 block header to be written
|
||||
ZSTATE_TMP_TYPE0_BODY, //!< Temporary Type0 block body to be written
|
||||
ZSTATE_TMP_SYNC_FLUSH, //!< Write sync flush block
|
||||
ZSTATE_TMP_FLUSH_WRITE_BUFFER, //!< Flush bitbuf
|
||||
ZSTATE_TMP_TRL, //!< Temporary Trailer state
|
||||
ZSTATE_TMP_END //!< Temporary End state
|
||||
ZSTATE_NEW_HDR, //!< Header to be written
|
||||
ZSTATE_HDR, //!< Header state
|
||||
ZSTATE_CREATE_HDR, //!< Header to be created
|
||||
ZSTATE_BODY, //!< Body state
|
||||
ZSTATE_FLUSH_READ_BUFFER, //!< Flush buffer
|
||||
ZSTATE_FLUSH_ICF_BUFFER,
|
||||
ZSTATE_TYPE0_HDR, //! Type0 block header to be written
|
||||
ZSTATE_TYPE0_BODY, //!< Type0 block body to be written
|
||||
ZSTATE_SYNC_FLUSH, //!< Write sync flush block
|
||||
ZSTATE_FLUSH_WRITE_BUFFER, //!< Flush bitbuf
|
||||
ZSTATE_TRL, //!< Trailer state
|
||||
ZSTATE_END, //!< End state
|
||||
ZSTATE_TMP_NEW_HDR, //!< Temporary Header to be written
|
||||
ZSTATE_TMP_HDR, //!< Temporary Header state
|
||||
ZSTATE_TMP_CREATE_HDR, //!< Temporary Header to be created state
|
||||
ZSTATE_TMP_BODY, //!< Temporary Body state
|
||||
ZSTATE_TMP_FLUSH_READ_BUFFER, //!< Flush buffer
|
||||
ZSTATE_TMP_FLUSH_ICF_BUFFER,
|
||||
ZSTATE_TMP_TYPE0_HDR, //! Temporary Type0 block header to be written
|
||||
ZSTATE_TMP_TYPE0_BODY, //!< Temporary Type0 block body to be written
|
||||
ZSTATE_TMP_SYNC_FLUSH, //!< Write sync flush block
|
||||
ZSTATE_TMP_FLUSH_WRITE_BUFFER, //!< Flush bitbuf
|
||||
ZSTATE_TMP_TRL, //!< Temporary Trailer state
|
||||
ZSTATE_TMP_END //!< Temporary End state
|
||||
};
|
||||
|
||||
/* Offset used to switch between TMP states and non-tmp states */
|
||||
@@ -209,49 +208,49 @@ enum isal_zstate_state {
|
||||
/******************************************************************************/
|
||||
/* Inflate Implementation Specific Defines */
|
||||
/******************************************************************************/
|
||||
#define ISAL_DECODE_LONG_BITS 12
|
||||
#define ISAL_DECODE_LONG_BITS 12
|
||||
#define ISAL_DECODE_SHORT_BITS 10
|
||||
|
||||
/* Current state of decompression */
|
||||
enum isal_block_state {
|
||||
ISAL_BLOCK_NEW_HDR, /* Just starting a new block */
|
||||
ISAL_BLOCK_HDR, /* In the middle of reading in a block header */
|
||||
ISAL_BLOCK_TYPE0, /* Decoding a type 0 block */
|
||||
ISAL_BLOCK_CODED, /* Decoding a huffman coded block */
|
||||
ISAL_BLOCK_INPUT_DONE, /* Decompression of input is completed */
|
||||
ISAL_BLOCK_FINISH, /* Decompression of input is completed and all data has been flushed to output */
|
||||
ISAL_GZIP_EXTRA_LEN,
|
||||
ISAL_GZIP_EXTRA,
|
||||
ISAL_GZIP_NAME,
|
||||
ISAL_GZIP_COMMENT,
|
||||
ISAL_GZIP_HCRC,
|
||||
ISAL_ZLIB_DICT,
|
||||
ISAL_CHECKSUM_CHECK,
|
||||
ISAL_BLOCK_NEW_HDR, /* Just starting a new block */
|
||||
ISAL_BLOCK_HDR, /* In the middle of reading in a block header */
|
||||
ISAL_BLOCK_TYPE0, /* Decoding a type 0 block */
|
||||
ISAL_BLOCK_CODED, /* Decoding a huffman coded block */
|
||||
ISAL_BLOCK_INPUT_DONE, /* Decompression of input is completed */
|
||||
ISAL_BLOCK_FINISH, /* Decompression of input is completed and all data has been flushed to
|
||||
output */
|
||||
ISAL_GZIP_EXTRA_LEN,
|
||||
ISAL_GZIP_EXTRA,
|
||||
ISAL_GZIP_NAME,
|
||||
ISAL_GZIP_COMMENT,
|
||||
ISAL_GZIP_HCRC,
|
||||
ISAL_ZLIB_DICT,
|
||||
ISAL_CHECKSUM_CHECK,
|
||||
};
|
||||
|
||||
|
||||
/* Inflate Flags */
|
||||
#define ISAL_DEFLATE 0 /* Default */
|
||||
#define ISAL_GZIP 1
|
||||
#define ISAL_GZIP_NO_HDR 2
|
||||
#define ISAL_ZLIB 3
|
||||
#define ISAL_ZLIB_NO_HDR 4
|
||||
#define ISAL_ZLIB_NO_HDR_VER 5
|
||||
#define ISAL_GZIP_NO_HDR_VER 6
|
||||
#define ISAL_DEFLATE 0 /* Default */
|
||||
#define ISAL_GZIP 1
|
||||
#define ISAL_GZIP_NO_HDR 2
|
||||
#define ISAL_ZLIB 3
|
||||
#define ISAL_ZLIB_NO_HDR 4
|
||||
#define ISAL_ZLIB_NO_HDR_VER 5
|
||||
#define ISAL_GZIP_NO_HDR_VER 6
|
||||
|
||||
/* Inflate Return values */
|
||||
#define ISAL_DECOMP_OK 0 /* No errors encountered while decompressing */
|
||||
#define ISAL_END_INPUT 1 /* End of input reached */
|
||||
#define ISAL_OUT_OVERFLOW 2 /* End of output reached */
|
||||
#define ISAL_NAME_OVERFLOW 3 /* End of gzip name buffer reached */
|
||||
#define ISAL_COMMENT_OVERFLOW 4 /* End of gzip name buffer reached */
|
||||
#define ISAL_EXTRA_OVERFLOW 5 /* End of extra buffer reached */
|
||||
#define ISAL_NEED_DICT 6 /* Stream needs a dictionary to continue */
|
||||
#define ISAL_INVALID_BLOCK -1 /* Invalid deflate block found */
|
||||
#define ISAL_INVALID_SYMBOL -2 /* Invalid deflate symbol found */
|
||||
#define ISAL_INVALID_LOOKBACK -3 /* Invalid lookback distance found */
|
||||
#define ISAL_INVALID_WRAPPER -4 /* Invalid gzip/zlib wrapper found */
|
||||
#define ISAL_UNSUPPORTED_METHOD -5 /* Gzip/zlib wrapper specifies unsupported compress method */
|
||||
#define ISAL_DECOMP_OK 0 /* No errors encountered while decompressing */
|
||||
#define ISAL_END_INPUT 1 /* End of input reached */
|
||||
#define ISAL_OUT_OVERFLOW 2 /* End of output reached */
|
||||
#define ISAL_NAME_OVERFLOW 3 /* End of gzip name buffer reached */
|
||||
#define ISAL_COMMENT_OVERFLOW 4 /* End of gzip name buffer reached */
|
||||
#define ISAL_EXTRA_OVERFLOW 5 /* End of extra buffer reached */
|
||||
#define ISAL_NEED_DICT 6 /* Stream needs a dictionary to continue */
|
||||
#define ISAL_INVALID_BLOCK -1 /* Invalid deflate block found */
|
||||
#define ISAL_INVALID_SYMBOL -2 /* Invalid deflate symbol found */
|
||||
#define ISAL_INVALID_LOOKBACK -3 /* Invalid lookback distance found */
|
||||
#define ISAL_INVALID_WRAPPER -4 /* Invalid gzip/zlib wrapper found */
|
||||
#define ISAL_UNSUPPORTED_METHOD -5 /* Gzip/zlib wrapper specifies unsupported compress method */
|
||||
#define ISAL_INCORRECT_CHECKSUM -6 /* Incorrect checksum found */
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -259,15 +258,16 @@ enum isal_block_state {
|
||||
/******************************************************************************/
|
||||
/** @brief Holds histogram of deflate symbols*/
|
||||
struct isal_huff_histogram {
|
||||
uint64_t lit_len_histogram[ISAL_DEF_LIT_LEN_SYMBOLS]; //!< Histogram of Literal/Len symbols seen
|
||||
uint64_t dist_histogram[ISAL_DEF_DIST_SYMBOLS]; //!< Histogram of Distance Symbols seen
|
||||
uint16_t hash_table[IGZIP_LVL0_HASH_SIZE]; //!< Tmp space used as a hash table
|
||||
uint64_t lit_len_histogram[ISAL_DEF_LIT_LEN_SYMBOLS]; //!< Histogram of Literal/Len symbols
|
||||
//!< seen
|
||||
uint64_t dist_histogram[ISAL_DEF_DIST_SYMBOLS]; //!< Histogram of Distance Symbols seen
|
||||
uint16_t hash_table[IGZIP_LVL0_HASH_SIZE]; //!< Tmp space used as a hash table
|
||||
};
|
||||
|
||||
/** @brief Holds modified histogram */
|
||||
struct isal_mod_hist {
|
||||
uint32_t d_hist[30]; //!< Distance
|
||||
uint32_t ll_hist[513]; //! Literal/length
|
||||
uint32_t d_hist[30]; //!< Distance
|
||||
uint32_t ll_hist[513]; //! Literal/length
|
||||
};
|
||||
|
||||
#define ISAL_DEF_MIN_LEVEL 0
|
||||
@@ -275,80 +275,80 @@ 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 + 2 * IGZIP_LVL1_HASH_SIZE)
|
||||
#define ISAL_DEF_LVL0_REQ 0
|
||||
#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 + 2 * IGZIP_LVL2_HASH_SIZE)
|
||||
#define ISAL_DEF_LVL2_REQ (4 * IGZIP_K + 2 * IGZIP_LVL2_HASH_SIZE)
|
||||
#define ISAL_DEF_LVL2_TOKEN_SIZE 4
|
||||
#define ISAL_DEF_LVL3_REQ 4 * IGZIP_K + 4 * 4 * IGZIP_K + 2 * IGZIP_LVL3_HASH_SIZE
|
||||
#define ISAL_DEF_LVL3_REQ 4 * IGZIP_K + 4 * 4 * IGZIP_K + 2 * IGZIP_LVL3_HASH_SIZE
|
||||
#define ISAL_DEF_LVL3_TOKEN_SIZE 4
|
||||
|
||||
/* Data sizes for level specific data options */
|
||||
#define ISAL_DEF_LVL0_MIN ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_SMALL ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_MEDIUM ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_LARGE ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_MIN ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_SMALL ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_MEDIUM ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_LARGE ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_EXTRA_LARGE ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_DEFAULT ISAL_DEF_LVL0_REQ
|
||||
#define ISAL_DEF_LVL0_DEFAULT ISAL_DEF_LVL0_REQ
|
||||
|
||||
#define ISAL_DEF_LVL1_MIN (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_SMALL (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_MEDIUM (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_LARGE (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_MIN (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_SMALL (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_MEDIUM (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_LARGE (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_EXTRA_LARGE (ISAL_DEF_LVL1_REQ + ISAL_DEF_LVL1_TOKEN_SIZE * 128 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL1_DEFAULT ISAL_DEF_LVL1_LARGE
|
||||
#define ISAL_DEF_LVL1_DEFAULT ISAL_DEF_LVL1_LARGE
|
||||
|
||||
#define ISAL_DEF_LVL2_MIN (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_SMALL (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_MEDIUM (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_LARGE (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_MIN (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_SMALL (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_MEDIUM (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_LARGE (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_EXTRA_LARGE (ISAL_DEF_LVL2_REQ + ISAL_DEF_LVL2_TOKEN_SIZE * 128 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL2_DEFAULT ISAL_DEF_LVL2_LARGE
|
||||
#define ISAL_DEF_LVL2_DEFAULT ISAL_DEF_LVL2_LARGE
|
||||
|
||||
#define ISAL_DEF_LVL3_MIN (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_SMALL (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_MEDIUM (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_LARGE (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_MIN (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 1 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_SMALL (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 16 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_MEDIUM (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 32 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_LARGE (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 64 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_EXTRA_LARGE (ISAL_DEF_LVL3_REQ + ISAL_DEF_LVL3_TOKEN_SIZE * 128 * IGZIP_K)
|
||||
#define ISAL_DEF_LVL3_DEFAULT ISAL_DEF_LVL3_LARGE
|
||||
#define ISAL_DEF_LVL3_DEFAULT ISAL_DEF_LVL3_LARGE
|
||||
|
||||
#define IGZIP_NO_HIST 0
|
||||
#define IGZIP_HIST 1
|
||||
#define IGZIP_DICT_HIST 2
|
||||
#define IGZIP_NO_HIST 0
|
||||
#define IGZIP_HIST 1
|
||||
#define IGZIP_DICT_HIST 2
|
||||
#define IGZIP_DICT_HASH_SET 3
|
||||
|
||||
/** @brief Holds Bit Buffer information*/
|
||||
struct BitBuf2 {
|
||||
uint64_t m_bits; //!< bits in the bit buffer
|
||||
uint32_t m_bit_count; //!< number of valid bits in the bit buffer
|
||||
uint8_t *m_out_buf; //!< current index of buffer to write to
|
||||
uint8_t *m_out_end; //!< end of buffer to write to
|
||||
uint8_t *m_out_start; //!< start of buffer to write to
|
||||
uint64_t m_bits; //!< bits in the bit buffer
|
||||
uint32_t m_bit_count; //!< number of valid bits in the bit buffer
|
||||
uint8_t *m_out_buf; //!< current index of buffer to write to
|
||||
uint8_t *m_out_end; //!< end of buffer to write to
|
||||
uint8_t *m_out_start; //!< start of buffer to write to
|
||||
};
|
||||
|
||||
/** @brief Holds Zlib header information */
|
||||
struct isal_zlib_header {
|
||||
uint32_t info; //!< base-2 logarithm of the LZ77 window size minus 8
|
||||
uint32_t level; //!< Compression level (fastest, fast, default, maximum)
|
||||
uint32_t dict_id; //!< Dictionary id
|
||||
uint32_t dict_flag; //!< Whether to use a dictionary
|
||||
uint32_t info; //!< base-2 logarithm of the LZ77 window size minus 8
|
||||
uint32_t level; //!< Compression level (fastest, fast, default, maximum)
|
||||
uint32_t dict_id; //!< Dictionary id
|
||||
uint32_t dict_flag; //!< Whether to use a dictionary
|
||||
};
|
||||
|
||||
/** @brief Holds Gzip header information */
|
||||
struct isal_gzip_header {
|
||||
uint32_t text; //!< Optional Text hint
|
||||
uint32_t time; //!< Unix modification time in gzip header
|
||||
uint32_t xflags; //!< xflags in gzip header
|
||||
uint32_t os; //!< OS in gzip header
|
||||
uint8_t *extra; //!< Extra field in gzip header
|
||||
uint32_t extra_buf_len; //!< Length of extra buffer
|
||||
uint32_t extra_len; //!< Actual length of gzip header extra field
|
||||
char *name; //!< Name in gzip header
|
||||
uint32_t name_buf_len; //!< Length of name buffer
|
||||
char *comment; //!< Comments in gzip header
|
||||
uint32_t comment_buf_len; //!< Length of comment buffer
|
||||
uint32_t hcrc; //!< Header crc or header crc flag
|
||||
uint32_t flags; //!< Internal data
|
||||
uint32_t text; //!< Optional Text hint
|
||||
uint32_t time; //!< Unix modification time in gzip header
|
||||
uint32_t xflags; //!< xflags in gzip header
|
||||
uint32_t os; //!< OS in gzip header
|
||||
uint8_t *extra; //!< Extra field in gzip header
|
||||
uint32_t extra_buf_len; //!< Length of extra buffer
|
||||
uint32_t extra_len; //!< Actual length of gzip header extra field
|
||||
char *name; //!< Name in gzip header
|
||||
uint32_t name_buf_len; //!< Length of name buffer
|
||||
char *comment; //!< Comments in gzip header
|
||||
uint32_t comment_buf_len; //!< Length of comment buffer
|
||||
uint32_t hcrc; //!< Header crc or header crc flag
|
||||
uint32_t flags; //!< Internal data
|
||||
};
|
||||
|
||||
/* Variable prefixes:
|
||||
@@ -358,65 +358,67 @@ struct isal_gzip_header {
|
||||
|
||||
/** @brief Holds the internal state information for input and output compression streams*/
|
||||
struct isal_zstate {
|
||||
uint32_t total_in_start; //!< Not used, may be replaced with something else
|
||||
uint32_t block_next; //!< Start of current deflate block in the input
|
||||
uint32_t block_end; //!< End of current deflate block in the input
|
||||
uint32_t dist_mask; //!< Distance mask used.
|
||||
uint32_t hash_mask;
|
||||
enum isal_zstate_state state; //!< Current state in processing the data stream
|
||||
struct BitBuf2 bitbuf; //!< Bit Buffer
|
||||
uint32_t crc; //!< Current checksum without finalize step if any (adler)
|
||||
uint8_t has_wrap_hdr; //!< keeps track of wrapper header
|
||||
uint8_t has_eob_hdr; //!< keeps track of eob hdr (with BFINAL set)
|
||||
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.
|
||||
uint32_t count; //!< used for partial header/trailer writes
|
||||
uint8_t tmp_out_buff[16]; //!< temporary array
|
||||
uint32_t tmp_out_start; //!< temporary variable
|
||||
uint32_t tmp_out_end; //!< temporary variable
|
||||
uint32_t b_bytes_valid; //!< number of valid bytes in buffer
|
||||
uint32_t b_bytes_processed; //!< number of bytes processed in buffer
|
||||
uint8_t buffer[2 * IGZIP_HIST_SIZE + ISAL_LOOK_AHEAD]; //!< Internal buffer
|
||||
uint32_t total_in_start; //!< Not used, may be replaced with something else
|
||||
uint32_t block_next; //!< Start of current deflate block in the input
|
||||
uint32_t block_end; //!< End of current deflate block in the input
|
||||
uint32_t dist_mask; //!< Distance mask used.
|
||||
uint32_t hash_mask;
|
||||
enum isal_zstate_state state; //!< Current state in processing the data stream
|
||||
struct BitBuf2 bitbuf; //!< Bit Buffer
|
||||
uint32_t crc; //!< Current checksum without finalize step if any (adler)
|
||||
uint8_t has_wrap_hdr; //!< keeps track of wrapper header
|
||||
uint8_t has_eob_hdr; //!< keeps track of eob hdr (with BFINAL set)
|
||||
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.
|
||||
uint32_t count; //!< used for partial header/trailer writes
|
||||
uint8_t tmp_out_buff[16]; //!< temporary array
|
||||
uint32_t tmp_out_start; //!< temporary variable
|
||||
uint32_t tmp_out_end; //!< temporary variable
|
||||
uint32_t b_bytes_valid; //!< number of valid bytes in buffer
|
||||
uint32_t b_bytes_processed; //!< number of bytes processed in buffer
|
||||
uint8_t buffer[2 * IGZIP_HIST_SIZE + ISAL_LOOK_AHEAD]; //!< Internal buffer
|
||||
|
||||
/* Stream should be setup such that the head is cache aligned*/
|
||||
uint16_t head[IGZIP_LVL0_HASH_SIZE]; //!< Hash array
|
||||
/* Stream should be setup such that the head is cache aligned*/
|
||||
uint16_t head[IGZIP_LVL0_HASH_SIZE]; //!< Hash array
|
||||
};
|
||||
|
||||
/** @brief Holds the huffman tree used to huffman encode the input stream **/
|
||||
struct isal_hufftables {
|
||||
|
||||
uint8_t deflate_hdr[ISAL_DEF_MAX_HDR_SIZE]; //!< deflate huffman tree header
|
||||
uint32_t deflate_hdr_count; //!< Number of whole bytes in deflate_huff_hdr
|
||||
uint32_t deflate_hdr_extra_bits; //!< Number of bits in the partial byte in header
|
||||
uint32_t dist_table[IGZIP_DIST_TABLE_SIZE]; //!< bits 4:0 are the code length, bits 31:5 are the code
|
||||
uint32_t len_table[IGZIP_LEN_TABLE_SIZE]; //!< bits 4:0 are the code length, bits 31:5 are the code
|
||||
uint16_t lit_table[IGZIP_LIT_TABLE_SIZE]; //!< literal code
|
||||
uint8_t lit_table_sizes[IGZIP_LIT_TABLE_SIZE]; //!< literal code length
|
||||
uint16_t dcodes[30 - IGZIP_DECODE_OFFSET]; //!< distance code
|
||||
uint8_t dcodes_sizes[30 - IGZIP_DECODE_OFFSET]; //!< distance code length
|
||||
|
||||
uint8_t deflate_hdr[ISAL_DEF_MAX_HDR_SIZE]; //!< deflate huffman tree header
|
||||
uint32_t deflate_hdr_count; //!< Number of whole bytes in deflate_huff_hdr
|
||||
uint32_t deflate_hdr_extra_bits; //!< Number of bits in the partial byte in header
|
||||
uint32_t dist_table[IGZIP_DIST_TABLE_SIZE]; //!< bits 4:0 are the code length, bits 31:5 are
|
||||
//!< the code
|
||||
uint32_t len_table[IGZIP_LEN_TABLE_SIZE]; //!< bits 4:0 are the code length, bits 31:5 are
|
||||
//!< the code
|
||||
uint16_t lit_table[IGZIP_LIT_TABLE_SIZE]; //!< literal code
|
||||
uint8_t lit_table_sizes[IGZIP_LIT_TABLE_SIZE]; //!< literal code length
|
||||
uint16_t dcodes[30 - IGZIP_DECODE_OFFSET]; //!< distance code
|
||||
uint8_t dcodes_sizes[30 - IGZIP_DECODE_OFFSET]; //!< distance code length
|
||||
};
|
||||
|
||||
/** @brief Holds stream information*/
|
||||
struct isal_zstream {
|
||||
uint8_t *next_in; //!< Next input byte
|
||||
uint32_t avail_in; //!< number of bytes available at next_in
|
||||
uint32_t total_in; //!< total number of bytes read so far
|
||||
uint8_t *next_in; //!< Next input byte
|
||||
uint32_t avail_in; //!< number of bytes available at next_in
|
||||
uint32_t total_in; //!< total number of bytes read so far
|
||||
|
||||
uint8_t *next_out; //!< Next output byte
|
||||
uint32_t avail_out; //!< number of bytes available at next_out
|
||||
uint32_t total_out; //!< total number of bytes written so far
|
||||
uint8_t *next_out; //!< Next output byte
|
||||
uint32_t avail_out; //!< number of bytes available at next_out
|
||||
uint32_t total_out; //!< total number of bytes written so far
|
||||
|
||||
struct isal_hufftables *hufftables; //!< Huffman encoding used when compressing
|
||||
uint32_t level; //!< Compression level to use
|
||||
uint32_t level_buf_size; //!< Size of level_buf
|
||||
uint8_t * level_buf; //!< User allocated buffer required for different compression levels
|
||||
uint16_t end_of_stream; //!< non-zero if this is the last input buffer
|
||||
uint16_t flush; //!< Flush type can be NO_FLUSH, SYNC_FLUSH or FULL_FLUSH
|
||||
uint16_t gzip_flag; //!< Indicate if gzip compression is to be performed
|
||||
uint16_t hist_bits; //!< Log base 2 of maximum lookback distance, 0 is use default
|
||||
struct isal_zstate internal_state; //!< Internal state for this stream
|
||||
struct isal_hufftables *hufftables; //!< Huffman encoding used when compressing
|
||||
uint32_t level; //!< Compression level to use
|
||||
uint32_t level_buf_size; //!< Size of level_buf
|
||||
uint8_t *level_buf; //!< User allocated buffer required for different compression levels
|
||||
uint16_t end_of_stream; //!< non-zero if this is the last input buffer
|
||||
uint16_t flush; //!< Flush type can be NO_FLUSH, SYNC_FLUSH or FULL_FLUSH
|
||||
uint16_t gzip_flag; //!< Indicate if gzip compression is to be performed
|
||||
uint16_t hist_bits; //!< Log base 2 of maximum lookback distance, 0 is use default
|
||||
struct isal_zstate internal_state; //!< Internal state for this stream
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -482,8 +484,10 @@ struct isal_zstream {
|
||||
#define ISAL_L_DUP ((1 << ISAL_L_REM) - (ISAL_L_REM + 1))
|
||||
#define ISAL_S_DUP ((1 << ISAL_S_REM) - (ISAL_S_REM + 1))
|
||||
|
||||
#define ISAL_L_UNUSED ((1 << ISAL_L_REM) - (1 << ((ISAL_L_REM)/2)) - (1 << ((ISAL_L_REM + 1)/2)) + 1)
|
||||
#define ISAL_S_UNUSED ((1 << ISAL_S_REM) - (1 << ((ISAL_S_REM)/2)) - (1 << ((ISAL_S_REM + 1)/2)) + 1)
|
||||
#define ISAL_L_UNUSED \
|
||||
((1 << ISAL_L_REM) - (1 << ((ISAL_L_REM) / 2)) - (1 << ((ISAL_L_REM + 1) / 2)) + 1)
|
||||
#define ISAL_S_UNUSED \
|
||||
((1 << ISAL_S_REM) - (1 << ((ISAL_S_REM) / 2)) - (1 << ((ISAL_S_REM + 1) / 2)) + 1)
|
||||
|
||||
#define ISAL_L_SIZE (ISAL_DEF_LIT_LEN_SYMBOLS + ISAL_L_DUP + ISAL_L_UNUSED)
|
||||
#define ISAL_S_SIZE (ISAL_DEF_DIST_SYMBOLS + ISAL_S_DUP + ISAL_S_UNUSED)
|
||||
@@ -493,48 +497,52 @@ struct isal_zstream {
|
||||
|
||||
/** @brief Large lookup table for decoding huffman codes */
|
||||
struct inflate_huff_code_large {
|
||||
uint32_t short_code_lookup[1 << (ISAL_DECODE_LONG_BITS)]; //!< Short code lookup table
|
||||
uint16_t long_code_lookup[ISAL_HUFF_CODE_LARGE_LONG_ALIGNED]; //!< Long code lookup table
|
||||
uint32_t short_code_lookup[1 << (ISAL_DECODE_LONG_BITS)]; //!< Short code lookup table
|
||||
uint16_t long_code_lookup[ISAL_HUFF_CODE_LARGE_LONG_ALIGNED]; //!< Long code lookup table
|
||||
};
|
||||
|
||||
/** @brief Small lookup table for decoding huffman codes */
|
||||
struct inflate_huff_code_small {
|
||||
uint16_t short_code_lookup[1 << (ISAL_DECODE_SHORT_BITS)]; //!<Short code lookup table
|
||||
uint16_t long_code_lookup[ISAL_HUFF_CODE_SMALL_LONG_ALIGNED]; //!< Long code lookup table
|
||||
uint16_t short_code_lookup[1 << (ISAL_DECODE_SHORT_BITS)]; //!< Short code lookup table
|
||||
uint16_t long_code_lookup[ISAL_HUFF_CODE_SMALL_LONG_ALIGNED]; //!< Long code lookup table
|
||||
};
|
||||
|
||||
/** @brief Holds decompression state information*/
|
||||
struct inflate_state {
|
||||
uint8_t *next_out; //!< Next output Byte
|
||||
uint32_t avail_out; //!< Number of bytes available at next_out
|
||||
uint32_t total_out; //!< Total bytes written out so far
|
||||
uint8_t *next_in; //!< Next input byte
|
||||
uint64_t read_in; //!< Bits buffered to handle unaligned streams
|
||||
uint32_t avail_in; //!< Number of bytes available at next_in
|
||||
int32_t read_in_length; //!< Bits in read_in
|
||||
struct inflate_huff_code_large lit_huff_code; //!< Structure for decoding lit/len symbols
|
||||
struct inflate_huff_code_small dist_huff_code; //!< Structure for decoding dist symbols
|
||||
enum isal_block_state block_state; //!< Current decompression state
|
||||
uint32_t dict_length; //!< Length of dictionary used
|
||||
uint32_t bfinal; //!< Flag identifying final block
|
||||
uint32_t crc_flag; //!< Flag identifying whether to track of crc
|
||||
uint32_t crc; //!< Contains crc or adler32 of output if crc_flag is set
|
||||
uint32_t hist_bits; //!< Log base 2 of maximum lookback distance
|
||||
union {
|
||||
int32_t type0_block_len; //!< Length left to read of type 0 block when outbuffer overflow occurred
|
||||
int32_t count; //!< Count of bytes remaining to be parsed
|
||||
uint32_t dict_id;
|
||||
};
|
||||
int32_t write_overflow_lits;
|
||||
int32_t write_overflow_len;
|
||||
int32_t copy_overflow_length; //!< Length left to copy when outbuffer overflow occurred
|
||||
int32_t copy_overflow_distance; //!< Lookback distance when outbuffer overflow occurred
|
||||
int16_t wrapper_flag;
|
||||
int16_t tmp_in_size; //!< Number of bytes in tmp_in_buffer
|
||||
int32_t tmp_out_valid; //!< Number of bytes in tmp_out_buffer
|
||||
int32_t tmp_out_processed; //!< Number of bytes processed in tmp_out_buffer
|
||||
uint8_t tmp_in_buffer[ISAL_DEF_MAX_HDR_SIZE]; //!< Temporary buffer containing data from the input stream
|
||||
uint8_t tmp_out_buffer[2 * ISAL_DEF_HIST_SIZE + ISAL_LOOK_AHEAD]; //!< Temporary buffer containing data from the output stream
|
||||
uint8_t *next_out; //!< Next output Byte
|
||||
uint32_t avail_out; //!< Number of bytes available at next_out
|
||||
uint32_t total_out; //!< Total bytes written out so far
|
||||
uint8_t *next_in; //!< Next input byte
|
||||
uint64_t read_in; //!< Bits buffered to handle unaligned streams
|
||||
uint32_t avail_in; //!< Number of bytes available at next_in
|
||||
int32_t read_in_length; //!< Bits in read_in
|
||||
struct inflate_huff_code_large lit_huff_code; //!< Structure for decoding lit/len symbols
|
||||
struct inflate_huff_code_small dist_huff_code; //!< Structure for decoding dist symbols
|
||||
enum isal_block_state block_state; //!< Current decompression state
|
||||
uint32_t dict_length; //!< Length of dictionary used
|
||||
uint32_t bfinal; //!< Flag identifying final block
|
||||
uint32_t crc_flag; //!< Flag identifying whether to track of crc
|
||||
uint32_t crc; //!< Contains crc or adler32 of output if crc_flag is set
|
||||
uint32_t hist_bits; //!< Log base 2 of maximum lookback distance
|
||||
union {
|
||||
int32_t type0_block_len; //!< Length left to read of type 0 block when outbuffer
|
||||
//!< overflow occurred
|
||||
int32_t count; //!< Count of bytes remaining to be parsed
|
||||
uint32_t dict_id;
|
||||
};
|
||||
int32_t write_overflow_lits;
|
||||
int32_t write_overflow_len;
|
||||
int32_t copy_overflow_length; //!< Length left to copy when outbuffer overflow occurred
|
||||
int32_t copy_overflow_distance; //!< Lookback distance when outbuffer overflow occurred
|
||||
int16_t wrapper_flag;
|
||||
int16_t tmp_in_size; //!< Number of bytes in tmp_in_buffer
|
||||
int32_t tmp_out_valid; //!< Number of bytes in tmp_out_buffer
|
||||
int32_t tmp_out_processed; //!< Number of bytes processed in tmp_out_buffer
|
||||
uint8_t tmp_in_buffer[ISAL_DEF_MAX_HDR_SIZE]; //!< Temporary buffer containing data from the
|
||||
//!< input stream
|
||||
uint8_t tmp_out_buffer[2 * ISAL_DEF_HIST_SIZE +
|
||||
ISAL_LOOK_AHEAD]; //!< Temporary buffer containing data from the
|
||||
//!< output stream
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -551,8 +559,8 @@ struct inflate_state {
|
||||
* @param length: The length of start_stream.
|
||||
* @param histogram: The returned histogram of lit/len/dist symbols.
|
||||
*/
|
||||
void isal_update_histogram(uint8_t * in_stream, int length, struct isal_huff_histogram * histogram);
|
||||
|
||||
void
|
||||
isal_update_histogram(uint8_t *in_stream, int length, struct isal_huff_histogram *histogram);
|
||||
|
||||
/**
|
||||
* @brief Creates a custom huffman code for the given histograms in which
|
||||
@@ -564,8 +572,8 @@ void isal_update_histogram(uint8_t * in_stream, int length, struct isal_huff_his
|
||||
* repeat lengths and lookback distances
|
||||
* @returns Returns a non zero value if an invalid huffman code was created.
|
||||
*/
|
||||
int isal_create_hufftables(struct isal_hufftables * hufftables,
|
||||
struct isal_huff_histogram * histogram);
|
||||
int
|
||||
isal_create_hufftables(struct isal_hufftables *hufftables, struct isal_huff_histogram *histogram);
|
||||
|
||||
/**
|
||||
* @brief Creates a custom huffman code for the given histograms like
|
||||
@@ -577,8 +585,9 @@ int isal_create_hufftables(struct isal_hufftables * hufftables,
|
||||
* repeat lengths and lookback distances
|
||||
* @returns Returns a non zero value if an invalid huffman code was created.
|
||||
*/
|
||||
int isal_create_hufftables_subset(struct isal_hufftables * hufftables,
|
||||
struct isal_huff_histogram * histogram);
|
||||
int
|
||||
isal_create_hufftables_subset(struct isal_hufftables *hufftables,
|
||||
struct isal_huff_histogram *histogram);
|
||||
|
||||
/**
|
||||
* @brief Initialize compression stream data structure
|
||||
@@ -586,7 +595,8 @@ int isal_create_hufftables_subset(struct isal_hufftables * hufftables,
|
||||
* @param stream Structure holding state information on the compression streams.
|
||||
* @returns none
|
||||
*/
|
||||
void isal_deflate_init(struct isal_zstream *stream);
|
||||
void
|
||||
isal_deflate_init(struct isal_zstream *stream);
|
||||
|
||||
/**
|
||||
* @brief Reinitialize compression stream data structure. Performs the same
|
||||
@@ -597,22 +607,24 @@ void isal_deflate_init(struct isal_zstream *stream);
|
||||
* @param stream Structure holding state information on the compression streams.
|
||||
* @returns none
|
||||
*/
|
||||
void isal_deflate_reset(struct isal_zstream *stream);
|
||||
|
||||
void
|
||||
isal_deflate_reset(struct isal_zstream *stream);
|
||||
|
||||
/**
|
||||
* @brief Set gzip header default values
|
||||
*
|
||||
* @param gz_hdr: Gzip header to initialize.
|
||||
*/
|
||||
void isal_gzip_header_init(struct isal_gzip_header *gz_hdr);
|
||||
void
|
||||
isal_gzip_header_init(struct isal_gzip_header *gz_hdr);
|
||||
|
||||
/**
|
||||
* @brief Set zlib header default values
|
||||
*
|
||||
* @param z_hdr: zlib header to initialize.
|
||||
*/
|
||||
void isal_zlib_header_init(struct isal_zlib_header *z_hdr);
|
||||
void
|
||||
isal_zlib_header_init(struct isal_zlib_header *z_hdr);
|
||||
|
||||
/**
|
||||
* @brief Write gzip header to output stream
|
||||
@@ -629,7 +641,8 @@ void isal_zlib_header_init(struct isal_zlib_header *z_hdr);
|
||||
* the minimum size required to successfully write the gzip header to the output
|
||||
* buffer.
|
||||
*/
|
||||
uint32_t isal_write_gzip_header(struct isal_zstream * stream, struct isal_gzip_header *gz_hdr);
|
||||
uint32_t
|
||||
isal_write_gzip_header(struct isal_zstream *stream, struct isal_gzip_header *gz_hdr);
|
||||
|
||||
/**
|
||||
* @brief Write zlib header to output stream
|
||||
@@ -646,7 +659,8 @@ uint32_t isal_write_gzip_header(struct isal_zstream * stream, struct isal_gzip_h
|
||||
* the minimum size required to successfully write the zlib header to the output
|
||||
* buffer.
|
||||
*/
|
||||
uint32_t isal_write_zlib_header(struct isal_zstream * stream, struct isal_zlib_header *z_hdr);
|
||||
uint32_t
|
||||
isal_write_zlib_header(struct isal_zstream *stream, struct isal_zlib_header *z_hdr);
|
||||
|
||||
/**
|
||||
* @brief Set stream to use a new Huffman code
|
||||
@@ -668,8 +682,9 @@ uint32_t isal_write_zlib_header(struct isal_zstream * stream, struct isal_zlib_h
|
||||
* due to the stream being in a state where changing the huffman code is not
|
||||
* allowed or an invalid input is provided.
|
||||
*/
|
||||
int isal_deflate_set_hufftables(struct isal_zstream *stream,
|
||||
struct isal_hufftables *hufftables, int type);
|
||||
int
|
||||
isal_deflate_set_hufftables(struct isal_zstream *stream, struct isal_hufftables *hufftables,
|
||||
int type);
|
||||
|
||||
/**
|
||||
* @brief Initialize compression stream data structure
|
||||
@@ -677,8 +692,8 @@ int isal_deflate_set_hufftables(struct isal_zstream *stream,
|
||||
* @param stream Structure holding state information on the compression streams.
|
||||
* @returns none
|
||||
*/
|
||||
void isal_deflate_stateless_init(struct isal_zstream *stream);
|
||||
|
||||
void
|
||||
isal_deflate_stateless_init(struct isal_zstream *stream);
|
||||
|
||||
/**
|
||||
* @brief Set compression dictionary to use
|
||||
@@ -694,17 +709,18 @@ void isal_deflate_stateless_init(struct isal_zstream *stream);
|
||||
* @returns COMP_OK,
|
||||
* ISAL_INVALID_STATE (dictionary could not be set)
|
||||
*/
|
||||
int isal_deflate_set_dict(struct isal_zstream *stream, uint8_t *dict, uint32_t dict_len);
|
||||
int
|
||||
isal_deflate_set_dict(struct isal_zstream *stream, uint8_t *dict, uint32_t dict_len);
|
||||
|
||||
/** @brief Structure for holding processed dictionary information */
|
||||
|
||||
struct isal_dict {
|
||||
uint32_t params;
|
||||
uint32_t level;
|
||||
uint32_t hist_size;
|
||||
uint32_t hash_size;
|
||||
uint8_t history[ISAL_DEF_HIST_SIZE];
|
||||
uint16_t hashtable[IGZIP_LVL3_HASH_SIZE];
|
||||
uint32_t params;
|
||||
uint32_t level;
|
||||
uint32_t hist_size;
|
||||
uint32_t hash_size;
|
||||
uint8_t history[ISAL_DEF_HIST_SIZE];
|
||||
uint16_t hashtable[IGZIP_LVL3_HASH_SIZE];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -725,8 +741,9 @@ struct isal_dict {
|
||||
* @returns COMP_OK,
|
||||
* ISAL_INVALID_STATE (dictionary could not be processed)
|
||||
*/
|
||||
int isal_deflate_process_dict(struct isal_zstream *stream, struct isal_dict *dict_str,
|
||||
uint8_t *dict, uint32_t dict_len);
|
||||
int
|
||||
isal_deflate_process_dict(struct isal_zstream *stream, struct isal_dict *dict_str, uint8_t *dict,
|
||||
uint32_t dict_len);
|
||||
|
||||
/**
|
||||
* @brief Reset compression dictionary to use
|
||||
@@ -745,8 +762,8 @@ int isal_deflate_process_dict(struct isal_zstream *stream, struct isal_dict *dic
|
||||
* @returns COMP_OK,
|
||||
* ISAL_INVALID_STATE or other (dictionary could not be reset)
|
||||
*/
|
||||
int isal_deflate_reset_dict(struct isal_zstream *stream, struct isal_dict *dict_str);
|
||||
|
||||
int
|
||||
isal_deflate_reset_dict(struct isal_zstream *stream, struct isal_dict *dict_str);
|
||||
|
||||
/**
|
||||
* @brief Fast data (deflate) compression for storage applications.
|
||||
@@ -802,8 +819,8 @@ int isal_deflate_reset_dict(struct isal_zstream *stream, struct isal_dict *dict_
|
||||
* ISAL_INVALID_LEVEL (if an invalid compression level is selected),
|
||||
* ISAL_INVALID_LEVEL_BUF (if the level buffer is not large enough).
|
||||
*/
|
||||
int isal_deflate(struct isal_zstream *stream);
|
||||
|
||||
int
|
||||
isal_deflate(struct isal_zstream *stream);
|
||||
|
||||
/**
|
||||
* @brief Fast data (deflate) stateless compression for storage applications.
|
||||
@@ -832,8 +849,8 @@ int isal_deflate(struct isal_zstream *stream);
|
||||
* ISAL_INVALID_LEVEL_BUF (if the level buffer is not large enough),
|
||||
* STATELESS_OVERFLOW (if output buffer will not fit output).
|
||||
*/
|
||||
int isal_deflate_stateless(struct isal_zstream *stream);
|
||||
|
||||
int
|
||||
isal_deflate_stateless(struct isal_zstream *stream);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Inflate functions */
|
||||
@@ -844,7 +861,8 @@ int isal_deflate_stateless(struct isal_zstream *stream);
|
||||
* @param state Structure holding state information on the compression streams.
|
||||
* @returns none
|
||||
*/
|
||||
void isal_inflate_init(struct inflate_state *state);
|
||||
void
|
||||
isal_inflate_init(struct inflate_state *state);
|
||||
|
||||
/**
|
||||
* @brief Reinitialize decompression state data structure
|
||||
@@ -852,7 +870,8 @@ void isal_inflate_init(struct inflate_state *state);
|
||||
* @param state Structure holding state information on the compression streams.
|
||||
* @returns none
|
||||
*/
|
||||
void isal_inflate_reset(struct inflate_state *state);
|
||||
void
|
||||
isal_inflate_reset(struct inflate_state *state);
|
||||
|
||||
/**
|
||||
* @brief Set decompression dictionary to use
|
||||
@@ -867,7 +886,8 @@ void isal_inflate_reset(struct inflate_state *state);
|
||||
* @returns COMP_OK,
|
||||
* ISAL_INVALID_STATE (dictionary could not be set)
|
||||
*/
|
||||
int isal_inflate_set_dict(struct inflate_state *state, uint8_t *dict, uint32_t dict_len);
|
||||
int
|
||||
isal_inflate_set_dict(struct inflate_state *state, uint8_t *dict, uint32_t dict_len);
|
||||
|
||||
/**
|
||||
* @brief Read and return gzip header information
|
||||
@@ -890,7 +910,8 @@ int isal_inflate_set_dict(struct inflate_state *state, uint8_t *dict, uint32_t d
|
||||
* ISAL_UNSUPPORTED_METHOD (deflate is not the compression method),
|
||||
* ISAL_INCORRECT_CHECKSUM (gzip header checksum was incorrect)
|
||||
*/
|
||||
int isal_read_gzip_header (struct inflate_state *state, struct isal_gzip_header *gz_hdr);
|
||||
int
|
||||
isal_read_gzip_header(struct inflate_state *state, struct isal_gzip_header *gz_hdr);
|
||||
|
||||
/**
|
||||
* @brief Read and return zlib header information
|
||||
@@ -905,7 +926,8 @@ int isal_read_gzip_header (struct inflate_state *state, struct isal_gzip_header
|
||||
* ISAL_UNSUPPORTED_METHOD (deflate is not the compression method),
|
||||
* ISAL_INCORRECT_CHECKSUM (zlib header checksum was incorrect)
|
||||
*/
|
||||
int isal_read_zlib_header (struct inflate_state *state, struct isal_zlib_header *zlib_hdr);
|
||||
int
|
||||
isal_read_zlib_header(struct inflate_state *state, struct isal_zlib_header *zlib_hdr);
|
||||
|
||||
/**
|
||||
* @brief Fast data (deflate) decompression for storage applications.
|
||||
@@ -953,7 +975,8 @@ int isal_read_zlib_header (struct inflate_state *state, struct isal_zlib_header
|
||||
* ISAL_INCORRECT_CHECKSUM.
|
||||
*/
|
||||
|
||||
int isal_inflate(struct inflate_state *state);
|
||||
int
|
||||
isal_inflate(struct inflate_state *state);
|
||||
|
||||
/**
|
||||
* @brief Fast data (deflate) stateless decompression for storage applications.
|
||||
@@ -975,7 +998,8 @@ int isal_inflate(struct inflate_state *state);
|
||||
* ISAL_UNSUPPORTED_METHOD,
|
||||
* ISAL_INCORRECT_CHECKSUM.
|
||||
*/
|
||||
int isal_inflate_stateless(struct inflate_state *state);
|
||||
int
|
||||
isal_inflate_stateless(struct inflate_state *state);
|
||||
|
||||
/******************************************************************************/
|
||||
/* Other functions */
|
||||
@@ -992,9 +1016,10 @@ int isal_inflate_stateless(struct inflate_state *state);
|
||||
*
|
||||
* @returns 32-bit Adler-32 checksum
|
||||
*/
|
||||
uint32_t isal_adler32(uint32_t init, const unsigned char *buf, uint64_t len);
|
||||
uint32_t
|
||||
isal_adler32(uint32_t init, const unsigned char *buf, uint64_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ifndef _IGZIP_H */
|
||||
#endif /* ifndef _IGZIP_H */
|
||||
|
||||
Reference in New Issue
Block a user