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

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

?? huffcompress.c

?? 配套《網絡通信編程實用案例精選》源代碼。
?? C
?? 第 1 頁 / 共 2 頁
字號:
		MOV		DX,wTreeSize

		// Compute the Tree Storage Requirements
		SHL		EDX,2
		MOV		dwStorage,EDX
	}

	// Copy the Byte Tree
	memblast(pByteTree,&dwByteTree[0],dwStorage);

	// Build the Code List
	HuffmanBuildCodes();

	// Copy the Codes
	memblast(pCodes,&dwCodes[0],2048);

	// Return the Tree Size
	return wTreeSize;
}

// Compute the Compression Size of the Input Data
DWORD HuffmanCountCompress(BYTE *pInput,DWORD dwCount,WORD iTreeSize,DWORD *pCodes)
{
	// Variables Used for Code Shifting
	BOOL	fOutput = FALSE;

	// Compressed Size with Initial Space for Codes
	DWORD	dwNewCount;

	// Loop Variable
	DWORD	dwLoop;

	// Get the Tree Size and Table Storage Requirement
	__asm
	{
		// Get the Tree Size
		MOV		EAX,0
		MOV		AX,iTreeSize

		// Get the Table Storage
		SHL		EAX,2
		MOV		dwStorage,EAX

		// Add 6 for the DWORD and WORD that Stores the UnCompressed Count and Number of Tree Entries
		ADD		EAX,6

		// Initialize the Base Storage Requirement
		MOV		dwNewCount,EAX
	}

	// Encode the Input Data
	__asm
	{
		// Point to the Source Data
		MOV		ESI,pInput

		// Set the Loop Count
		MOV		EDX,dwCount
		MOV		dwLoop,EDX

		// Point to the Codes Array
		MOV		EDX,pCodes

		// Clear the Count of Used Bits
		MOV		EDI,0

		// Main Loop for Reading Bytes
		_LoopInput:

		// Clear the EAX Register for the Input Character
		MOV		EAX,0

		// Read the Input Byte and Increment the Input Pointer
		LODSB

		// Get the Compression Code (Bytes 0 - 255 in Array)
		MOV		EBX,[EDX + EAX * 4]

		// Get the Compression Code Bit Count (Bytes 256 - 511 in Array)
		MOV		ECX,[EDX + 1024 + EAX * 4]

		// See How Many Bits Can be Shifted to the Output DWORD
		ADD		EDI,ECX
		CMP		EDI,32
		JLE		_ShiftBits

		// See How Many Bits of the Last Code Can't Be Used
		SUB		EDI,32

		// Adjust ECX to Handle only the Bits that Can Be Used
		SUB		ECX,EDI

		// Set the Output Flag
		MOV		fOutput,TRUE

		// Start the Bit Shifting
		_ShiftBits:

		// Check for Outputting a full DWORD
		CMP		fOutput,FALSE
		JE		_Continue

		// Increment the Compression Count
		ADD		dwNewCount,4

		// Remove the Bits we Used
		MOV		EAX,32
		SUB		EAX,EDI
		MOV		ECX,EAX

		// Reset the Output Flag
		MOV		fOutput,FALSE

		// Decrement the Main Loop Counter
		_Continue:
		DEC		dwLoop
		JNZ		_LoopInput

		// Update Any Remaining Compression data in the Buffer
		CMP		EDI,0
		JE		_Exit

		// Left Shift the Remaining Bits
		MOV		EAX,32
		SUB		EAX,EDI
		MOV		ECX,EAX

		// Increment the Compression Count
		ADD		dwNewCount,4

		// Finished Compressing the Input Data
		_Exit:
	}

	// Return the Compression Count
	return dwNewCount;
}

