亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? deflate.c

?? mp3 source code decoder & encoder
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* deflate.c -- compress data using the deflation algorithm
 * Copyright (C) 1995-1996 Jean-loup Gailly.
 * For conditions of distribution and use, see copyright notice in zlib.h 
 */

/*
 *  ALGORITHM
 *
 *      The "deflation" process depends on being able to identify portions
 *      of the input text which are identical to earlier input (within a
 *      sliding window trailing behind the input currently being processed).
 *
 *      The most straightforward technique turns out to be the fastest for
 *      most input files: try all possible matches and select the longest.
 *      The key feature of this algorithm is that insertions into the string
 *      dictionary are very simple and thus fast, and deletions are avoided
 *      completely. Insertions are performed at each input character, whereas
 *      string matches are performed only when the previous match ends. So it
 *      is preferable to spend more time in matches to allow very fast string
 *      insertions and avoid deletions. The matching algorithm for small
 *      strings is inspired from that of Rabin & Karp. A brute force approach
 *      is used to find longer strings when a small match has been found.
 *      A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
 *      (by Leonid Broukhis).
 *         A previous version of this file used a more sophisticated algorithm
 *      (by Fiala and Greene) which is guaranteed to run in linear amortized
 *      time, but has a larger average cost, uses more memory and is patented.
 *      However the F&G algorithm may be faster for some highly redundant
 *      files if the parameter max_chain_length (described below) is too large.
 *
 *  ACKNOWLEDGEMENTS
 *
 *      The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
 *      I found it in 'freeze' written by Leonid Broukhis.
 *      Thanks to many people for bug reports and testing.
 *
 *  REFERENCES
 *
 *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
 *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
 *
 *      A description of the Rabin and Karp algorithm is given in the book
 *         "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
 *
 *      Fiala,E.R., and Greene,D.H.
 *         Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
 *
 */

/* $Id: deflate.c,v 1.15 1996/07/24 13:40:58 me Exp $ */

#include "deflate.h"

char deflate_copyright[] = " deflate 1.0.4 Copyright 1995-1996 Jean-loup Gailly ";
/*
  If you use the zlib library in a product, an acknowledgment is welcome
  in the documentation of your product. If for some reason you cannot
  include such an acknowledgment, I would appreciate that you keep this
  copyright string in the executable of your product.
 */

/* ===========================================================================
 *  Function prototypes.
 */
typedef enum {
    need_more,      /* block not completed, need more input or more output */
    block_done,     /* block flush performed */
    finish_started, /* finish started, need only more output at next deflate */
    finish_done     /* finish done, accept no more input or output */
} block_state;

typedef block_state (*compress_func) OF((deflate_state *s, int flush));
/* Compression function. Returns the block state after the call. */

local void fill_window    OF((deflate_state *s));
local block_state deflate_stored OF((deflate_state *s, int flush));
local block_state deflate_fast   OF((deflate_state *s, int flush));
local block_state deflate_slow   OF((deflate_state *s, int flush));
local void lm_init        OF((deflate_state *s));
local uInt longest_match  OF((deflate_state *s, IPos cur_match));
local void putShortMSB    OF((deflate_state *s, uInt b));
local void flush_pending  OF((z_streamp strm));
local int read_buf        OF((z_streamp strm, charf *buf, unsigned size));
#ifdef ASMV
      void match_init OF((void)); /* asm code initialization */
#endif

#ifdef DEBUG
local  void check_match OF((deflate_state *s, IPos start, IPos match,
                            int length));
#endif

/* ===========================================================================
 * Local data
 */

#define NIL 0
/* Tail of hash chains */

#ifndef TOO_FAR
#  define TOO_FAR 4096
#endif
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */

#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
 * See deflate.c for comments about the MIN_MATCH+1.
 */

/* Values for max_lazy_match, good_match and max_chain_length, depending on
 * the desired pack level (0..9). The values given below have been tuned to
 * exclude worst case performance for pathological files. Better values may be
 * found for specific files.
 */
typedef struct config_s {
   ush good_length; /* reduce lazy search above this match length */
   ush max_lazy;    /* do not perform lazy search above this match length */
   ush nice_length; /* quit search above this match length */
   ush max_chain;
   compress_func func;
} config;

