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

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

?? trees.c

?? mp3 source code decoder & encoder
?? C
?? 第 1 頁 / 共 3 頁
字號:
    int k;               /* node to move down */
{
    int v = s->heap[k];
    int j = k << 1;  /* left son of k */
    while (j <= s->heap_len) {
        /* Set j to the smallest of the two sons: */
        if (j < s->heap_len &&
            smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
            j++;
        }
        /* Exit if v is smaller than both sons */
        if (smaller(tree, v, s->heap[j], s->depth)) break;

        /* Exchange v with the smallest son */
        s->heap[k] = s->heap[j];  k = j;

        /* And continue down the tree, setting j to the left son of k */
        j <<= 1;
    }
    s->heap[k] = v;
}

/* ===========================================================================
 * Compute the optimal bit lengths for a tree and update the total bit length
 * for the current block.
 * IN assertion: the fields freq and dad are set, heap[heap_max] and
 *    above are the tree nodes sorted by increasing frequency.
 * OUT assertions: the field len is set to the optimal bit length, the
 *     array bl_count contains the frequencies for each bit length.
 *     The length opt_len is updated; static_len is also updated if stree is
 *     not null.
 */
local void gen_bitlen(deflate_state *s, tree_desc *desc)
/* desc     the tree descriptor */
{
    ct_data *tree  = desc->dyn_tree;
    int max_code   = desc->max_code;
    ct_data *stree = desc->stat_desc->static_tree;
    intf *extra    = desc->stat_desc->extra_bits;
    int base       = desc->stat_desc->extra_base;
    int max_length = desc->stat_desc->max_length;
    int h;              /* heap index */
    int n, m;           /* iterate over the tree elements */
    int bits;           /* bit length */
    int xbits;          /* extra bits */
    ush f;              /* frequency */
    int overflow = 0;   /* number of elements with bit length too large */

    for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;

    /* In a first pass, compute the optimal bit lengths (which may
     * overflow in the case of the bit length tree).
     */
    tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */

    for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
        n = s->heap[h];
        bits = tree[tree[n].Dad].Len + 1;
        if (bits > max_length) bits = max_length, overflow++;
        tree[n].Len = (ush)bits;
        /* We overwrite tree[n].Dad which is no longer needed */

        if (n > max_code) continue; /* not a leaf node */

        s->bl_count[bits]++;
        xbits = 0;
        if (n >= base) xbits = extra[n-base];
        f = tree[n].Freq;
        s->opt_len += (ulg)f * (bits + xbits);
        if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
    }
    if (overflow == 0) return;

    Trace((stderr,"\nbit length overflow\n"));
    /* This happens for example on obj2 and pic of the Calgary corpus */

    /* Find the first bit length which could increase: */
    do {
        bits = max_length-1;
        while (s->bl_count[bits] == 0) bits--;
        s->bl_count[bits]--;      /* move one leaf down the tree */
        s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
        s->bl_count[max_length]--;
        /* The brother of the overflow item also moves one step up,
         * but this does not affect bl_count[max_length]
         */
        overflow -= 2;
    } while (overflow > 0);

    /* Now recompute all bit lengths, scanning in increasing frequency.
     * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
     * lengths instead of fixing only the wrong ones. This idea is taken
     * from 'ar' written by Haruhiko Okumura.)
     */
    for (bits = max_length; bits != 0; bits--) {
        n = s->bl_count[bits];
        while (n != 0) {
            m = s->heap[--h];
            if (m > max_code) continue;
            if (tree[m].Len != (unsigned) bits) {
                Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
                s->opt_len += ((long)bits - (long)tree[m].Len)
                              *(long)tree[m].Freq;
                tree[m].Len = (ush)bits;
            }
            n--;
        }
    }
}

/* ===========================================================================
 * Generate the codes for a given tree and bit counts (which need not be
 * optimal).
 * IN assertion: the array bl_count contains the bit length statistics for
 * the given tree and the field len is set for all tree elements.
 * OUT assertion: the field code is set for all tree elements of non
 *     zero code length.
 */
local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
/* tree         the tree to decorate */
/* max_code     largest code with non zero frequency */
/* bl_count     number of codes at each bit length */
{
    ush next_code[MAX_BITS+1]; /* next code value for each bit length */
    ush code = 0;              /* running code value */
    int bits;                  /* bit index */
    int n;                     /* code index */

    /* The distribution counts are first used to generate the code values
     * without bit reversal.
     */
    for (bits = 1; bits <= MAX_BITS; bits++) {
        next_code[bits] = code = (code + bl_count[bits-1]) << 1;
    }
    /* Check that the bit counts in bl_count are consistent. The last code
     * must be all ones.
     */
    Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
            "inconsistent bit counts");
    Tracev((stderr,"\ngen_codes: max_code %d ", max_code));

    for (n = 0;  n <= max_code; n++) {
        int len = tree[n].Len;
        if (len == 0) continue;
        /* Now reverse the bits */
        tree[n].Code = bi_reverse(next_code[len]++, len);

        Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
             n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
    }
}

