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

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

?? fstenc.c

?? windows gzip source code
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*
 * fstenc.c
 *
 * Fast encoder
 *
 * This is a one pass encoder which uses predefined trees.  However, since these are not the same
 * trees defined for a fixed block (we use better trees than that), we output a dynamic block header.
 */
#include <string.h>
#include <stdio.h>
#include <crtdbg.h>
#include "deflate.h"
#include "fasttbl.h"


//
// For debugging purposes:
//
// Verifies that all of the hash pointers in the hash table are correct, and that everything
// in the same hash chain has the same hash value
//
#ifdef FULL_DEBUG
#define VERIFY_HASHES(bufpos) FastEncoderVerifyHashes(context, bufpos)
#else
#define VERIFY_HASHES(bufpos) ;
#endif


//
// Update hash variable "h" with character c
//
#define UPDATE_HASH(h,c) \
	h = ((h) << FAST_ENCODER_HASH_SHIFT) ^ (c);


//
// Insert a string into the hash chain at location bufpos
//
#define INSERT_STRING(search,bufpos) \
{ \
	UPDATE_HASH(hash, window[bufpos+2]); \
\
	_ASSERT((unsigned int) FAST_ENCODER_RECALCULATE_HASH(bufpos) == (unsigned int) (hash & FAST_ENCODER_HASH_MASK)); \
\
    search = lookup[hash & FAST_ENCODER_HASH_MASK]; \
	lookup[hash & FAST_ENCODER_HASH_MASK] = (t_search_node) (bufpos); \
	prev[bufpos & FAST_ENCODER_WINDOW_MASK] = (t_search_node) (search); \
}


//
// Output bits function which uses local variables for the bit buffer
//
#define LOCAL_OUTPUT_BITS(n, x) \
{ \
	bitbuf |= ((x) << bitcount); \
	bitcount += (n); \
	if (bitcount >= 16) \
    { \
		*output_curpos++ = (BYTE) bitbuf; \
		*output_curpos++ = (BYTE) (bitbuf >> 8); \
		bitcount -= 16; \
		bitbuf >>= 16; \
	} \
}


//
// Output unmatched symbol c
//
#define OUTPUT_CHAR(c) \
    LOCAL_OUTPUT_BITS(g_FastEncoderLiteralCodeInfo[c] & 31, g_FastEncoderLiteralCodeInfo[c] >> 5);


//
// Output a match with length match_len (>= MIN_MATCH) and displacement match_pos
//
// Optimisation: unlike the other encoders, here we have an array of codes for each match
// length (not just each match length slot), complete with all the extra bits filled in, in
// a single array element.  
//
// There are many advantages to doing this:
//
// 1. A single array lookup on g_FastEncoderLiteralCodeInfo, instead of separate array lookups
//    on g_LengthLookup (to get the length slot), g_FastEncoderLiteralTreeLength, 
//    g_FastEncoderLiteralTreeCode, g_ExtraLengthBits, and g_BitMask
//
// 2. The array is an array of ULONGs, so no access penalty, unlike for accessing those USHORT
//    code arrays in the other encoders (although they could be made into ULONGs with some
//    modifications to the source).
//
// Note, if we could guarantee that code_len <= 16 always, then we could skip an if statement here.
//
// A completely different optimisation is used for the distance codes since, obviously, a table for 
// all 8192 distances combining their extra bits is not feasible.  The distance codeinfo table is 
// made up of code[], len[] and # extra_bits for this code.
//
// The advantages are similar to the above; a ULONG array instead of a USHORT and BYTE array, better
// cache locality, fewer memory operations.
//
#define OUTPUT_MATCH(match_len, match_pos) \
{ \
    int extra_bits; \
    int code_len; \
    ULONG code_info; \
\
	_ASSERT(match_len >= MIN_MATCH && match_len <= MAX_MATCH); \
\
    code_info = g_FastEncoderLiteralCodeInfo[(NUM_CHARS+1-MIN_MATCH)+match_len]; \
    code_len = code_info & 31; \
    _ASSERT(code_len != 0); \
    if (code_len <= 16) \
    { \
        LOCAL_OUTPUT_BITS(code_len, code_info >> 5); \
    } \
    else \
    { \
        LOCAL_OUTPUT_BITS(16, (code_info >> 5) & 65535); \
        LOCAL_OUTPUT_BITS(code_len-16, code_info >> (5+16)); \
    } \
    code_info = g_FastEncoderDistanceCodeInfo[POS_SLOT(match_pos)]; \
    LOCAL_OUTPUT_BITS(code_info & 15, code_info >> 8); \
    extra_bits = (code_info >> 4) & 15; \
    if (extra_bits != 0) LOCAL_OUTPUT_BITS(extra_bits, (match_pos) & g_BitMask[extra_bits]); \
}