local config configuration_table[10] = {
/*      good lazy nice chain */
/* 0 */ {0,    0,  0,    0, deflate_stored},  /* store only */
/* 1 */ {4,    4,  8,    4, deflate_fast}, /* maximum speed, no lazy matches */
/* 2 */ {4,    5, 16,    8, deflate_fast},
/* 3 */ {4,    6, 32,   32, deflate_fast},

/* 4 */ {4,    4, 16,   16, deflate_slow},  /* lazy matches */
/* 5 */ {8,   16, 32,   32, deflate_slow},
/* 6 */ {8,   16, 128, 128, deflate_slow},
/* 7 */ {8,   32, 128, 256, deflate_slow},
/* 8 */ {32, 128, 258, 1024, deflate_slow},
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */

/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
 * meaning.
 */

#define EQUAL 0
/* result of memcmp for equal strings */

struct static_tree_desc_s {int dummy;}; /* for buggy compilers */

/* ===========================================================================
 * Update a hash value with the given input byte
 * IN  assertion: all calls to to UPDATE_HASH are made with consecutive
 *    input characters, so that a running hash key can be computed from the
 *    previous key instead of complete recalculation each time.
 */
#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)


/* ===========================================================================
 * Insert string str in the dictionary and set match_head to the previous head
 * of the hash chain (the most recent string with same hash key). Return
 * the previous length of the hash chain.
 * IN  assertion: all calls to to INSERT_STRING are made with consecutive
 *    input characters and the first MIN_MATCH bytes of str are valid
 *    (except for the last MIN_MATCH-1 bytes of the input file).
 */
#define INSERT_STRING(s, str, match_head) \
   (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
    s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \
    s->head[s->ins_h] = (Pos)(str))

/* ===========================================================================
 * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
 * prev[] will be initialized on the fly.
 */
#define CLEAR_HASH(s) \
    s->head[s->hash_size-1] = NIL; \
    zmemzero((charf *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));

/* ========================================================================= */
int deflateInit_(strm, level, version, stream_size)
    z_streamp strm;
    int level;
    const char *version;
    int stream_size;
{
    return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
			 Z_DEFAULT_STRATEGY, version, stream_size);
    /* To do: ignore strm->next_in if we use it as window */
}

/* ========================================================================= */
int deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
		  version, stream_size)
    z_streamp strm;
    int  level;
    int  method;
    int  windowBits;
    int  memLevel;
    int  strategy;
    const char *version;
    int stream_size;
{
    deflate_state *s;
    int noheader = 0;

    ushf *overlay;
    /* We overlay pending_buf and d_buf+l_buf. This works since the average
     * output size for (length,distance) codes is <= 24 bits.
     */

    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
        stream_size != sizeof(z_stream)) {
	return Z_VERSION_ERROR;
    }
    if (strm == Z_NULL) return Z_STREAM_ERROR;

    strm->msg = Z_NULL;
    if (strm->zalloc == Z_NULL) {
	strm->zalloc = zcalloc;
	strm->opaque = (voidpf)0;
    }
    if (strm->zfree == Z_NULL) strm->zfree = zcfree;

    if (level == Z_DEFAULT_COMPRESSION) level = 6;

    if (windowBits < 0) { /* undocumented feature: suppress zlib header */
        noheader = 1;
        windowBits = -windowBits;
    }
    if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
        windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
	strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
        return Z_STREAM_ERROR;
    }
    s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
    if (s == Z_NULL) return Z_MEM_ERROR;
    strm->state = (struct internal_state FAR *)s;
    s->strm = strm;

    s->noheader = noheader;
    s->w_bits = windowBits;
    s->w_size = 1 << s->w_bits;
    s->w_mask = s->w_size - 1;

    s->hash_bits = memLevel + 7;
    s->hash_size = 1 << s->hash_bits;
    s->hash_mask = s->hash_size - 1;
    s->hash_shift =  ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);

    s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
    s->prev   = (Posf *)  ZALLOC(strm, s->w_size, sizeof(Pos));
    s->head   = (Posf *)  ZALLOC(strm, s->hash_size, sizeof(Pos));

    s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */

    overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
    s->pending_buf = (uchf *) overlay;

    if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
        s->pending_buf == Z_NULL) {
        strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
        deflateEnd (strm);
        return Z_MEM_ERROR;
    }
    s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
    s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;

    s->level = level;
    s->strategy = strategy;
    s->method = (Byte)method;

    return deflateReset(strm);
}

/* ========================================================================= */
int deflateSetDictionary (strm, dictionary, dictLength)
    z_streamp strm;
    const Bytef *dictionary;
    uInt  dictLength;
{
    deflate_state *s;
    uInt length = dictLength;
    uInt n;
    IPos hash_head = 0;

    if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL ||
        strm->state->status != INIT_STATE) return Z_STREAM_ERROR;

    s = strm->state;
    strm->adler = adler32(strm->adler, dictionary, dictLength);

    if (length < MIN_MATCH) return Z_OK;
    if (length > MAX_DIST(s)) {
	length = MAX_DIST(s);
	dictionary += dictLength - length;
    }
    zmemcpy((charf *)s->window, dictionary, length);
    s->strstart = length;
    s->block_start = (long)length;

    /* Insert all strings in the hash table (except for the last two bytes).
     * s->lookahead stays null, so s->ins_h will be recomputed at the next
     * call of fill_window.
     */
    s->ins_h = s->window[0];
    UPDATE_HASH(s, s->ins_h, s->window[1]);
    for (n = 0; n <= length - MIN_MATCH; n++) {
	INSERT_STRING(s, n, hash_head);
    }
    if (hash_head) hash_head = 0;  /* to make compiler happy */
    return Z_OK;
}

