FreeCalypso > hg > freecalypso-reveng
comparison fluid-mnf/lz.h @ 311:9cecc930d78f
fluid-mnf: original source from TI,
defenestrated line endings and rearranged directory structure,
but no *.[ch] source file content changes yet
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 29 Feb 2020 05:36:07 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
310:ae39d76d5b7a | 311:9cecc930d78f |
---|---|
1 /****************************************************************************** | |
2 * FLUID (Flash Loader Utility Independent of Device) | |
3 * | |
4 * Simple LZ77 compressor (c) Texas Instruments, Jesper Pedersem TI-DK | |
5 * | |
6 * $Id: lz.h 1.4 Thu, 31 Oct 2002 13:12:27 +0100 tsj $ | |
7 * | |
8 ******************************************************************************/ | |
9 | |
10 #ifndef _LZ_H_ | |
11 #define _LZ_H_ 1 | |
12 | |
13 // Algorithmn efficiency constants | |
14 | |
15 // Don't compress unless we have a > THRESHOLD match | |
16 #define THRESHOLD 2 | |
17 | |
18 // Number of bits to use for position, when storing a match | |
19 #define POS_BITS 12 | |
20 #define POS_MASK 0x0FFF | |
21 | |
22 // Number of bits to use for length, when storing a match | |
23 #define LEN_BITS 4 | |
24 #define LEN_MASK 0xF000 | |
25 | |
26 // Size and size-mask of sliding window | |
27 #define WINDOW_SIZE (1 << POS_BITS) | |
28 #define WINDOW_MASK (WINDOW_SIZE - 1) | |
29 | |
30 // Maximum match length | |
31 #define MAX_MATCH ((1 << LEN_BITS) + THRESHOLD) | |
32 | |
33 // This structure is only being used by lzdecode/decompress(). | |
34 struct lz_s { | |
35 uint8 window[WINDOW_SIZE]; // Sliding window buffer | |
36 int16 window_pos; // Current window position | |
37 | |
38 // Static variables for get_bits() | |
39 uint32 bitbuf; // buffer for remaining bits | |
40 uint8 bitbuf_size; // number of bits in buffer | |
41 | |
42 // Global input/output buffer pointers and sizes | |
43 uint8 *buffer_in; | |
44 uint32 buffer_in_size; | |
45 uint32 total_in_size; | |
46 uint8 *buffer_out; | |
47 uint32 buffer_out_size; | |
48 uint32 total_out_size; | |
49 }; | |
50 | |
51 | |
52 void compress_init(void); | |
53 int compress(char *outbuf, char *inbuf, int size); | |
54 | |
55 void decompress_init(struct lz_s *plz); | |
56 int decompress(struct lz_s *plz, | |
57 unsigned char *outbuf, unsigned char *inbuf, int size); | |
58 | |
59 #endif |