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

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

?? trees.c

?? 一款最完整的工業(yè)組態(tài)軟源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* trees.c -- output deflated data using Huffman coding
 * Copyright (C) 1995-2003 Jean-loup Gailly
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

/*
 *  ALGORITHM
 *
 *      The "deflation" process uses several Huffman trees. The more
 *      common source values are represented by shorter bit sequences.
 *
 *      Each code tree is stored in a compressed form which is itself
 * a Huffman encoding of the lengths of all the code strings (in
 * ascending order by source values).  The actual code strings are
 * reconstructed from the lengths in the inflate process, as described
 * in the deflate specification.
 *
 *  REFERENCES
 *
 *      Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
 *      Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
 *
 *      Storer, James A.
 *          Data Compression:  Methods and Theory, pp. 49-50.
 *          Computer Science Press, 1988.  ISBN 0-7167-8156-5.
 *
 *      Sedgewick, R.
 *          Algorithms, p290.
 *          Addison-Wesley, 1983. ISBN 0-201-06672-6.
 */

/* @(#) $Id: trees.c,v 1.3 2004/06/27 11:43:04 drolon Exp $ */

/* #define GEN_TREES_H */

#include "deflate.h"

#ifdef DEBUG
#  include <ctype.h>
#endif

/* ===========================================================================
 * Constants
 */

#define MAX_BL_BITS 7
/* Bit length codes must not exceed MAX_BL_BITS bits */

#define END_BLOCK 256
/* end of block literal code */

#define REP_3_6      16
/* repeat previous bit length 3-6 times (2 bits of repeat count) */

#define REPZ_3_10    17
/* repeat a zero length 3-10 times  (3 bits of repeat count) */

#define REPZ_11_138  18
/* repeat a zero length 11-138 times  (7 bits of repeat count) */

local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
   = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};

local const int extra_dbits[D_CODES] /* extra bits for each distance code */
   = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};

local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
   = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};

local const uch bl_order[BL_CODES]
   = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
/* The lengths of the bit length codes are sent in order of decreasing
 * probability, to avoid transmitting the lengths for unused bit length codes.
 */

#define Buf_size (8 * 2*sizeof(char))
/* Number of bits used within bi_buf. (bi_buf might be implemented on
 * more than 16 bits on some systems.)
 */

/* ===========================================================================
 * Local data. These are initialized only once.
 */

#define DIST_CODE_LEN  512 /* see definition of array dist_code below */

#if defined(GEN_TREES_H) || !defined(STDC)
/* non ANSI compilers may not accept trees.h */

local ct_data static_ltree[L_CODES+2];
/* The static literal tree. Since the bit lengths are imposed, there is no
 * need for the L_CODES extra codes used during heap construction. However
 * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
 * below).
 */

local ct_data static_dtree[D_CODES];
/* The static distance tree. (Actually a trivial tree since all codes use
 * 5 bits.)
 */

uch _dist_code[DIST_CODE_LEN];
/* Distance codes. The first 256 values correspond to the distances
 * 3 .. 258, the last 256 values correspond to the top 8 bits of
 * the 15 bit distances.
 */

uch _length_code[MAX_MATCH-MIN_MATCH+1];
/* length code for each normalized match length (0 == MIN_MATCH) */

local int base_length[LENGTH_CODES];
/* First normalized length for each code (0 = MIN_MATCH) */

local int base_dist[D_CODES];
/* First normalized distance for each code (0 = distance of 1) */

#else
#  include "trees.h"
#endif /* GEN_TREES_H */

struct static_tree_desc_s {
    const ct_data *static_tree;  /* static tree or NULL */
    const intf *extra_bits;      /* extra bits for each code or NULL */
    int     extra_base;          /* base index for extra_bits */
    int     elems;               /* max number of elements in the tree */
    int     max_length;          /* max bit length for the codes */
};

local static_tree_desc  static_l_desc =
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};

local static_tree_desc  static_d_desc =
{static_dtree, extra_dbits, 0,          D_CODES, MAX_BITS};

local static_tree_desc  static_bl_desc =
{(const ct_data *)0, extra_blbits, 0,   BL_CODES, MAX_BL_BITS};

/* ===========================================================================
 * Local (static) routines in this file.
 */

local void tr_static_init OF((void));
local void init_block     OF((deflate_state *s));
local void pqdownheap     OF((deflate_state *s, ct_data *tree, int k));
local void gen_bitlen     OF((deflate_state *s, tree_desc *desc));
local void gen_codes      OF((ct_data *tree, int max_code, ushf *bl_count));
local void build_tree     OF((deflate_state *s, tree_desc *desc));
local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
local int  build_bl_tree  OF((deflate_state *s));
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
                              int blcodes));
local void compress_block OF((deflate_state *s, ct_data *ltree,
                              ct_data *dtree));
