⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipp_zlib.h

📁 intel的ipp性能库的示例代码
💻 H
字号:
/* //////////////////////////////// "ippcompress.c" /////////////////////////////
//
//                  INTEL CORPORATION PROPRIETARY INFORMATION
//     This software is supplied under the terms of a license agreement or
//     nondisclosure agreement with Intel Corporation and may not be copied
//     or disclosed except in accordance with the terms of that agreement.
//          Copyright(c) 2005 Intel Corporation. All Rights Reserved.
//
//
//            Sample of IPP DC ( data compression ) domain functions usage
//
*/

#include "ippdc.h"

/**********************************************************************************/
/********************    zlib states for compatibility    *************************/
/**********************************************************************************/

#define FAR

typedef unsigned char Byte;
typedef unsigned char Bytef;
typedef unsigned int uInt;
typedef unsigned long uLong;
typedef void* gzFile;
typedef void* voidpf;
typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
typedef void   (*free_func)(voidpf opaque, voidpf address);

typedef struct IppLZ77ZLIBState_ST {
    Bytef    *next_in;  /* next input byte */
    uInt     avail_in;  /* number of bytes available at next_in */
    uLong    total_in;  /* total nb of input bytes read so far */

    Bytef    *next_out; /* next output byte should be put there */
    uInt     avail_out; /* remaining free space at next_out */
    uLong    total_out; /* total nb of bytes output so far */

    char     *msg;      /* last error message, NULL if no error */
    struct LZ77State_8u FAR *state; /* not visible by applications */

    alloc_func zalloc;  /* used to allocate the internal state */
    free_func  zfree;   /* used to free the internal state */
    voidpf     opaque;  /* private data object passed to zalloc and zfree */

    int     data_type;  /* best guess about the data type: ascii or binary */
    uLong   adler;      /* adler32 value of the uncompressed data */
    uLong   reserved;   /* reserved for future use */
} z_stream;

/**********************************************************************************/
/********************            zlib constants           *************************/
/**********************************************************************************/

#define ZLIB_VERSION "Intel IPP zlib-1.2.1 compatible version"

#define Z_NO_FLUSH        0
#define Z_SYNC_FLUSH      2
#define Z_FULL_FLUSH      3
#define Z_FINISH          4
#define Z_BLOCK           5

#define Z_OK              0
#define Z_STREAM_END      1
#define Z_NEED_DICT       2
#define Z_ERRNO         (-1)
#define Z_STREAM_ERROR  (-2)
#define Z_DATA_ERROR    (-3)
#define Z_MEM_ERROR     (-4)
#define Z_BUF_ERROR     (-5)
#define Z_VERSION_ERROR (-6)

#define Z_NO_COMPRESSION         0
#define Z_BEST_SPEED             1
#define Z_BEST_COMPRESSION       9
#define Z_DEFAULT_COMPRESSION  (-1)

#define Z_FILTERED            0
#define Z_HUFFMAN_ONLY        0
#define Z_RLE                 0
#define Z_DEFAULT_STRATEGY    0

#define Z_BINARY     0
#define Z_ASCII      1
#define Z_UNKNOWN    2

#define Z_DEFLATED   8
#define Z_NULL       0

#define DEF_MEM_LEVEL 8
#define Z_BUFSIZE 16384
#define MAX_WBITS 15

#define OS_CODE 0x00

#ifndef GZIP
#define GZIP
#define GUNZIP
#endif

/**********************************************************************************/
/********************            zlib prototypes          *************************/
/**********************************************************************************/

extern int deflateInit_ (z_stream* strm, int level, const char *version, int stream_size);
extern int deflateInit2_ (z_stream* strm, int  level, int  method,
                            int windowBits, int memLevel, int strategy,
                            const char *version, int stream_size);

#define deflateInit(strm, level) \
        deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))

#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
                      (strategy), ZLIB_VERSION, sizeof(z_stream))

extern int deflate(z_stream* strm, int flush);
extern int deflateEnd(z_stream* strm);
extern int deflateReset (z_stream* strm);

extern int inflateInit_(z_stream* strm, const char *version, int stream_size);
extern int inflateInit2_(z_stream* strm, int  windowBits, const char *version, int stream_size);

#define inflateInit(strm) \
        inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))

#define inflateInit2(strm, windowBits) \
        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))

extern int inflate(z_stream* strm, int flush);
extern int inflateEnd(z_stream* strm);
extern int inflateReset(z_stream* strm);

extern gzFile gzopen(const char *path, const char *mode);
extern int gzwrite(gzFile file, void* buf, unsigned len);
extern int gzread(gzFile file, void* buf, unsigned len);
extern int gzclose(gzFile file);

extern uLong adler32(uLong adler, const Bytef *buf, uInt len);
extern uLong crc32(uLong crc, const Bytef *buf, uInt len);

/**********************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -