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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? trees.c

?? mp3 source code decoder & encoder
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* trees.c -- output deflated data using Huffman coding
 * Copyright (C) 1995-1996 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.11 1996/07/24 13:41:06 me Exp $ */

#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 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 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 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 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.
 */

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.)
 */

local uch dist_code[512];
/* 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.
 */

local 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) */

struct static_tree_desc_s {
    ct_data *static_tree;        /* static tree or NULL */
    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 =
{(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));

#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 (verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
       send_bits(s, tree[c].Code, tree[c].Len); }
#endif

#define d_code(dist) \
   ((dist) < 256 ? dist_code[dist] : dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
 * must not have side effects. dist_code[256] and dist_code[257] are never
 * used.
 */

/* ===========================================================================
 * 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 */


#define MAX(a,b) (a >= b ? a : b)
/* the arguments must not have side effects */

/* ===========================================================================
 * Initialize the various 'constant' tables. In a multi-threaded environment,
 * this function may be called by two threads concurrently, but this is
 * harmless since both invocations do exactly the same thing.
 */
local void tr_static_init()
{
    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;

    /* 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;
}

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

    s->compressed_len = 0L;

    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->bits_sent = 0L;
#endif

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

/* ===========================================================================
 * Initialize a new block.
 */
local void init_block(s)
    deflate_state *s;
{
    int n; /* iterates over tree elements */

    /* Initialize the trees. */
    for (n = 0; n < L_CODES;  n++) s->dyn_ltree[n].Freq = 0;
    for (n = 0; n < D_CODES;  n++) s->dyn_dtree[n].Freq = 0;
    for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;

    s->dyn_ltree[END_BLOCK].Freq = 1;
    s->opt_len = s->static_len = 0L;
    s->last_lit = s->matches = 0;
}

#define SMALLEST 1
/* Index within the heap array of least frequent node in the Huffman tree */


/* ===========================================================================
 * Remove the smallest element from the heap and recreate the heap with
 * one less element. Updates heap and heap_len.
 */
#define pqremove(s, tree, top) \
{\
    top = s->heap[SMALLEST]; \
    s->heap[SMALLEST] = s->heap[s->heap_len--]; \
    pqdownheap(s, tree, SMALLEST); \
}

/* ===========================================================================
 * Compares to subtrees, using the tree depth as tie breaker when
 * the subtrees have equal frequency. This minimizes the worst case length.
 */
#define smaller(tree, n, m, depth) \
   (tree[n].Freq < tree[m].Freq || \
   (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))

/* ===========================================================================
 * Restore the heap property by moving down the tree starting at node k,
 * exchanging a node with the smallest of its two sons if necessary, stopping
 * when the heap property is re-established (each father smaller than its
 * two sons).
 */
local void pqdownheap(s, tree, k)
    deflate_state *s;
    ct_data *tree;  /* the tree to restore */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜视频一区二区| 欧美日韩午夜在线| 专区另类欧美日韩| 欧美日韩视频在线一区二区| 首页国产欧美久久| 樱桃视频在线观看一区| 91精品国产福利在线观看| www.欧美日韩| 另类小说综合欧美亚洲| 亚洲卡通欧美制服中文| 久久综合久色欧美综合狠狠| 91黄色激情网站| 91丨porny丨首页| 国产精品自拍网站| 人人狠狠综合久久亚洲| 一区二区三区欧美日韩| 欧美激情一区在线观看| 日韩精品中文字幕一区二区三区| 成人的网站免费观看| 免费高清在线一区| 久久亚洲欧美国产精品乐播| 亚洲人成人一区二区在线观看| 欧美一级电影网站| 欧美日韩国产首页在线观看| 99国产精品国产精品久久| 国产成人啪免费观看软件 | 亚洲三级理论片| 欧美激情综合五月色丁香小说| 久久综合色一综合色88| 久久先锋影音av| 国产女同互慰高潮91漫画| 久久精品一区二区三区四区| 久久亚洲春色中文字幕久久久| 精品久久久久久久久久久久久久久久久| 欧美男生操女生| 欧美成人高清电影在线| 精品久久久久久久久久久院品网| 久久久综合网站| 国产精品久久三| 香蕉加勒比综合久久| 狠狠网亚洲精品| 91色视频在线| 日韩一二三区不卡| 久久美女艺术照精彩视频福利播放| 国产亚洲精久久久久久| 亚洲人亚洲人成电影网站色| 亚洲国产成人av网| 国产传媒一区在线| 欧美综合久久久| 国产精品久久久久久久裸模 | 全部av―极品视觉盛宴亚洲| 九九视频精品免费| 在线这里只有精品| 久久久精品影视| 日韩在线一二三区| 成人黄色电影在线 | 91精品国产乱码| 成人欧美一区二区三区1314| 麻豆91精品视频| 91福利国产成人精品照片| 国产日韩欧美一区二区三区综合 | 99re在线精品| 欧美国产日韩一二三区| 日韩—二三区免费观看av| 91国偷自产一区二区开放时间 | 亚洲欧美区自拍先锋| 国产精一区二区三区| 欧美一级理论片| 亚洲天堂网中文字| 韩国在线一区二区| 欧美一区二区三区在线观看视频| 日韩视频中午一区| 免费成人结看片| 欧美日韩在线电影| 亚洲欧洲日产国码二区| 国模冰冰炮一区二区| 欧美电视剧在线观看完整版| 日韩亚洲欧美成人一区| 欧美日韩中文一区| 国产拍欧美日韩视频二区| 精品一区二区三区影院在线午夜| 色婷婷一区二区三区四区| 中文字幕第一区综合| 久久精品国产一区二区三| 日韩一区二区在线观看视频 | 91社区在线播放| 久久久不卡网国产精品二区| 九色综合国产一区二区三区| 日韩网站在线看片你懂的| av中文字幕在线不卡| 成人午夜视频在线观看| 亚洲欧美在线高清| 一本色道久久综合狠狠躁的推荐 | 亚洲永久免费视频| 国产裸体歌舞团一区二区| 91视频一区二区| 午夜精品一区二区三区免费视频| 欧美日韩在线播放一区| 亚洲柠檬福利资源导航| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 欧美日韩精品系列| 久久成人羞羞网站| 欧美精彩视频一区二区三区| 一本一本大道香蕉久在线精品| 亚洲免费观看高清完整版在线观看熊| 色婷婷激情综合| 麻豆精品一区二区三区| 国产精品免费久久久久| 91精品国产一区二区人妖| 国产成人鲁色资源国产91色综| 亚洲视频你懂的| 欧美精品自拍偷拍动漫精品| 国产精品主播直播| 亚洲电影在线播放| 国产日韩精品一区二区三区| 国模无码大尺度一区二区三区| 一区二区国产视频| 国产亚洲精品aa午夜观看| 欧美三级欧美一级| 成人性生交大片免费看视频在线 | 久久99热狠狠色一区二区| 国产亚洲欧洲一区高清在线观看| 91精品福利视频| 成人激情电影免费在线观看| 免费av网站大全久久| 日韩精品专区在线影院重磅| 成人午夜电影小说| 日本欧美肥老太交大片| 国产精品久久久久影院| 国产视频亚洲色图| 国产色一区二区| 在线播放日韩导航| 欧美日韩色综合| 在线视频欧美精品| 日本高清不卡在线观看| 国产风韵犹存在线视精品| 国产一区在线观看视频| 韩国欧美一区二区| 亚洲免费在线播放| 2021中文字幕一区亚洲| 99久久久精品| 欧美性大战久久| 欧美三级日韩三级国产三级| 欧美日韩国产精品自在自线| 93久久精品日日躁夜夜躁欧美| 夜夜精品浪潮av一区二区三区| 91在线观看美女| 99久久er热在这里只有精品15 | 国产精品美日韩| 亚洲美女淫视频| 亚洲h动漫在线| 久久www免费人成看片高清| 粉嫩av一区二区三区粉嫩| 日本高清视频一区二区| 91精品欧美久久久久久动漫| 欧美zozo另类异族| 亚洲色图欧洲色图婷婷| 中文字幕在线不卡国产视频| 一区二区三区四区激情| 日本欧美久久久久免费播放网| 国产一区免费电影| 91蝌蚪国产九色| 日韩精品中文字幕在线一区| 欧美亚洲免费在线一区| 日韩一区二区三区视频| 中文字幕精品一区二区精品绿巨人 | 91啪亚洲精品| 日韩一区二区三区四区五区六区| 欧美电影免费观看高清完整版| 中文子幕无线码一区tr| 亚洲综合男人的天堂| 成人免费观看av| 欧美一级片在线看| 亚洲一区成人在线| 成人午夜在线视频| 精品国产91亚洲一区二区三区婷婷| 国产精品麻豆99久久久久久| 另类人妖一区二区av| 91成人免费在线视频| 伊人夜夜躁av伊人久久| 五月激情六月综合| 99免费精品在线观看| 国产91丝袜在线播放九色| 色视频成人在线观看免| 欧美mv和日韩mv国产网站| 日韩 欧美一区二区三区| 丁香婷婷综合色啪| www国产成人| 国产精品一区二区x88av| 3atv在线一区二区三区| 亚洲天堂久久久久久久| 99久久婷婷国产精品综合| 欧美激情在线一区二区| 国产夫妻精品视频| 欧美激情一区三区| 成人午夜精品一区二区三区| 精品视频在线看| 亚洲精品国产无天堂网2021| 91丨porny丨蝌蚪视频| 亚洲精品日产精品乱码不卡|