// Compress the Count of Input Data to Output Data returning the new Count
DWORD HuffmanCompress(BYTE *pInput,DWORD dwCount,WORD iTreeSize,DWORD *pByteTree,DWORD *pCodes,BYTE *pOutput)
{
	// Allocation Variables
	BYTE	*pStartInput = pInput;
	BYTE	*pStartOutput = pOutput;

	// Variables Used for Code Shifting
	DWORD	dwUnusedByte = 0;
	BOOL	fOutput = FALSE;

	// Compressed Size with Initial Space for Codes
	DWORD	dwNewCount = 0;

	// Loop Variable
	DWORD	dwLoop;

	// Get the Tree Size and Table Storage Requirement
	__asm
	{
		// Get the Table Storage
		MOV		EAX,0
		MOV		AX,iTreeSize
		MOV		wTreeSize,AX
		SHL		EAX,2
		MOV		dwStorage,EAX
	}

	// Encode the Input Data
	__asm
	{
		// Point to the Destination Data
		MOV		EDI,pOutput

		// Store the UnCompressed Count
		MOV		EAX,dwCount
		MOV		[EDI],EAX

		// Move Past the UnCompressed Count
		ADD		EDI,4

		// Move in the Number of Codes to the Output
		MOV		ECX,0
		MOV		CX,wTreeSize
		MOV		[EDI],CX

		// Move Past the Number of Codes
		ADD		EDI,2

		// Initialize the Base Storage Requirement
		MOV		EDX,dwStorage
		MOV		dwNewCount,EDX

		// Add 6 for the DWORD and WORD that Stores the UnCompressed Count and Number of Tree Entries
		ADD		dwNewCount,6

		// Adjust the Start of the Output Compressed Data, Skipping Byte Tree
		SHR		EDX,1
		ADD		EDI,EDX

		// Store the Pointer to the Output
		MOV		pOutput,EDI

		// Set the Loop Count
		MOV		EDX,dwCount
		MOV		dwLoop,EDX

		// Point to the Codes Array
		MOV		EDX,pCodes

		// Clear the Count of Used Bits
		MOV		EDI,0

		// Initialize the Storage DWORD
		XOR		ESI,ESI

		// Main Loop for Reading Bytes
		_LoopInput:

		// Clear the EAX Register for the Input Character
		MOV		EAX,0

		// Save the ESI Register
		PUSH	ESI

		// Point to the Source Data
		MOV		ESI,pInput

		// Read an Input Byte
		MOV		AL,[ESI]

		// Increment the Pointer to the Source Data
		INC		ESI

		// Store the Pointer to the Source Data
		MOV		pInput,ESI

		// Restore the ESI Register
		POP		ESI

		// Get the Compression Code (Bytes 0 - 255 in Array)
		MOV		EBX,[EDX + EAX * 4]

		// Get the Compression Code Bit Count (Bytes 256 - 511 in Array)
		MOV		ECX,[EDX + 1024 + EAX * 4]

		// See How Many Bits Can be Shifted to the Output DWORD
		ADD		EDI,ECX
		CMP		EDI,32
		JLE		_ShiftBits

		// See How Many Bits of the Last Code Can't Be Used
		SUB		EDI,32

		// Adjust ECX to Handle only the Bits that Can Be Used
		SUB		ECX,EDI

		// Save the Code
		MOV		dwUnusedByte,EBX

		// Shift the Input Symbol to the Right
		PUSH	ECX
		MOV		ECX,EDI
		SHR		EBX,CL
		POP		ECX

		// Set the Output Flag
		MOV		fOutput,TRUE

		// Start the Bit Shifting
		_ShiftBits:

		// Shift the Output Symbol to Handle a New Symbol
		SHL		ESI,CL

		// OR the Output Symbol with New Symbol
		OR		ESI,EBX

		// Check for Outputting a full DWORD
		CMP		fOutput,FALSE
		JE		_Continue

		// Output an Encoded Symbol
		MOV		EAX,ESI
		PUSH	EDI
		MOV		EDI,pOutput
		MOV		[EDI],EAX
		POP		EDI
		ADD		pOutput,4

		// Increment the Compression Count
		ADD		dwNewCount,4

		// Remove the Bits we Used
		MOV		EAX,32
		SUB		EAX,EDI
		MOV		ECX,EAX

		// Restore the Unused Portion of the Code
		MOV		EAX,dwUnusedByte
		SHL		EAX,CL
		SHR		EAX,CL

		// Update the Code to Have the Left Over Bits
		MOV		ESI,EAX

		// Initialize the Left Over Bits
		MOV		dwUnusedByte,0

		// Reset the Output Flag
		MOV		fOutput,FALSE

		// Decrement the Main Loop Counter
		_Continue:
		DEC		dwLoop
		JNZ		_LoopInput

		// Update Any Remaining Compression data in the Buffer
		CMP		EDI,0
		JE		_Exit

		// Left Shift the Remaining Bits
		MOV		EAX,32
		SUB		EAX,EDI
		MOV		ECX,EAX
		SHL		ESI,CL

		// Output the Final Encoded Symbol
		MOV		EAX,ESI
		MOV		EDI,pOutput
		MOV		[EDI],EAX

		// Increment the Compression Count
		ADD		dwNewCount,4

		// Finished Compressing the Input Data
		_Exit:
	}

	// Set the Start of the Byte Tree
	pOutput = pStartOutput + 6;

	// Copy the DWORD Byte Tree to a WORD Byte Tree
	D2W(&wByteTree[0],pByteTree,dwStorage/4);

	// Copy the Byte Tree
	memblast(pOutput,&wByteTree[0],dwStorage/2);
	
	// Restore the Pointer to the Start of the Input
	pInput = pStartInput;

	// Restore the Pointer to the Start of the Output
	pOutput = pStartOutput;

	// Return the Compression Count
	return dwNewCount;
}

