annotate src/dmzlib.h @ 1005:36add4215cdd

Oops, missed this.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 01 Mar 2015 03:10:03 +0200
parents cd0e0270e1ce
children d98fcb10df6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
6c33c92de066 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 960
diff changeset
16
6c33c92de066 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 960
diff changeset
17 #define STBI__ZFAST_BITS 9 // accelerate all cases in default tables
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 #define STBI__ZFAST_SIZE (1 << STBI__ZFAST_BITS)
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #define STBI__ZFAST_MASK (STBI__ZFAST_SIZE - 1)
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 typedef struct
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 {
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 Uint16 fast[STBI__ZFAST_SIZE];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 Uint16 firstCode[16];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 int maxCode[17];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 Uint16 firstSymbol[16];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 Uint8 size[288];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 Uint16 value[288];
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 } DMZHuffmanContext;
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 typedef struct
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 {
958
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
35 Uint8 *zbuffer, *zbufferEnd;
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
1005
36add4215cdd Oops, missed this.
Matti Hamalainen <ccr@tnsp.org>
parents: 997
diff changeset
37 int window;
958
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
38 int numBits;
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
39 Uint32 codeBuffer;
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
958
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
41 Uint8 *zout, *zoutStart, *zoutEnd;
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
42 BOOL expandable;
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43
958
985225a93aeb Add error code parameter to dmError() and dmErrorVA().
Matti Hamalainen <ccr@tnsp.org>
parents: 949
diff changeset
44 DMZHuffmanContext zlength, zdistance;
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 } DMZLibContext;
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
997
cd0e0270e1ce Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 970
diff changeset
48 void dmZLibInit();
cd0e0270e1ce Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 970
diff changeset
49 int dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG);
cd0e0270e1ce Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 970
diff changeset
50 int dmZLibDecode(DMZLibContext * ctx);
949
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51
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 #ifdef __cplusplus
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 }
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 #endif
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
6ed9465f3913 Initial import of separated zlib decoding routines lifted from
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 #endif // DMZLIB_H