/* ========================================================================= */
int deflateReset (strm)
    z_streamp strm;
{
    deflate_state *s;
    
    if (strm == Z_NULL || strm->state == Z_NULL ||
        strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR;

    strm->total_in = strm->total_out = 0;
    strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
    strm->data_type = Z_UNKNOWN;

    s = (deflate_state *)strm->state;
    s->pending = 0;
    s->pending_out = s->pending_buf;

    if (s->noheader < 0) {
        s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */
    }
    s->status = s->noheader ? BUSY_STATE : INIT_STATE;
    strm->adler = 1;
    s->last_flush = Z_NO_FLUSH;

    _tr_init(s);
    lm_init(s);

    return Z_OK;
}

/* ========================================================================= */
int deflateParams(strm, level, strategy)
    z_streamp strm;
    int level;
    int strategy;
{
    deflate_state *s;
    compress_func func;
    int err = Z_OK;

    if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
    s = strm->state;

    if (level == Z_DEFAULT_COMPRESSION) {
	level = 6;
    }
    if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
	return Z_STREAM_ERROR;
    }
    func = configuration_table[s->level].func;

    if (func != configuration_table[level].func && strm->total_in != 0) {
	/* Flush the last buffer: */
	err = deflate(strm, Z_PARTIAL_FLUSH);
    }
    if (s->level != level) {
	s->level = level;
	s->max_lazy_match   = configuration_table[level].max_lazy;
	s->good_match       = configuration_table[level].good_length;
	s->nice_match       = configuration_table[level].nice_length;
	s->max_chain_length = configuration_table[level].max_chain;
    }
    s->strategy = strategy;
    return err;
}

/* =========================================================================
 * Put a short in the pending buffer. The 16-bit value is put in MSB order.
 * IN assertion: the stream state is correct and there is enough room in
 * pending_buf.
 */
local void putShortMSB (deflate_state *s, uInt b)
{
    put_byte(s, (Byte)(b >> 8));
    put_byte(s, (Byte)(b & 0xff));
}   

/* =========================================================================
 * Flush as much pending output as possible. All deflate() output goes
 * through this function so some applications may wish to modify it
 * to avoid allocating a large strm->next_out buffer and copying into it.
 * (See also read_buf()).
 */