// Get the UnCompressed Count of Output Data
DWORD HuffmanGetSize(BYTE *pInput)
{
	DWORD	dwUnCount;

	__asm
	{
		// Point to the Source Data
		MOV		ESI,pInput

		// Get the UnCompressed Count
		MOV		EAX,[ESI]
		MOV		dwUnCount,EAX
	}

	// Return the UnCompressed Count
	return dwUnCount;
}

// UnCompress the Compressed Count of Input Data to Output Data returning the UnCompressed Count
DWORD HuffmanUnCompress(BYTE *pInput,BYTE *pOutput)
{
	// UnCompressed Count
	DWORD	dwUnCount;

	// Allocation Variables
	BYTE	*pStartInput = pInput;
	BYTE	*pStartOutput = pOutput;

	// UnCompressed Variables
	DWORD	dwLoop;

	// Initialize the Weights Array
	HuffmanInitArrays();

	// Copy the Decoding Dictionary
	__asm
	{
		// Point to the Source Data
		MOV		ESI,pInput

		// Get the UnCompressed Count
		MOV		EAX,[ESI]
		MOV		dwUnCount,EAX

		// Move Past the Uncompressed Count
		ADD		ESI,4

		// Get the Tree Size
		MOV		EAX,0
		MOV		AX,[ESI]
		MOV		wTreeSize,AX

		// Increment the Pointer to the Encoded Data
		ADD		ESI,2

		// Store the Start of the Compressed Data
		MOV		pInput,ESI

		// Compute the Root Index
		MOV		dwRootIndex,EAX
		SUB		dwRootIndex,3

		// Compute the Table Storage Requirement
		SHL		EAX,2
		MOV		dwStorage,EAX
	}

	// Copy the Decoding Byte Tree
	memblast(&wByteTree[0],pInput,dwStorage/2);

	// Convert the WORD Byte Tree to a DWORD Byte Tree
	W2D(&dwByteTree[0],&wByteTree[0],dwStorage/4);

	// Decode the Input Data
	__asm
	{
		// Increment the Pointer to the Data
		MOV		EAX,dwStorage
		SHR		EAX,1
		ADD		pInput,EAX

		// Point to the Byte Code Tree
		MOV		ESI,OFFSET dwByteTree[0]

		// Set the Loop Count for Amount of Bytes to Uncompress
		MOV		EDX,dwUnCount
		MOV		dwLoop,EDX

		// Calculate the Index of the Root
		MOV		EBX,dwRootIndex

		// Main Loop for Reading Bytes
		_LoopInput:

		// Point to the Source Data
		MOV		EDI,pInput

		// Read a DWORD of Encoded Data
		MOV		ECX,[EDI]

		// Increment the Source Data Pointer by a DWORD
		ADD		pInput,4

		// Initialize the Number of Bits to Process
		MOV		EAX,32

		// Left Shift the Encoded Data 1 Bit at a Time
		_LeftShift:

		// Initialize the Decode Storage
		MOV		EDX,0

		// Left Shift the Code into the Decode Storage
		SHL		ECX,1

		// Bit + 1 = Number of Children, ie The Direction in Tree to Move
		ADC		EDX,1

		// Index the Child of the Parent
		ADD		EBX,EDX

		// Decrement the Bits Processed
		DEC		EAX

		// Check for a Leaf Node
		MOV		EDI,[ESI + EBX * 4]
		CMP		EDI,256
		JLE		_LeafNode

		// Index the Child's Parent
		MOV		EDI,EBX
		SUB		EDI,EDX

		// Match the Child to a Parent
		_TestParent:

 		// Index the Previous Parent in the Tree
		SUB		EDI,3

		// Get the Child's Parent
		MOV		EDX,[ESI + EDI * 4]

		// Compare the Parent with the Child
		CMP		EDX,[ESI + EBX * 4]
		JNE		_TestParent

		// Update the Parent Index
		MOV		EBX,EDI

		// Check the Bits Processed upto this Point
		CMP		EAX,0

		// Check for More Bits to Process
		JNZ		_LeftShift

		// Read in another DWORD
		JMP		_LoopInput

		// Output a Decoded Symbol
		_LeafNode:

		// Point to the Destination Data
		MOV		EDI,pOutput

		// Output the Code
		MOV		EDX,[ESI + EBX * 4]
		MOV		[EDI],DL

		// Increment the Destination Data by 1 Byte
		INC		pOutput

		// Calculate the Index of the Root
		MOV		EBX,dwRootIndex

		// Decrement the Loop Counter
		DEC		dwLoop
		JZ		_Exit

		// Check for More Bits to Process
		CMP		EAX,0
		JNZ		_LeftShift

		// Read a New DWORD
		JMP		_LoopInput

		// Finished Decompressing
		_Exit:
	}

	// Restore the Pointer to the Start of the Input
	pInput = pStartInput;

	// Restore the Pointer to the Start of the Output
	pOutput = pStartOutput;

	// Return the Count of UnCompressed Data
	return dwUnCount;
}