local void set_data_type  OF((deflate_state *s));
local unsigned bi_reverse OF((unsigned value, int length));
local void bi_windup      OF((deflate_state *s));
local void bi_flush       OF((deflate_state *s));
local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
                              int header));

#ifdef GEN_TREES_H
local void gen_trees_header OF((void));
#endif

#ifndef DEBUG
#  define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
   /* Send a code of the given tree. c and tree must not have side effects */

#else /* DEBUG */
#  define send_code(s, c, tree) \
     { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
       send_bits(s, tree[c].Code, tree[c].Len); }
#endif

/* ===========================================================================
 * Output a short LSB first on the stream.
 * IN assertion: there is enough room in pendingBuf.
 */
#define put_short(s, w) { \
    put_byte(s, (uch)((w) & 0xff)); \
    put_byte(s, (uch)((ush)(w) >> 8)); \
}

/* ===========================================================================
 * Send a value on a given number of bits.
 * IN assertion: length <= 16 and value fits in length bits.
 */
#ifdef DEBUG
local void send_bits      OF((deflate_state *s, int value, int length));

local void send_bits(s, value, length)
    deflate_state *s;
    int value;  /* value to send */
    int length; /* number of bits */
{
    Tracevv((stderr," l %2d v %4x ", length, value));
    Assert(length > 0 && length <= 15, "invalid length");
    s->bits_sent += (ulg)length;

    /* If not enough room in bi_buf, use (valid) bits from bi_buf and
     * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
     * unused bits in value.
     */
    if (s->bi_valid > (int)Buf_size - length) {
        s->bi_buf |= (value << s->bi_valid);
        put_short(s, s->bi_buf);
        s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
        s->bi_valid += length - Buf_size;
    } else {
        s->bi_buf |= value << s->bi_valid;
        s->bi_valid += length;
    }
}
#else /* !DEBUG */

#define send_bits(s, value, length) \
{ int len = length;\
  if (s->bi_valid > (int)Buf_size - len) {\
    int val = value;\
    s->bi_buf |= (val << s->bi_valid);\
    put_short(s, s->bi_buf);\
    s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
    s->bi_valid += len - Buf_size;\
  } else {\
    s->bi_buf |= (value) << s->bi_valid;\
    s->bi_valid += len;\
  }\
}
#endif /* DEBUG */


/* the arguments must not have side effects */

/* ===========================================================================
 * Initialize the various 'constant' tables.
 */
local void tr_static_init()
{
#if defined(GEN_TREES_H) || !defined(STDC)
    static int static_init_done = 0;
    int n;        /* iterates over tree elements */
    int bits;     /* bit counter */
    int length;   /* length value */
    int code;     /* code value */
    int dist;     /* distance index */
    ush bl_count[MAX_BITS+1];
    /* number of codes at each bit length for an optimal tree */

    if (static_init_done) return;

    /* For some embedded targets, global variables are not initialized: */
    static_l_desc.static_tree = static_ltree;
    static_l_desc.extra_bits = extra_lbits;
    static_d_desc.static_tree = static_dtree;
    static_d_desc.extra_bits = extra_dbits;
    static_bl_desc.extra_bits = extra_blbits;

    /* Initialize the mapping length (0..255) -> length code (0..28) */
    length = 0;
    for (code = 0; code < LENGTH_CODES-1; code++) {
        base_length[code] = length;
        for (n = 0; n < (1<<extra_lbits[code]); n++) {
            _length_code[length++] = (uch)code;
        }
    }
    Assert (length == 256, "tr_static_init: length != 256");
    /* Note that the length 255 (match length 258) can be represented
     * in two different ways: code 284 + 5 bits or code 285, so we
     * overwrite length_code[255] to use the best encoding:
     */
    _length_code[length-1] = (uch)code;

    /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
    dist = 0;
    for (code = 0 ; code < 16; code++) {
        base_dist[code] = dist;
        for (n = 0; n < (1<<extra_dbits[code]); n++) {
            _dist_code[dist++] = (uch)code;
        }
    }
    Assert (dist == 256, "tr_static_init: dist != 256");
    dist >>= 7; /* from now on, all distances are divided by 128 */
    for ( ; code < D_CODES; code++) {
        base_dist[code] = dist << 7;
        for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
            _dist_code[256 + dist++] = (uch)code;
        }
    }
    Assert (dist == 256, "tr_static_init: 256+dist != 512");

    /* Construct the codes of the static literal tree */
    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
    n = 0;
    while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
    while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
    while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
    while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
    /* Codes 286 and 287 do not exist, but we must include them in the
     * tree construction to get a canonical Huffman tree (longest code
     * all ones)
     */
    gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);

    /* The static distance tree is trivial: */
    for (n = 0; n < D_CODES; n++) {
        static_dtree[n].Len = 5;
        static_dtree[n].Code = bi_reverse((unsigned)n, 5);
    }
    static_init_done = 1;