//
// This commented out code is the old way of doing things, which is what the other encoders use
//
#if 0
#define OUTPUT_MATCH(match_len, match_pos) \
{ \
	int pos_slot = POS_SLOT(match_pos); \
	int len_slot = g_LengthLookup[match_len - MIN_MATCH]; \
    int extra_bits; \
\
	_ASSERT(match_len >= MIN_MATCH && match_len <= MAX_MATCH); \
    _ASSERT(g_FastEncoderLiteralTreeLength[(NUM_CHARS+1)+len_slot] != 0); \
    _ASSERT(g_FastEncoderDistanceTreeLength[pos_slot] != 0); \
\
    LOCAL_OUTPUT_BITS(g_FastEncoderLiteralTreeLength[(NUM_CHARS+1)+len_slot], g_FastEncoderLiteralTreeCode[(NUM_CHARS+1)+len_slot]); \
    extra_bits = g_ExtraLengthBits[len_slot]; \
    if (extra_bits != 0) LOCAL_OUTPUT_BITS(extra_bits, (match_len-MIN_MATCH) & g_BitMask[extra_bits]); \
\
    LOCAL_OUTPUT_BITS(g_FastEncoderDistanceTreeLength[pos_slot], g_FastEncoderDistanceTreeCode[pos_slot]); \
    extra_bits = g_ExtraDistanceBits[pos_slot]; \
    if (extra_bits != 0) LOCAL_OUTPUT_BITS(extra_bits, (match_pos) & g_BitMask[extra_bits]); \
}
#endif


//
// Local function prototypes
//
static void FastEncoderMoveWindows(t_encoder_context *context);

static int FastEncoderFindMatch(
    const BYTE *    window,
    const USHORT *  prev,
    long            bufpos, 
    long            search, 
    t_match_pos *   match_pos, 
    int             cutoff,
    int             nice_length
);


//
// Output the block type and tree structure for our hard-coded trees.
//
// Functionally equivalent to:
//
// outputBits(context, 1, 1); // "final" block flag
// outputBits(context, 2, BLOCKTYPE_DYNAMIC);
// outputTreeStructure(context, g_FastEncoderLiteralTreeLength, g_FastEncoderDistanceTreeLength);
//
// However, all of the above has smartly been cached in global data, so we just memcpy().
//
void FastEncoderOutputPreamble(t_encoder_context *context)
{
#if 0
    // slow way:
    outputBits(context, 1+2, 1 | (BLOCKTYPE_DYNAMIC << 1));
    outputTreeStructure(context, g_FastEncoderLiteralTreeLength, g_FastEncoderDistanceTreeLength);
#endif

    // make sure tree has been init
    _ASSERT(g_FastEncoderTreeLength > 0);

    // make sure we have enough space to output tree
    _ASSERT(context->output_curpos + g_FastEncoderTreeLength < context->output_endpos);

    // fast way:
    memcpy(context->output_curpos, g_FastEncoderTreeStructureData, g_FastEncoderTreeLength);
    context->output_curpos += g_FastEncoderTreeLength;

    // need to get final states of bitbuf and bitcount after outputting all that stuff
    context->bitbuf = g_FastEncoderPostTreeBitbuf;
    context->bitcount = g_FastEncoderPostTreeBitcount;
}


