Mercurial > hg > dmlib
annotate src/dmzlib.h @ 2281:167ec99e57a5
Initialize JSSPattern::used[] values to TRUE.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 18 Jun 2019 12:31:17 +0300 |
parents | 043b5942fdb6 |
children | 9807ae37ad69 |
rev | line source |
---|---|
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 /* |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
2 * DMLib |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
3 * -- ZLib implementation |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
4 * Public domain zlib decode v0.2 by Sean Barrett 2006-11-18 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
5 * Modified and reformatted for DMLib by Matti 'ccr' Hamalainen |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 */ |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
7 #ifndef DMZLIB_H |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 #define DMZLIB_H |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 #include "dmlib.h" |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 #ifdef __cplusplus |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 extern "C" { |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 #endif |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 |
970 | 16 |
1060 | 17 #define DM_ZLIB_HFAST_BITS 9 // accelerate all cases in default tables |
18 #define DM_ZLIB_HFAST_SIZE (1 << DM_ZLIB_HFAST_BITS) | |
19 #define DM_ZLIB_HFAST_MASK (DM_ZLIB_HFAST_SIZE - 1) | |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
20 |
1062
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
21 #define DM_ZLIB_HUFF_CODES (288) |
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
22 #define DM_ZLIB_HUFF_DIST (32) |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
23 |
1069 | 24 |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
25 typedef struct |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 { |
1062
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
27 BOOL initialized; |
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
28 |
1060 | 29 Uint16 fast[DM_ZLIB_HFAST_SIZE]; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 Uint16 firstCode[16]; |
1061 | 31 int maxCode[16 + 1]; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
32 Uint16 firstSymbol[16]; |
1062
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
33 |
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
34 Uint8 size[DM_ZLIB_HUFF_CODES]; |
d36bf7514614
Add some constants and make initialization one-time only.
Matti Hamalainen <ccr@tnsp.org>
parents:
1061
diff
changeset
|
35 Uint16 value[DM_ZLIB_HUFF_CODES]; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 } DMZHuffmanContext; |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 typedef struct |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 { |
1074
e98bc627ad08
Rename dmzlib structure members.
Matti Hamalainen <ccr@tnsp.org>
parents:
1069
diff
changeset
|
41 Uint8 *inBuffer, *inBufferStart, *inBufferEnd; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
1005 | 43 int window; |
958
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
949
diff
changeset
|
44 int numBits; |
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
949
diff
changeset
|
45 Uint32 codeBuffer; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 |
1074
e98bc627ad08
Rename dmzlib structure members.
Matti Hamalainen <ccr@tnsp.org>
parents:
1069
diff
changeset
|
47 Uint8 *outBuffer, *outBufferStart, *outBufferEnd; |
958
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
949
diff
changeset
|
48 BOOL expandable; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 |
958
985225a93aeb
Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents:
949
diff
changeset
|
50 DMZHuffmanContext zlength, zdistance; |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 } DMZLibContext; |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 |
1054 | 54 int dmZLibInit(); |
55 void dmZLibClose(); | |
1121
043b5942fdb6
Rename some dmzlib functions and add context init/close functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1074
diff
changeset
|
56 |
043b5942fdb6
Rename some dmzlib functions and add context init/close functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1074
diff
changeset
|
57 int dmZLibInitInflate(DMZLibContext *ctx); |
043b5942fdb6
Rename some dmzlib functions and add context init/close functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1074
diff
changeset
|
58 void dmZLibCloseInflate(DMZLibContext *ctx); |
997 | 59 int dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG); |
1121
043b5942fdb6
Rename some dmzlib functions and add context init/close functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
1074
diff
changeset
|
60 int dmZLibInflate(DMZLibContext * ctx); |
949
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 #ifdef __cplusplus |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 } |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 #endif |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 |
6ed9465f3913
Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 #endif // DMZLIB_H |