#  ifdef GEN_TREES_H
    gen_trees_header();
#  endif
#endif /* defined(GEN_TREES_H) || !defined(STDC) */
}

/* ===========================================================================
 * Genererate the file trees.h describing the static trees.
 */
#ifdef GEN_TREES_H
#  ifndef DEBUG
#    include <stdio.h>
#  endif

#  define SEPARATOR(i, last, width) \
      ((i) == (last)? "\n};\n\n" :    \
       ((i) % (width) == (width)-1 ? ",\n" : ", "))

void gen_trees_header()
{
    FILE *header = fopen("trees.h", "w");
    int i;

    Assert (header != NULL, "Can't open trees.h");
    fprintf(header,
            "/* header created automatically with -DGEN_TREES_H */\n\n");

    fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
    for (i = 0; i < L_CODES+2; i++) {
        fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
                static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
    }

    fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
    for (i = 0; i < D_CODES; i++) {
        fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
                static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
    }

    fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
    for (i = 0; i < DIST_CODE_LEN; i++) {
        fprintf(header, "%2u%s", _dist_code[i],
                SEPARATOR(i, DIST_CODE_LEN-1, 20));
    }

    fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
    for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
        fprintf(header, "%2u%s", _length_code[i],
                SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
    }

    fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
    for (i = 0; i < LENGTH_CODES; i++) {
        fprintf(header, "%1u%s", base_length[i],
                SEPARATOR(i, LENGTH_CODES-1, 20));
    }

    fprintf(header, "local const int base_dist[D_CODES] = {\n");
    for (i = 0; i < D_CODES; i++) {
        fprintf(header, "%5u%s", base_dist[i],
                SEPARATOR(i, D_CODES-1, 10));
    }

    fclose(header);
}
#endif /* GEN_TREES_H */

/* ===========================================================================
 * Initialize the tree data structures for a new zlib stream.
 */