/* ===========================================================================
 * Construct one Huffman tree and assigns the code bit strings and lengths.
 * Update the total bit length for the current block.
 * IN assertion: the field freq is set for all tree elements.
 * OUT assertions: the fields len and code are set to the optimal bit length
 *     and corresponding code. The length opt_len is updated; static_len is
 *     also updated if stree is not null. The field max_code is set.
 */
local void build_tree(deflate_state *s, tree_desc *desc)
/* desc; the tree descriptor */
{
    ct_data *tree   = desc->dyn_tree;
    ct_data *stree  = desc->stat_desc->static_tree;
    int elems       = desc->stat_desc->elems;
    int n, m;          /* iterate over heap elements */
    int max_code = -1; /* largest code with non zero frequency */
    int node;          /* new node being created */

    /* Construct the initial heap, with least frequent element in
     * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
     * heap[0] is not used.
     */
    s->heap_len = 0, s->heap_max = HEAP_SIZE;

    for (n = 0; n < elems; n++) {
        if (tree[n].Freq != 0) {
            s->heap[++(s->heap_len)] = max_code = n;
            s->depth[n] = 0;
        } else {
            tree[n].Len = 0;
        }
    }

    /* The pkzip format requires that at least one distance code exists,
     * and that at least one bit should be sent even if there is only one
     * possible code. So to avoid special checks later on we force at least
     * two codes of non zero frequency.
     */
    while (s->heap_len < 2) {
        node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
        tree[node].Freq = 1;
        s->depth[node] = 0;
        s->opt_len--; if (stree) s->static_len -= stree[node].Len;
        /* node is 0 or 1 so it does not have extra bits */
    }
    desc->max_code = max_code;

    /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
     * establish sub-heaps of increasing lengths:
     */
    for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);

    /* Construct the Huffman tree by repeatedly combining the least two
     * frequent nodes.
     */
    node = elems;              /* next internal node of the tree */
    do {
        pqremove(s, tree, n);  /* n = node of least frequency */
        m = s->heap[SMALLEST]; /* m = node of next least frequency */

        s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
        s->heap[--(s->heap_max)] = m;

        /* Create a new node father of n and m */
        tree[node].Freq = tree[n].Freq + tree[m].Freq;
        s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
        tree[n].Dad = tree[m].Dad = (ush)node;
#ifdef DUMP_BL_TREE
        if (tree == s->bl_tree) {
            fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
                    node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
        }
#endif
        /* and insert the new node in the heap */
        s->heap[SMALLEST] = node++;
        pqdownheap(s, tree, SMALLEST);

    } while (s->heap_len >= 2);

    s->heap[--(s->heap_max)] = s->heap[SMALLEST];

    /* At this point, the fields freq and dad are set. We can now
     * generate the bit lengths.
     */
    gen_bitlen(s, (tree_desc *)desc);

    /* The field len is now set, we can generate the bit codes */
    gen_codes ((ct_data *)tree, max_code, s->bl_count);
}

/* ===========================================================================
 * Scan a literal or distance tree to determine the frequencies of the codes
 * in the bit length tree.
 */
local void scan_tree (s, tree, max_code)
    deflate_state *s;
    ct_data *tree;   /* the tree to be scanned */
    int max_code;    /* and its largest code of non zero frequency */
{
    int n;                     /* iterates over all tree elements */
    int prevlen = -1;          /* last emitted length */
    int curlen;                /* length of current code */
    int nextlen = tree[0].Len; /* length of next code */
    int count = 0;             /* repeat count of the current code */
    int max_count = 7;         /* max repeat count */
    int min_count = 4;         /* min repeat count */

    if (nextlen == 0) max_count = 138, min_count = 3;
    tree[max_code+1].Len = (ush)0xffff; /* guard */

    for (n = 0; n <= max_code; n++) {
        curlen = nextlen; nextlen = tree[n+1].Len;
        if (++count < max_count && curlen == nextlen) {
            continue;
        } else if (count < min_count) {
            s->bl_tree[curlen].Freq += count;
        } else if (curlen != 0) {
            if (curlen != prevlen) s->bl_tree[curlen].Freq++;
            s->bl_tree[REP_3_6].Freq++;
        } else if (count <= 10) {
            s->bl_tree[REPZ_3_10].Freq++;
        } else {
            s->bl_tree[REPZ_11_138].Freq++;
        }
        count = 0; prevlen = curlen;
        if (nextlen == 0) {
            max_count = 138, min_count = 3;
        } else if (curlen == nextlen) {
            max_count = 6, min_count = 3;
        } else {
            max_count = 7, min_count = 4;
        }
    }
}

