Mercurial > hg > dmlib
view src/dmzlib.h @ 960:1832ac20edb2
Clean up dmzlib and use it in stb_image.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Feb 2015 04:46:13 +0200 |
parents | 985225a93aeb |
children | 6c33c92de066 |
line wrap: on
line source
/* * DMLib * -- ZLib implementation * Public domain zlib decode v0.2 by Sean Barrett 2006-11-18 * Modified and reformatted for DMLib by Matti 'ccr' Hamalainen */ #ifndef DMZLIB_H #define DMZLIB_H #include "dmlib.h" #ifdef __cplusplus extern "C" { #endif // fast-way is faster to check than jpeg huffman, but slow way is slower #define STBI__ZFAST_BITS 9 // accelerate all cases in default tables #define STBI__ZFAST_SIZE (1 << STBI__ZFAST_BITS) #define STBI__ZFAST_MASK (STBI__ZFAST_SIZE - 1) typedef struct { Uint16 fast[STBI__ZFAST_SIZE]; Uint16 firstCode[16]; int maxCode[17]; Uint16 firstSymbol[16]; Uint8 size[288]; Uint16 value[288]; } DMZHuffmanContext; typedef struct { Uint8 *zbuffer, *zbufferEnd; int numBits; Uint32 codeBuffer; Uint8 *zout, *zoutStart, *zoutEnd; BOOL expandable; DMZHuffmanContext zlength, zdistance; } DMZLibContext; void dmZLibInit(); int dmZLibDecode(DMZLibContext * ctx); int dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG); #ifdef __cplusplus } #endif #endif // DMZLIB_H