亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
99久久99久久精品免费看蜜桃| 久久99久久久久| 91色在线porny| 麻豆91在线观看| 欧美一区2区视频在线观看| 秋霞电影一区二区| 亚洲精品在线观| 国产成人精品免费| 亚洲精品精品亚洲| 欧美久久久久中文字幕| 久久www免费人成看片高清| 久久久亚洲国产美女国产盗摄| 国产激情一区二区三区| 国产精品久久久久久久裸模| 色婷婷久久久久swag精品| 婷婷中文字幕一区三区| 2024国产精品| 色综合天天综合狠狠| 五月天亚洲精品| 精品成人一区二区| 成人av综合一区| 亚洲成av人片在线| 久久亚洲影视婷婷| 91麻豆国产精品久久| 日韩avvvv在线播放| 国产亚洲一二三区| 在线观看日韩毛片| 久久超级碰视频| 亚洲老妇xxxxxx| 欧美精品一区二区三区一线天视频| 成人av网站在线观看| 亚洲成a天堂v人片| 精品久久国产老人久久综合| av中文一区二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅| 国产精品区一区二区三| 91麻豆精品国产91| 一本色道久久综合精品竹菊| 捆绑变态av一区二区三区| 综合网在线视频| 精品国产乱码久久久久久夜甘婷婷| 99久久99久久久精品齐齐| 日本欧美肥老太交大片| 国产福利精品一区二区| 亚洲电影欧美电影有声小说| 欧美激情一区二区| 91精品国产入口| 在线欧美日韩国产| 国产91丝袜在线18| 麻豆91精品91久久久的内涵| 亚洲精品国产高清久久伦理二区| 精品久久久久久久人人人人传媒| 在线观看网站黄不卡| 成人午夜在线播放| 国产精品888| 精品一区二区三区香蕉蜜桃| 亚洲成av人片| 亚洲老妇xxxxxx| 中文字幕一区三区| 国产肉丝袜一区二区| 精品欧美黑人一区二区三区| 91精品欧美综合在线观看最新| 色香蕉久久蜜桃| 99热99精品| 成人va在线观看| 国产激情一区二区三区四区 | 亚洲国产成人91porn| 国产日韩欧美麻豆| 久久综合九色综合97_久久久| 9191久久久久久久久久久| 色婷婷一区二区| 91福利资源站| 色噜噜狠狠色综合欧洲selulu| 精品处破学生在线二十三| 777午夜精品视频在线播放| 91精彩视频在线| 欧美中文一区二区三区| 色综合久久99| 在线国产亚洲欧美| 欧美午夜片在线看| 欧美高清性hdvideosex| 在线成人小视频| 日韩一区二区不卡| 26uuu国产日韩综合| 国产性天天综合网| 国产精品欧美极品| 亚洲精品写真福利| 午夜久久久影院| 麻豆精品在线看| 国产精品一区二区在线看| 国产成人av在线影院| av不卡一区二区三区| 91成人免费电影| 欧美一区二区三区小说| 久久色中文字幕| 国产精品久久久久久久午夜片| 亚洲欧美一区二区三区国产精品 | 91黄色激情网站| 欧美日韩一级黄| 911精品国产一区二区在线| 欧美一区二区精品在线| 精品国产乱子伦一区| 国产精品久久久久久久浪潮网站 | 亚洲综合免费观看高清在线观看| 亚洲综合久久av| 一本一本久久a久久精品综合麻豆| eeuss国产一区二区三区| 日本精品裸体写真集在线观看| 欧美日韩国产小视频在线观看| 欧美精品丝袜久久久中文字幕| 欧美大尺度电影在线| 中文字幕一区视频| 天天av天天翘天天综合网| 久久99久久99| 日韩一区二区三区高清免费看看| 风间由美一区二区三区在线观看 | 欧美乱妇15p| 亚洲精品一区二区三区影院 | 欧美日韩aaaaaa| 久久久99免费| 亚洲愉拍自拍另类高清精品| 经典一区二区三区| 91免费视频网| 日韩一级大片在线观看| 亚洲欧洲国产日本综合| 蜜桃久久精品一区二区| 91视频.com| 国产午夜精品一区二区三区嫩草| 一区二区国产盗摄色噜噜| 国产精品香蕉一区二区三区| 欧美日韩日日夜夜| 国产精品久久久久久福利一牛影视 | 国产精品免费看片| 蜜臀精品一区二区三区在线观看| 99热99精品| 久久精品男人天堂av| 日韩国产精品久久| 在线这里只有精品| 国产精品久久久久三级| 国产麻豆视频精品| 欧美极品aⅴ影院| 麻豆精品一二三| 欧美精品电影在线播放| 一区二区在线观看av| 国产 日韩 欧美大片| 日韩欧美色综合网站| 午夜精品久久久久久| 欧美在线小视频| 国产精品高清亚洲| 国产精品一区二区久久不卡 | 国产九九视频一区二区三区| 在线成人小视频| 亚洲成a人片在线不卡一二三区| 99国产精品视频免费观看| 久久精子c满五个校花| 青青草91视频| 91精品国产综合久久久久久| 亚洲无人区一区| 在线精品视频小说1| 国产精品家庭影院| 成人黄页在线观看| 国产欧美1区2区3区| 韩国理伦片一区二区三区在线播放 | 婷婷亚洲久悠悠色悠在线播放| 在线观看欧美日本| 亚洲一区av在线| 在线亚洲免费视频| 亚洲综合免费观看高清完整版在线| caoporn国产精品| 中文字幕色av一区二区三区| 91蜜桃在线观看| 亚洲色图欧美偷拍| 91成人看片片| 偷偷要91色婷婷| 欧美激情一区在线观看| 国产xxx精品视频大全| 国产精品久久久久四虎| 色综合色狠狠综合色| 亚洲成人综合在线| 日韩精品专区在线影院观看| 狠狠色丁香婷综合久久| 国产欧美精品一区aⅴ影院| 99综合电影在线视频| 一区二区三区资源| 欧美日韩mp4| 国产精品一二三四| 国产精品国产三级国产有无不卡| 91浏览器打开| 视频一区中文字幕国产| 日韩免费视频一区二区| 国产·精品毛片| 亚洲精品国产a| 日韩欧美国产小视频| 丰满亚洲少妇av| 亚洲综合一区在线| 欧美va亚洲va国产综合| 东方aⅴ免费观看久久av| 亚洲人成小说网站色在线| 制服丝袜中文字幕一区| 丰满亚洲少妇av|