view src/dmzlib.h @ 2576:812b16ee49db

I had been living under apparent false impression that "realfft.c" on which the FFT implementation in DMLIB was basically copied from was released in public domain at some point, but it could very well be that it never was. Correct license is (or seems to be) GNU GPL. Thus I removing the code from DMLIB, and profusely apologize to the author, Philip Van Baren. It was never my intention to distribute code based on his original work under a more liberal license than originally intended.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Mar 2022 16:32:50 +0200
parents 043b5942fdb6
children 9807ae37ad69
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


#define DM_ZLIB_HFAST_BITS  9  // accelerate all cases in default tables
#define DM_ZLIB_HFAST_SIZE  (1 << DM_ZLIB_HFAST_BITS)
#define DM_ZLIB_HFAST_MASK  (DM_ZLIB_HFAST_SIZE - 1)

#define DM_ZLIB_HUFF_CODES  (288)
#define DM_ZLIB_HUFF_DIST   (32)


typedef struct
{
    BOOL    initialized;

    Uint16  fast[DM_ZLIB_HFAST_SIZE];
    Uint16  firstCode[16];
    int     maxCode[16 + 1];
    Uint16  firstSymbol[16];

    Uint8   size[DM_ZLIB_HUFF_CODES];
    Uint16  value[DM_ZLIB_HUFF_CODES];
} DMZHuffmanContext;


typedef struct
{
    Uint8 *inBuffer, *inBufferStart, *inBufferEnd;

    int window;
    int numBits;
    Uint32 codeBuffer;

    Uint8 *outBuffer, *outBufferStart, *outBufferEnd;
    BOOL expandable;

    DMZHuffmanContext zlength, zdistance;
} DMZLibContext;


int    dmZLibInit();
void   dmZLibClose();

int    dmZLibInitInflate(DMZLibContext *ctx);
void   dmZLibCloseInflate(DMZLibContext *ctx);
int    dmZLibParseHeader(DMZLibContext * ctx, BOOL checkPNG);
int    dmZLibInflate(DMZLibContext * ctx);


#ifdef __cplusplus
}
#endif

#endif // DMZLIB_H