/* ===========================================================================
 * Send a literal or distance tree in compressed form, using the codes in
 * bl_tree.
 */
local void send_tree (s, tree, max_code)
    deflate_state *s;
    ct_data *tree; /* the tree to be scanned */
    int max_code;       /* and its largest code of non zero frequency */
{
    int n;                     /* iterates over all tree elements */
    int prevlen = -1;          /* last emitted length */
    int curlen;                /* length of current code */
    int nextlen = tree[0].Len; /* length of next code */
    int count = 0;             /* repeat count of the current code */
    int max_count = 7;         /* max repeat count */
    int min_count = 4;         /* min repeat count */

    /* tree[max_code+1].Len = -1; */  /* guard already set */
    if (nextlen == 0) max_count = 138, min_count = 3;

    for (n = 0; n <= max_code; n++) {
        curlen = nextlen; nextlen = tree[n+1].Len;
        if (++count < max_count && curlen == nextlen) {
            continue;
        } else if (count < min_count) {
            do { send_code(s, curlen, s->bl_tree); } while (--count != 0);

        } else if (curlen != 0) {
            if (curlen != prevlen) {
                send_code(s, curlen, s->bl_tree); count--;
            }
            Assert(count >= 3 && count <= 6, " 3_6?");
            send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);

        } else if (count <= 10) {
            send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);

        } else {
            send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
        }
        count = 0; prevlen = curlen;
        if (nextlen == 0) {
            max_count = 138, min_count = 3;
        } else if (curlen == nextlen) {
            max_count = 6, min_count = 3;
        } else {
            max_count = 7, min_count = 4;
        }
    }
}

/* ===========================================================================
 * Construct the Huffman tree for the bit lengths and return the index in
 * bl_order of the last bit length code to send.
 */
local int build_bl_tree(s)
    deflate_state *s;
{
    int max_blindex;  /* index of last bit length code of non zero freq */

    /* Determine the bit length frequencies for literal and distance trees */
    scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
    scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);

    /* Build the bit length tree: */
    build_tree(s, (tree_desc *)(&(s->bl_desc)));
    /* opt_len now includes the length of the tree representations, except
     * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
     */

    /* Determine the number of bit length codes to send. The pkzip format
     * requires that at least 4 bit length codes be sent. (appnote.txt says
     * 3 but the actual value used is 4.)
     */
    for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
        if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
    }
    /* Update opt_len to include the bit length tree and counts */
    s->opt_len += 3*(max_blindex+1) + 5+5+4;
    Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
            s->opt_len, s->static_len));

    return max_blindex;
}

/* ===========================================================================
 * Send the header for a block using dynamic Huffman trees: the counts, the
 * lengths of the bit length codes, the literal tree and the distance tree.
 * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
 */