// Copy a DWORD Array to a WORD Array
void D2W(void* dest,void* src,DWORD count)
{
	__asm
	{
		MOV		ESI,src		// Copy the Source Address to the Register
		MOV		EDI,dest	// Copy the Destination to the Register
		MOV		ECX,count	// Copy the Count to the Register

		_CopyD2W:
		MOV		EAX,[ESI]
		MOV		[EDI],AX
		ADD		ESI,4
		ADD		EDI,2
		DEC		ECX
		JNZ		_CopyD2W
	}
}

// Copy a WORD Array to a DWORD Array
void W2D(void* dest,void* src,DWORD count)
{
	__asm
	{
		MOV		ESI,src		// Copy the Source Address to the Register
		MOV		EDI,dest	// Copy the Destination to the Register
		MOV		ECX,count	// Copy the Count to the Register

		XOR		EAX,EAX
		_CopyW2D:
		MOV		AX,[ESI]
		MOV		[EDI],EAX
		ADD		ESI,2
		ADD		EDI,4
		DEC		ECX
		JNZ		_CopyW2D
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区视频在线观看2020| 99re这里只有精品6| 91精品国产91久久综合桃花| 精品国产青草久久久久福利| 国产精品久久久久久久久免费相片| 亚洲一区二区三区影院| 东方aⅴ免费观看久久av| 欧美美女网站色| 国产精品理论在线观看| 免费成人av在线播放| 色综合久久综合网97色综合| 久久综合久久久久88| 午夜免费久久看| 91福利视频久久久久| 中文字幕一区二区三区在线不卡| 久久国产乱子精品免费女| 91成人免费网站| 亚洲天堂久久久久久久| 国产盗摄精品一区二区三区在线| 欧美一区二区人人喊爽| 日韩国产精品久久| 欧洲精品视频在线观看| 成人欧美一区二区三区黑人麻豆| 国产精品18久久久久久久网站| 欧美久久一二三四区| 亚洲国产日韩一区二区| 日本韩国欧美国产| 亚洲欧洲韩国日本视频| www.欧美精品一二区| 国产日韩一级二级三级| 国产成人免费视频| 国产午夜精品一区二区三区嫩草| 国产综合久久久久久鬼色| 日韩一区二区精品葵司在线| 丝袜亚洲另类欧美| 在线91免费看| 中文字幕日韩av资源站| 国产精品私人影院| 三级欧美在线一区| 欧美日韩二区三区| 日韩精品久久久久久| 日韩和的一区二区| 7777精品伊人久久久大香线蕉完整版 | 久久精品一区八戒影视| 国产一区在线观看视频| 精品人在线二区三区| 极品美女销魂一区二区三区 | 久久久www免费人成精品| 国产真实乱偷精品视频免| 久久久青草青青国产亚洲免观| 国产一区二区三区黄视频 | 成人免费视频app| 久久久www成人免费毛片麻豆| 韩国欧美国产一区| 国产农村妇女精品| 91在线视频在线| 亚洲午夜精品一区二区三区他趣| 欧美精品久久天天躁| 精东粉嫩av免费一区二区三区| 久久蜜桃av一区二区天堂| 波多野结衣在线一区| 亚洲日本成人在线观看| 4438x亚洲最大成人网| 精品亚洲成a人| 国产精品国产三级国产普通话99| 91免费在线播放| 日韩精品一区二区三区蜜臀| 99视频一区二区| 91成人看片片| 免费观看久久久4p| 日本一区二区免费在线| 欧美在线一二三| 韩国精品一区二区| 自拍偷拍国产精品| 精品不卡在线视频| 91国偷自产一区二区开放时间 | 亚洲成人激情社区| 国产偷国产偷亚洲高清人白洁| 色噜噜久久综合| 狠狠色丁香婷综合久久| 樱桃国产成人精品视频| 精品国产一区二区国模嫣然| 色天使久久综合网天天| 国产盗摄女厕一区二区三区| 亚洲18色成人| 亚洲欧洲无码一区二区三区| 日韩精品一区二区三区四区视频| 成人激情图片网| 麻豆精品久久久| 一区二区三区四区在线免费观看| 欧美va在线播放| 欧美日本乱大交xxxxx| 99久久夜色精品国产网站| 韩国精品免费视频| 亚洲成av人综合在线观看| ㊣最新国产の精品bt伙计久久| 欧美电影免费观看高清完整版在线| 日本久久一区二区| 波多野结衣在线一区| 国产成a人无v码亚洲福利| 日韩 欧美一区二区三区| 亚洲国产精品久久久男人的天堂 | 懂色av中文字幕一区二区三区| 丝袜脚交一区二区| 亚洲精品成人悠悠色影视| 国产精品三级电影| 久久精品欧美一区二区三区麻豆| 91精品国产综合久久久久| 欧美日韩亚洲综合在线 | 亚洲蜜臀av乱码久久精品蜜桃| 久久久午夜精品理论片中文字幕| 欧美精品一卡两卡| 欧美日韩亚洲综合在线| 欧美亚洲综合久久| 欧美少妇xxx| 国产精品一区二区久久不卡| 五月婷婷久久综合| 国产精品入口麻豆原神| 成人黄色在线网站| 国产河南妇女毛片精品久久久 | 国产日韩欧美精品在线| 精品国产凹凸成av人导航| 精品99一区二区三区| 精品日韩欧美一区二区| 欧美tickling网站挠脚心| 日韩视频一区二区三区| 2023国产一二三区日本精品2022| 欧美va亚洲va香蕉在线| 久久免费午夜影院| 国产精品午夜春色av| 中文字幕一区二| 一区二区免费在线播放| 亚洲超碰97人人做人人爱| 青青草国产成人av片免费| 激情综合亚洲精品| 成人sese在线| 欧美日韩国产一级片| 日韩免费电影一区| 欧美极品xxx| 亚洲国产日韩综合久久精品| 久久久www成人免费毛片麻豆| 欧美三级中文字| 色婷婷久久一区二区三区麻豆| 韩国欧美国产1区| 国产一区二区在线观看视频| 国产精品自在在线| 97精品国产97久久久久久久久久久久| 色香蕉成人二区免费| 欧美电影在哪看比较好| 国产日韩欧美高清在线| 一区二区三区中文字幕| 免费在线观看成人| 国产成人av电影| 欧美老年两性高潮| 国产午夜亚洲精品理论片色戒 | 国产精品久久久久影院亚瑟| 亚洲乱码中文字幕| 激情久久久久久久久久久久久久久久| 成人avav影音| 日韩美女在线视频| 亚洲精品免费在线| 国产主播一区二区| 欧美午夜精品电影| 久久久亚洲高清| 日韩一区二区三区精品视频 | 日韩av不卡一区二区| 日韩亚洲欧美一区| 51精品国自产在线| 亚洲欧洲日韩一区二区三区| 日韩精品亚洲一区二区三区免费| 精品写真视频在线观看| 欧美综合一区二区| 国产丝袜在线精品| 日本美女一区二区三区视频| 99精品在线观看视频| 欧美tickling网站挠脚心| 午夜精品福利一区二区蜜股av | 偷拍一区二区三区| 97久久超碰国产精品| 久久久国产一区二区三区四区小说| 天天色天天操综合| 91免费视频网址| 日本一区二区三区在线不卡| 免费看日韩精品| 91.com在线观看| 欧美综合在线视频| 国产在线麻豆精品观看| 欧美日韩激情一区二区| |精品福利一区二区三区| 国产高清视频一区| 精品国产一区二区三区久久久蜜月| 亚洲综合一区二区三区| 92精品国产成人观看免费| 久久精品一区二区| 国产一区二区不卡| 久久综合色婷婷| 激情成人综合网| 欧美成人艳星乳罩| 激情伊人五月天久久综合| 91精品国产综合久久蜜臀 |