libmobi
C library for handling MOBI format ebook documents
compression.h
Go to the documentation of this file.
1 
11 #ifndef libmobi_compression_h
12 #define libmobi_compression_h
13 
14 #include "config.h"
15 #include "mobi.h"
16 
17 #ifndef MOBI_INLINE
18 #define MOBI_INLINE
19 #endif
20 
21 /* FIXME: what is the reasonable value? */
22 #define MOBI_HUFFMAN_MAXDEPTH 20
23 #define HUFF_CODETABLE_SIZE 33
29 typedef struct {
30  size_t index_count;
31  size_t index_read;
32  size_t code_length;
33  uint32_t table1[256];
34  uint32_t mincode_table[HUFF_CODETABLE_SIZE];
35  uint32_t maxcode_table[HUFF_CODETABLE_SIZE];
36  uint16_t *symbol_offsets;
37  unsigned char **symbols;
38 } MOBIHuffCdic;
39 
40 MOBI_RET mobi_decompress_lz77(unsigned char *out, const unsigned char *in, size_t *len_out, const size_t len_in);
41 MOBI_RET mobi_decompress_huffman(unsigned char *out, const unsigned char *in, size_t *len_out, size_t len_in, const MOBIHuffCdic *huffcdic);
42 
43 #endif
MOBI_RET mobi_decompress_huffman(unsigned char *out, const unsigned char *in, size_t *len_out, size_t len_in, const MOBIHuffCdic *huffcdic)
Decompressor for huff/cdic compressed text records.
Definition: compression.c:204
MOBI_RET mobi_decompress_lz77(unsigned char *out, const unsigned char *in, size_t *len_out, const size_t len_in)
Decompressor fo PalmDOC version of LZ77 compression.
Definition: compression.c:32
#define HUFF_CODETABLE_SIZE
Definition: compression.h:23
MOBI_RET
Error codes returned by functions.
Definition: mobi.h:59
Libmobi main header file.
Parsed data from HUFF and CDIC records needed to unpack huffman compressed text.
Definition: compression.h:29
size_t code_length
Definition: compression.h:32
size_t index_count
Definition: compression.h:30
uint16_t * symbol_offsets
Definition: compression.h:36
unsigned char ** symbols
Definition: compression.h:37
size_t index_read
Definition: compression.h:31