local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
/* lcodes, dcodes, blcodes       number of codes for each tree */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品伦理一区二区| 91在线视频观看| av亚洲精华国产精华| 欧洲一区二区三区在线| 日韩午夜在线播放| 一级精品视频在线观看宜春院| 日韩1区2区3区| 91国产福利在线| 国产欧美一区二区三区鸳鸯浴| 七七婷婷婷婷精品国产| 95精品视频在线| 欧美国产一区二区在线观看 | 欧美精品色一区二区三区| 国产日韩欧美综合在线| 性欧美大战久久久久久久久| 99久久综合狠狠综合久久| 久久久99免费| 久久 天天综合| 欧美一区二区大片| 奇米一区二区三区av| 欧美日韩五月天| 丝袜诱惑亚洲看片| 欧美日韩国产一区| 亚洲成人黄色影院| 欧美日韩国产高清一区二区三区 | 91浏览器在线视频| 欧美一二三四在线| 亚洲天天做日日做天天谢日日欢| 日日夜夜精品视频天天综合网| av激情综合网| 中文字幕av一区二区三区高| 精久久久久久久久久久| 日韩免费高清电影| 久久99精品国产.久久久久| 日韩视频免费观看高清在线视频| 亚洲国产精品自拍| 欧美色图天堂网| 亚洲午夜羞羞片| 欧美日韩一本到| 亚洲成人手机在线| 欧美精品久久99| 麻豆国产91在线播放| 欧美va日韩va| 国产精品一二三四| 国产精品每日更新在线播放网址| 国产真实乱对白精彩久久| 亚洲精品在线网站| 国内精品伊人久久久久影院对白| 欧美精品一区二区三区久久久| 韩国女主播一区二区三区| 久久久久高清精品| 不卡的电影网站| 亚洲狠狠丁香婷婷综合久久久| 日本久久一区二区| 日韩影视精彩在线| 欧美v国产在线一区二区三区| 国产伦精一区二区三区| 国产精品灌醉下药二区| 欧美丝袜丝交足nylons图片| 麻豆精品一区二区三区| 久久精品一区二区三区四区| 91视频在线观看免费| 一区二区三区久久| 日韩一区二区三区四区| 成人免费高清在线观看| 亚洲欧美日韩人成在线播放| 欧美探花视频资源| 国产真实乱对白精彩久久| 国产亚洲一区二区在线观看| 91久久香蕉国产日韩欧美9色| 免费看欧美女人艹b| 国产精品久久久久天堂| 欧美另类久久久品| www.日韩大片| 国内成+人亚洲+欧美+综合在线| 国产精品久久久久婷婷 | 成人精品视频一区二区三区尤物| 一区二区三区欧美| 久久亚洲精精品中文字幕早川悠里 | 亚洲高清不卡在线观看| 久久综合九色综合97婷婷| 色妹子一区二区| 国产精品538一区二区在线| 亚洲在线中文字幕| 国产午夜精品一区二区三区视频| 欧美日韩在线播放一区| jlzzjlzz亚洲日本少妇| 亚洲午夜久久久久久久久久久| 欧美在线免费观看视频| 国产成人av电影在线观看| 亚洲成人免费在线| 亚洲欧洲av色图| 精品sm捆绑视频| 日韩欧美一级二级三级| 在线精品国精品国产尤物884a| 国产成人日日夜夜| 免费在线视频一区| 亚洲国产一区二区三区| 亚洲欧美一区二区三区国产精品 | 国产精品国产三级国产a| 欧美精品色综合| 欧美在线999| 99久久免费精品| 成人手机在线视频| 国产酒店精品激情| 国模大尺度一区二区三区| 亚洲成人精品影院| 亚洲综合色自拍一区| 一区二区不卡在线播放| 一区二区三区精品久久久| 国产精品沙发午睡系列990531| 久久理论电影网| 国产喂奶挤奶一区二区三区| 久久精品亚洲精品国产欧美kt∨| 欧美xxxx老人做受| 精品999在线播放| 26uuu精品一区二区在线观看| 日韩一级免费观看| 日韩美女一区二区三区四区| 欧美sm极限捆绑bd| 久久久久久久久蜜桃| 久久精品水蜜桃av综合天堂| 久久精品一区八戒影视| 国产精品网站导航| 亚洲日本va午夜在线电影| 亚洲乱码国产乱码精品精98午夜 | 国产精品另类一区| 中文字幕一区在线观看| 亚洲欧美一区二区久久 | 国产精品欧美久久久久一区二区| 国产欧美日韩三区| 亚洲女同ⅹxx女同tv| 亚洲图片欧美视频| 久久av中文字幕片| 国产成人免费视频精品含羞草妖精| 国产一区亚洲一区| 成人听书哪个软件好| aaa欧美色吧激情视频| 在线精品视频小说1| 欧美一区二区女人| 久久嫩草精品久久久精品一| 中文字幕精品一区| 亚洲高清免费一级二级三级| 另类欧美日韩国产在线| 国产成人夜色高潮福利影视| 91原创在线视频| 91精品国产综合久久香蕉麻豆| 久久久亚洲精品石原莉奈| 亚洲精品乱码久久久久久日本蜜臀| 午夜久久久久久久久| 国产精品亚洲午夜一区二区三区| 97久久超碰精品国产| 日韩欧美中文字幕公布| 国产精品美女一区二区三区 | 国产成人福利片| 在线观看日韩毛片| 2023国产精华国产精品| 中文字幕日韩一区二区| 免费在线成人网| 91在线丨porny丨国产| 欧美不卡一区二区| 亚洲视频一区二区在线| 另类小说一区二区三区| 91高清视频在线| 精品对白一区国产伦| 亚洲精品成人悠悠色影视| 国产一区二区在线观看视频| 欧美中文字幕久久| 国产视频一区二区在线| 亚洲午夜精品17c| 福利视频网站一区二区三区| 91精品欧美综合在线观看最新 | 99免费精品在线观看| 91精品国产综合久久久蜜臀图片| 亚洲欧洲99久久| 国产精品自拍av| 日韩一区二区在线看片| 伊人色综合久久天天人手人婷| 国产在线不卡一区| 欧美一区二区网站| 亚洲成人av中文| gogogo免费视频观看亚洲一| 精品国产电影一区二区| 三级在线观看一区二区| 在线亚洲一区二区| 亚洲视频1区2区| 99精品视频中文字幕| 日本一区二区三区久久久久久久久不 | av不卡在线观看| 日本一区二区成人| 国产高清亚洲一区| 精品嫩草影院久久| 青青草国产精品亚洲专区无| 欧美日韩精品一区二区三区蜜桃 | 国产亚洲精久久久久久| 日本午夜精品视频在线观看| 91.xcao| 午夜a成v人精品| 欧美日韩大陆一区二区| 亚洲国产人成综合网站|