void _tr_init(s)
    deflate_state *s;
{
    tr_static_init();

    s->l_desc.dyn_tree = s->dyn_ltree;
    s->l_desc.stat_desc = &static_l_desc;

    s->d_desc.dyn_tree = s->dyn_dtree;
    s->d_desc.stat_desc = &static_d_desc;

    s->bl_desc.dyn_tree = s->bl_tree;
    s->bl_desc.stat_desc = &static_bl_desc;

    s->bi_buf = 0;
    s->bi_valid = 0;
    s->last_eob_len = 8; /* enough lookahead for inflate */
#ifdef DEBUG
    s->compressed_len = 0L;
    s->bits_sent = 0L;
#endif

    /* Initialize the first block of the first file: */
    init_block(s);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲自拍偷拍欧美| 欧美视频在线播放| 欧美视频在线一区二区三区| 欧美日韩一区二区欧美激情| 日韩一区二区三区免费看| 精品剧情v国产在线观看在线| 国产亚洲综合av| 亚洲免费观看高清| 另类人妖一区二区av| 99久久99久久精品国产片果冻| 91国偷自产一区二区开放时间| 欧美mv日韩mv| 亚洲三级小视频| 老司机免费视频一区二区三区| 91在线观看高清| 欧美va亚洲va香蕉在线| 亚洲女与黑人做爰| 91麻豆文化传媒在线观看| 欧美一区二区三区系列电影| 国产网红主播福利一区二区| 亚洲午夜激情网页| 国产一区二区免费视频| 欧美三级电影在线观看| 久久九九久精品国产免费直播| 一区二区三区日韩| 国产精品亚洲午夜一区二区三区| 欧美日本在线播放| 国产成人免费在线观看不卡| 亚洲精品午夜久久久| 理论片日本一区| 在线亚洲免费视频| 中文字幕精品综合| 麻豆精品精品国产自在97香蕉| 91黄色小视频| 国产精品色哟哟网站| 玖玖九九国产精品| 欧美日韩午夜在线| 中文字幕日韩一区| 色94色欧美sute亚洲线路一久| 国产女主播一区| 日韩成人精品在线| 欧美在线一二三| 亚洲欧洲成人精品av97| 国产一区二区中文字幕| 日韩视频在线你懂得| 亚洲成人av一区二区| 精品国产成人系列| 亚洲午夜国产一区99re久久| 色综合一区二区| 国产精品伦一区| 国产凹凸在线观看一区二区| 久久欧美中文字幕| 久久99久国产精品黄毛片色诱| 成a人片国产精品| 欧美精品vⅰdeose4hd| 一区二区三区免费网站| 成人黄色一级视频| 中文字幕不卡三区| 国产a精品视频| 亚洲国产成人一区二区三区| 国产在线精品视频| 欧美tk丨vk视频| 久久99精品一区二区三区三区| 日韩三级视频中文字幕| 亚洲va欧美va国产va天堂影院| 欧美性大战久久久久久久| 国产精品久久久久四虎| 成人av在线资源网| 国产精品第一页第二页第三页| 成人性生交大片免费看视频在线| 国产亚洲欧美一区在线观看| 国产成人免费高清| 久久久精品国产免大香伊| 国产精一区二区三区| 亚洲国产精品精华液2区45| 国产99久久精品| 国产精品乱人伦| aaa欧美色吧激情视频| 久久精品国产一区二区三| 日韩色视频在线观看| 久久精品理论片| 国产日韩欧美一区二区三区综合 | 91在线一区二区三区| 国产精品第一页第二页第三页| 99免费精品在线观看| 日韩美女精品在线| 在线观看区一区二| 日本午夜精品视频在线观看 | 国产精品99久久久久久有的能看| 国产一区二区三区综合| 久久精品人人爽人人爽| 99视频精品免费视频| 亚洲一区二区在线视频| 3751色影院一区二区三区| 国精产品一区一区三区mba视频 | 成+人+亚洲+综合天堂| 亚洲视频你懂的| 精品视频123区在线观看| 美女视频免费一区| 欧美激情在线看| 欧美视频在线一区二区三区| 老色鬼精品视频在线观看播放| 日韩精品成人一区二区三区| 欧美一区日韩一区| 国产成人在线看| 亚洲国产欧美另类丝袜| 精品美女一区二区| 不卡一区二区中文字幕| 水蜜桃久久夜色精品一区的特点| 26uuu国产电影一区二区| 色综合咪咪久久| 日韩av在线发布| 国产精品久久久久影院色老大| 欧美日韩精品一二三区| 国产成人鲁色资源国产91色综| 一区二区三区成人| 欧美tickling网站挠脚心| 久久精品这里都是精品| 一本久久精品一区二区| 亚洲 欧美综合在线网络| 精品国产三级电影在线观看| 91亚洲国产成人精品一区二三| 同产精品九九九| 国产日韩欧美精品综合| 欧美日韩第一区日日骚| 国产suv一区二区三区88区| 性感美女久久精品| 国产精品久久国产精麻豆99网站 | 天堂精品中文字幕在线| 日韩影院精彩在线| 国产日本亚洲高清| 欧美日韩国产另类不卡| 风间由美中文字幕在线看视频国产欧美 | 亚洲国产精品一区二区www | 成人在线综合网| 免费欧美日韩国产三级电影| 亚洲欧美综合在线精品| 精品国产免费人成在线观看| 欧洲中文字幕精品| 成人av综合一区| 久久成人综合网| 午夜精品一区二区三区电影天堂 | 亚洲高清免费一级二级三级| 久久久欧美精品sm网站| 欧美日韩精品一区二区三区蜜桃 | 亚洲精品水蜜桃| 欧美国产激情二区三区| 欧美不卡在线视频| 欧美亚洲国产一区二区三区va| 成人精品视频.| 国产一区二区三区在线观看精品| 日韩不卡一区二区| 国产成人综合在线播放| 欧美a一区二区| 午夜精品福利一区二区蜜股av| 亚洲欧美色综合| 国产精品每日更新| 久久久精品国产免大香伊| 欧美一区二区三区喷汁尤物| 在线欧美日韩国产| 99久精品国产| www.亚洲色图.com| 国产成人精品一区二区三区四区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 日韩一区二区免费视频| 精品视频1区2区| 色天天综合色天天久久| 91美女视频网站| 9l国产精品久久久久麻豆| 成人精品一区二区三区四区 | 亚洲欧美偷拍三级| 欧美国产成人在线| 国产欧美一区视频| 国产欧美精品一区二区色综合 | 99视频在线观看一区三区| 成人黄色av电影| 日韩欧美一级在线播放| 在线播放日韩导航| 777a∨成人精品桃花网| 欧美日本免费一区二区三区| 欧美精品日韩综合在线| 91精品黄色片免费大全| 欧美一区二区在线免费播放| 91精品国产色综合久久| 欧美一区二区三区婷婷月色| 日韩你懂的电影在线观看| 久久综合资源网| 欧美国产1区2区| ...中文天堂在线一区| 精品国产青草久久久久福利| xvideos.蜜桃一区二区| 久久久久久夜精品精品免费| 国产婷婷色一区二区三区四区| 亚洲国产岛国毛片在线| 成人免费在线视频观看| 亚洲一二三四久久| 天天色天天操综合| 久久国产日韩欧美精品| 国产精品亚洲第一区在线暖暖韩国| 成人黄色在线看|