Turnstone Operating System
|
deflate implementation More...
Classes | |
struct | deflate_match_t |
struct | deflate_hashtable_t |
struct | bit_buffer_t |
struct | huffman_decode_table_t |
struct | huffman_encode_table_t |
struct | huffman_encode_freq_t |
struct | huffman_symbol_freq_t |
struct | huffman_bit_level_info_t |
Typedefs | |
typedef struct deflate_match_t | deflate_match_t |
typedef struct deflate_hashtable_t | deflate_hashtable_t |
typedef struct bit_buffer_t | bit_buffer_t |
typedef struct huffman_decode_table_t | huffman_decode_table_t |
typedef struct huffman_encode_table_t | huffman_encode_table_t |
typedef struct huffman_encode_freq_t | huffman_encode_freq_t |
typedef struct huffman_symbol_freq_t | huffman_symbol_freq_t |
typedef struct huffman_bit_level_info_t | huffman_bit_level_info_t |
Functions | |
MODULE ("turnstone.lib") | |
_Static_assert (sizeof(huffman_length_base)/sizeof(huffman_length_base[0])==29, "huffman_length_base must have 29 elements") | |
_Static_assert (sizeof(huffman_length_extra_bits)/sizeof(huffman_length_extra_bits[0])==29, "huffman_length_extra_bits must have 29 elements") | |
static int16_t | huffman_find_length_index (uint16_t length) |
_Static_assert (sizeof(huffman_distance_base)/sizeof(huffman_distance_base[0])==30, "huffman_distance_base must have 30 elements") | |
_Static_assert (sizeof(huffman_distance_extra_bits)/sizeof(huffman_distance_extra_bits[0])==30, "huffman_distance_extra_bits must have 30 elements") | |
static int16_t | huffman_find_distance_index (uint16_t distance) |
int8_t | deflate_inflate_uncompressed_block (bit_buffer_t *bit_buffer, buffer_t *out) |
int8_t | deflate_inflate_block (bit_buffer_t *bit_buffer, buffer_t *out, huffman_decode_table_t *lengths, huffman_decode_table_t *distances) |
int8_t | huffman_decode_table_decode (bit_buffer_t *bit_buffer, huffman_decode_table_t *huffman_lengths, huffman_decode_table_t *huffman_distances) |
static int64_t | bit_buffer_get (bit_buffer_t *bit_buffer, uint8_t bit_count) |
static int8_t | bit_buffer_put (bit_buffer_t *bit_buffer, uint8_t bit_count, uint64_t bits) |
static int8_t | bit_buffer_push (bit_buffer_t *bit_buffer) |
static void | bitbuffer_discard (bit_buffer_t *bit_buffer) |
static int16_t | bit_buffer_get_16le (bit_buffer_t *bit_buffer) |
static int32_t | huffman_decode (bit_buffer_t *bit_buffer, huffman_decode_table_t *huffman_decode_table, int32_t max_symbol) |
static int8_t | huffman_decode_table_build (uint8_t *lengths, size_t size, struct huffman_decode_table_t *out, uint32_t max_length) |
static uint32_t | deflate_hash4 (uint32_t data) |
static void | deflate_hash_insert (int64_t pos, uint32_t h, deflate_hashtable_t *ht) |
static deflate_match_t | deflate_find_bestmatch (buffer_t *in, int64_t in_len, int64_t in_p, deflate_hashtable_t *ht) |
static buffer_t * | deflate_deflate_lz77 (buffer_t *in_block, huffman_encode_freq_t *freqs) |
static int8_t | deflate_deflate_no_compress (buffer_t *in_block, bit_buffer_t *bit_buffer, boolean_t is_last_block) |
static int64_t | deflate_deflate_calculate_out_size (huffman_encode_freq_t *freqs, const huffman_encode_table_t *symbols, const huffman_encode_table_t *distances) |
static int8_t | deflate_deflate_block (buffer_t *lz77_block, bit_buffer_t *bit_buffer, const huffman_encode_table_t *symbols, const huffman_encode_table_t *distances) |
int8_t | huffman_sort_by_freq (const void *a, const void *b) |
int8_t | huffman_sort_by_symbol (const void *a, const void *b) |
static boolean_t | huffman_encode_build_table_internal (huffman_symbol_freq_t **symbol_freqs, int32_t count, int32_t max_bits, huffman_encode_table_t *huffman_table) |
static boolean_t | huffman_encode_build_table (huffman_encode_freq_t *freqs, boolean_t for_literal, huffman_encode_table_t *huffman_table, int32_t max_bits, int32_t *max_used_symbol) |
static bit_buffer_t * | huffman_encode_build_tables_and_code (huffman_encode_freq_t *freqs, huffman_encode_table_t **symbols, huffman_encode_table_t **distances, int64_t *header_bit_count) |
Builds a huffman tree from the given frequencies and also returns the header for the tree. More... | |
int8_t | deflate_deflate (buffer_t *in, buffer_t *out) |
int8_t | deflate_inflate (buffer_t *in, buffer_t *out) |
Variables | |
const huffman_encode_table_t | huffman_encode_fixed |
const huffman_encode_table_t | huffman_encode_distance_fixed |
const huffman_decode_table_t | huffman_decode_fixed_lengths |
const huffman_decode_table_t | huffman_decode_fixed_distances |
const uint16_t | huffman_length_base [] |
const uint16_t | huffman_length_extra_bits [] |
const uint16_t | huffman_distance_base [] |
const uint16_t | huffman_distance_extra_bits [] |
const uint8_t | huffman_code_lengths [] |
deflate implementation
This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.
|
static |
Builds a huffman tree from the given frequencies and also returns the header for the tree.
[in] | freqs | The frequencies to build the tree from |
[out] | symbols | The huffman tree |
[out] | distances | The huffman tree |
const uint8_t huffman_code_lengths[] |
const huffman_decode_table_t huffman_decode_fixed_distances |
const huffman_decode_table_t huffman_decode_fixed_lengths |
const uint16_t huffman_distance_base[] |
const uint16_t huffman_distance_extra_bits[] |
const huffman_encode_table_t huffman_encode_distance_fixed |
const uint16_t huffman_length_base[] |
const uint16_t huffman_length_extra_bits[] |