local void flush_pending(z_streamp strm)
{
    unsigned len = strm->state->pending;

    if (len > strm->avail_out) len = strm->avail_out;
    if (len == 0) return;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久青草国产手机看片福利盒子| 欧美三级日本三级少妇99| 国产精品久久久久影视| 色婷婷香蕉在线一区二区| 国产精品一二三| 蜜臀精品一区二区三区在线观看 | 国产真实乱对白精彩久久| 香蕉久久夜色精品国产使用方法 | 亚洲乱码一区二区三区在线观看| 日韩午夜三级在线| 欧美亚洲日本一区| 粉嫩蜜臀av国产精品网站| 国产精品一区免费在线观看| 青娱乐精品视频在线| 亚洲美女电影在线| 洋洋av久久久久久久一区| 亚洲日本在线观看| 国产午夜久久久久| 久久久久国产精品人| 久久天堂av综合合色蜜桃网| 日韩一区二区不卡| 日韩一区二区免费在线观看| 欧美人成免费网站| 久久久精品国产99久久精品芒果| 666欧美在线视频| 国产成人在线影院| 不卡一区中文字幕| 91网站最新地址| 欧美性一级生活| 91精品国产欧美日韩| 欧美一级黄色大片| 欧美精品久久一区二区三区| 欧美日本视频在线| xnxx国产精品| 依依成人精品视频| 美女尤物国产一区| 日本少妇一区二区| 丰满放荡岳乱妇91ww| 91久久精品国产91性色tv| 欧美日韩成人一区二区| 精品粉嫩aⅴ一区二区三区四区| 亚洲国产高清不卡| 亚洲另类春色校园小说| 亚洲18女电影在线观看| 老司机午夜精品99久久| caoporn国产一区二区| 在线不卡a资源高清| 国产免费观看久久| 五月天丁香久久| 色8久久人人97超碰香蕉987| 久久综合av免费| 国产精品天干天干在线综合| 麻豆91在线播放免费| 欧美久久久久久久久| 中文字幕一区在线| 美脚の诱脚舐め脚责91 | 欧美日韩一级视频| 亚洲激情五月婷婷| 粉嫩aⅴ一区二区三区四区五区| 成人短视频下载| 国产精品你懂的| 成人网在线播放| 国产精品毛片久久久久久| 国产在线一区观看| 成人免费视频视频在线观看免费| 8x福利精品第一导航| 午夜亚洲国产au精品一区二区| 91免费国产在线| 国产剧情一区在线| 精品国产一区二区三区av性色| 美女性感视频久久| 久久久美女毛片| 国产成人激情av| 国产午夜精品在线观看| 免费在线观看视频一区| 91精品国产高清一区二区三区| 日韩精品电影一区亚洲| 欧美性感一区二区三区| 亚洲成av人片在www色猫咪| 欧美日韩成人一区二区| 亚洲成人精品影院| 精品国产乱码久久久久久牛牛 | 中文字幕视频一区| 日本高清成人免费播放| 亚洲婷婷在线视频| 一本大道av伊人久久综合| 亚洲精选一二三| 在线播放中文字幕一区| 精品一区二区免费| 自拍偷拍亚洲激情| 日韩一区二区在线播放| 国产.欧美.日韩| 日本一不卡视频| 国产精品青草综合久久久久99| 91网站最新地址| 美女视频黄久久| 亚洲乱码中文字幕综合| 欧美一区二区久久久| 成熟亚洲日本毛茸茸凸凹| 亚洲高清免费视频| 久久综合久久久久88| 色综合色狠狠天天综合色| 石原莉奈在线亚洲三区| www国产成人| 日韩欧美中文一区| 成人精品视频网站| 国产成人精品亚洲日本在线桃色 | 国产日产亚洲精品系列| 欧美精品日韩综合在线| 成人深夜视频在线观看| 亚洲综合色自拍一区| 国产欧美一区二区精品性| 日韩亚洲欧美一区二区三区| 欧美一级二级在线观看| 欧洲人成人精品| 99久久免费精品高清特色大片| 国产最新精品精品你懂的| 日韩在线a电影| 亚洲电影一级片| 日本v片在线高清不卡在线观看| 中文字幕一区二| 国产精品免费久久| 国产精品久久久久一区二区三区| 国产免费久久精品| 久久精品一级爱片| 久久久精品中文字幕麻豆发布| 久久久99久久| 亚洲卡通动漫在线| 天天色图综合网| 紧缚奴在线一区二区三区| 国产一区二区三区四区在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎| 蜜臀av一区二区三区| 国产露脸91国语对白| 成人美女在线视频| 91麻豆成人久久精品二区三区| 色欧美日韩亚洲| 91精品国产91久久久久久最新毛片| 欧美一区二区三区影视| 久久综合九色综合97婷婷| 亚洲欧美自拍偷拍| 日韩中文欧美在线| 成人国产电影网| 欧美精品第1页| 中文字幕第一页久久| 亚洲国产精品久久一线不卡| 紧缚奴在线一区二区三区| 日韩午夜在线观看视频| 日韩电影免费在线看| 欧美美女一区二区三区| 国产精品亲子乱子伦xxxx裸| 97久久超碰国产精品电影| 久久欧美中文字幕| 久久成人精品无人区| 日韩免费成人网| 亚洲成av人片| 欧美高清视频一二三区 | 亚洲精品免费一二三区| 久久99蜜桃精品| 4438成人网| 紧缚奴在线一区二区三区| 色噜噜狠狠色综合中国| 亚洲另类春色校园小说| 欧美羞羞免费网站| 亚洲国产精品精华液网站| 色系网站成人免费| 亚洲影视在线观看| 678五月天丁香亚洲综合网| 亚洲综合无码一区二区| 91成人免费电影| 免费在线观看精品| 精品久久久久久综合日本欧美| 精品一区二区三区在线视频| 久久久久久一二三区| av一区二区三区在线| 亚洲综合另类小说| 精品免费日韩av| a亚洲天堂av| 中文字幕一区二区三区乱码在线| 成人国产精品视频| 亚洲精品视频在线观看网站| 欧美一区二区三区视频在线观看| 免费欧美日韩国产三级电影| 2020国产精品| 日本道免费精品一区二区三区| 午夜私人影院久久久久| 久久精品在这里| 日本高清视频一区二区| 天堂成人国产精品一区| 中文字幕+乱码+中文字幕一区| 欧美裸体bbwbbwbbw| 国产aⅴ综合色| 日韩高清不卡一区二区| 国产免费久久精品| 欧美一区二区日韩一区二区| 丁香婷婷综合色啪| 日本亚洲天堂网| 国产亚洲精久久久久久| 欧美一区二区在线播放| 色老汉av一区二区三区|