//
// Fast encoder deflate function
//
void FastEncoderDeflate(
	t_encoder_context *	context, 
    int                 search_depth, // # hash links to traverse
	int					lazy_match_threshold, // don't search @ X+1 if match length @ X is > lazy
    int                 good_length, // divide traversal depth by 4 if match length > good
    int                 nice_length // in match finder, if we find >= nice_length match, quit immediately
)
{
	long			bufpos;
	unsigned int	hash;
    unsigned long   bitbuf;
    int             bitcount;
    BYTE *          output_curpos;
    t_fast_encoder *encoder = context->fast_encoder;
	byte *			window = encoder->window; // make local copies of context variables
	t_search_node *	prev = encoder->prev;
	t_search_node *	lookup = encoder->lookup;

    //
    // If this is the first time in here (since last reset) then we need to output our dynamic
    // block header
    //
    if (encoder->fOutputBlockHeader == FALSE)
    {
        encoder->fOutputBlockHeader = TRUE;

        //
        // Watch out!  Calls to outputBits() and outputTreeStructure() use the bit buffer 
        // variables stored in the context, not our local cached variables.
        //
        FastEncoderOutputPreamble(context);
    }

    //
    // Copy bitbuf vars into local variables since we're now using OUTPUT_BITS macro.
    // Do not call anything that uses the context structure's bit buffer variables!
    //
    output_curpos   = context->output_curpos;
    bitbuf          = context->bitbuf;
    bitcount        = context->bitcount;

    // copy bufpos into local variable
    bufpos = context->bufpos;

	VERIFY_HASHES(bufpos); // debug mode: verify that the hash table is correct

    // initialise the value of the hash
    // no problem if locations bufpos, bufpos+1 are invalid (not enough data), since we will 
    // never insert using that hash value
	hash = 0;
	UPDATE_HASH(hash, window[bufpos]);
	UPDATE_HASH(hash, window[bufpos+1]);

    // while we haven't come to the end of the input, and we still aren't close to the end
    // of the output
	while (bufpos < context->bufpos_end && output_curpos < context->output_near_end_threshold)
	{
		int				match_len;
		t_match_pos		match_pos;
		t_match_pos		search;

    	VERIFY_HASHES(bufpos); // debugger: verify that hash table is correct

		if (context->bufpos_end - bufpos <= 3)
		{
			// The hash value becomes corrupt when we get within 3 characters of the end of the
            // input buffer, since the hash value is based on 3 characters.  We just stop
            // inserting into the hash table at this point, and allow no matches.
			match_len = 0;
		}
		else
		{
            // insert string into hash table and return most recent location of same hash value
			INSERT_STRING(search,bufpos);

            // did we find a recent location of this hash value?
			if (search != 0)
			{
    			// yes, now find a match at what we'll call position X
				match_len = FastEncoderFindMatch(window, prev, bufpos, search, &match_pos, search_depth, nice_length);

				// truncate match if we're too close to the end of the input buffer
				if (bufpos + match_len > context->bufpos_end)
					match_len = context->bufpos_end - bufpos;
			}
			else
			{
                // no most recent location found
				match_len = 0;
			}
		}

		if (match_len < MIN_MATCH)
		{
            // didn't find a match, so output unmatched char
			OUTPUT_CHAR(window[bufpos]);
    		bufpos++;
		}
		else
		{
	    	// bufpos now points to X+1
    		bufpos++;

			// is this match so good (long) that we should take it automatically without
			// checking X+1 ?
			if (match_len <= lazy_match_threshold)
			{
				int				next_match_len;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人爱爱电影网址| 91精品麻豆日日躁夜夜躁| 亚洲高清免费在线| 国产色一区二区| 91精品国产色综合久久不卡电影| 99re这里只有精品视频首页| 狠狠色狠狠色综合| 亚洲影视在线观看| 国产精品福利在线播放| 久久理论电影网| 7777精品伊人久久久大香线蕉超级流畅 | 成人免费在线视频观看| 精品美女一区二区| 欧美精品高清视频| 欧美日韩一级二级| 色天天综合色天天久久| a在线播放不卡| 国产成人免费网站| 国内外精品视频| 美女www一区二区| 日韩高清一区在线| 日本大胆欧美人术艺术动态| 婷婷综合久久一区二区三区| 亚洲午夜电影网| 亚洲永久精品国产| 亚洲一区二区不卡免费| 亚洲一区二区三区四区五区黄 | 国产精品二区一区二区aⅴ污介绍| 欧美精品一区二区蜜臀亚洲| 日韩一区二区精品在线观看| 欧美日韩国产小视频| 欧洲一区二区三区免费视频| 欧洲av在线精品| 欧美中文字幕一区| 欧美蜜桃一区二区三区 | 欧美激情综合五月色丁香小说| 精品动漫一区二区三区在线观看| 日韩欧美一级二级三级久久久| 欧美日韩国产在线播放网站| 337p亚洲精品色噜噜狠狠| 欧美精品一级二级三级| 欧美精品v日韩精品v韩国精品v| 51精品国自产在线| 欧美va亚洲va| 欧美国产精品一区二区三区| 中文字幕一区二区三区在线不卡| 亚洲欧美日韩久久| 亚洲成av人片一区二区梦乃| 日韩av不卡在线观看| 老司机精品视频一区二区三区| 国产尤物一区二区| 99久久伊人久久99| 欧美在线观看你懂的| 欧美一级日韩不卡播放免费| 久久综合资源网| 国产精品理论片| 亚洲第一主播视频| 韩国三级电影一区二区| 福利一区二区在线观看| 色呦呦一区二区三区| 欧美一区二区三区在线电影 | 国产欧美一区二区在线| 国产精品国产三级国产aⅴ入口| 亚洲免费在线播放| 日韩成人午夜电影| 高清在线观看日韩| 欧美午夜精品久久久久久超碰| 日韩亚洲欧美成人一区| 日本一区二区视频在线观看| 亚洲一区免费在线观看| 精品一区二区三区视频| 色综合色综合色综合| 欧美男人的天堂一二区| 久久久电影一区二区三区| 亚洲影院理伦片| 国产精品亚洲一区二区三区妖精| 日本韩国欧美一区二区三区| 日韩欧美国产一区在线观看| 综合色中文字幕| 奇米综合一区二区三区精品视频| 成人性生交大片免费看在线播放 | 日韩免费性生活视频播放| 国产精品成人在线观看| 蜜桃在线一区二区三区| av网站一区二区三区| 日韩欧美一二三四区| 亚洲精品自拍动漫在线| 国精品**一区二区三区在线蜜桃| 91国偷自产一区二区开放时间 | 久久福利视频一区二区| 日本久久精品电影| 国产欧美一区二区三区在线老狼| 婷婷综合久久一区二区三区| 成人18精品视频| 精品久久99ma| 日韩影院在线观看| 一本到不卡免费一区二区| 久久综合九色综合欧美就去吻| 亚洲成人黄色影院| 91啪在线观看| 国产日本一区二区| 日本vs亚洲vs韩国一区三区 | 午夜精品在线看| 91在线丨porny丨国产| 久久久久久久久久电影| 秋霞av亚洲一区二区三| 欧美性大战久久久久久久| 中文字幕一区二区三区在线播放| 狠狠色丁香久久婷婷综合丁香| 91精品中文字幕一区二区三区| 亚洲人精品午夜| 成人高清视频在线观看| 久久久一区二区三区捆绑**| 日本不卡免费在线视频| 欧美精品tushy高清| 亚洲午夜一区二区| 欧美自拍丝袜亚洲| 一区二区在线观看视频在线观看| 91日韩精品一区| 亚洲欧美日韩小说| 91麻豆福利精品推荐| 综合精品久久久| 色综合视频一区二区三区高清| 亚洲欧洲日韩女同| 99re这里都是精品| 亚洲男同性恋视频| 色狠狠色噜噜噜综合网| 依依成人综合视频| 精品视频1区2区| 午夜成人在线视频| 欧美精品精品一区| 美女一区二区三区在线观看| 日韩欧美一区在线观看| 麻豆91在线播放免费| 26uuu国产在线精品一区二区| 久久精品999| 国产亚洲午夜高清国产拍精品| 国产精品69久久久久水密桃| 国产欧美日韩综合| av一区二区久久| 亚洲一区在线观看免费观看电影高清| 色狠狠综合天天综合综合| 亚洲成人激情自拍| 欧美本精品男人aⅴ天堂| 韩国理伦片一区二区三区在线播放| 日韩免费电影网站| 国产精品综合在线视频| 中文字幕亚洲精品在线观看| 色婷婷综合久久久| 日韩国产精品久久| 日韩精品中文字幕一区二区三区 | 欧美精品一二三| 久久99热这里只有精品| 久久久不卡网国产精品二区| 成人深夜在线观看| 亚洲国产精品一区二区www| 欧美一区二区视频在线观看2020 | 日韩久久久精品| 国产精品一区二区在线观看网站| 国产精品国产三级国产aⅴ入口| 在线亚洲一区观看| 男人操女人的视频在线观看欧美| 久久久久久夜精品精品免费| av中文字幕亚洲| 亚洲va中文字幕| 久久伊人中文字幕| 91在线观看免费视频| 婷婷久久综合九色国产成人| 久久久久99精品一区| 色av综合在线| 狠狠色综合日日| 亚洲综合色自拍一区| 欧美不卡在线视频| 91小视频免费看| 美女视频一区在线观看| 国产精品国产成人国产三级| 欧美精选在线播放| jlzzjlzz亚洲日本少妇| 男人的j进女人的j一区| 国产精品福利在线播放| 日韩一级二级三级精品视频| 91网页版在线| 精品一区二区在线看| 亚洲一区欧美一区| 国产午夜精品在线观看| 91精品欧美一区二区三区综合在| 成人免费视频免费观看| 日韩av成人高清| 一区二区激情小说| 国产婷婷色一区二区三区在线| 欧美美女bb生活片| 91蜜桃传媒精品久久久一区二区| 韩国毛片一区二区三区| 日日摸夜夜添夜夜添国产精品 | 99综合电影在线视频| 精品一区二区三区的国产在线播放| 一区二区三区免费| 国产精品嫩草影院av蜜臀| 久久伊人中文字幕| 日韩欧美亚洲国产另类 |