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

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

?? rle.c

?? VC++網絡通信編程實例案例精選》源代碼 第三部分
?? C
字號:
// Module Name: RLE.c
//
// Description:
//    A implementation of Run Length Encoding and Decoding Routines
//
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "RLE.h"
#include "Client.h"

// Global Variables
DWORD	dwCodeLength = 19;

// Return the Run Length Encoded Size
DWORD RunLength(BYTE *pInput,DWORD dwCount)
{
	// Compressed Count
	DWORD	dwNewCount = 4;

	// Max Run Length
	DWORD	dwMaxRun;

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

	__asm
	{
		// Calculate the Maximum Run Length
		MOV		EDX,1
		MOV		ECX,dwCodeLength
		SUB		ECX,9
		SHL		EDX,CL
		SUB		EDX,1
		MOV		dwMaxRun,EDX

		// Load the Count of Bytes to Encode
		MOV		EDX,dwCount

		// Initialize the Output Bits
		XOR		EDI,EDI

		// Initialize the Storage DWORD
		XOR		ESI,ESI

		// Load the Byte to Compare
		_LoadByte:

		// Save the Storage DWORD
		PUSH	ESI

		// Load a Byte
		MOV		ESI,pInput
		MOV		AL,[ESI]

		// Initialize the Run Length Count to 1
		MOV		ECX,DWORD PTR 1

		// Compare the Bytes
		_CompareBytes:

		// Check for EOD
		CMP		EDX,0
		JZ		_Finished

		// Compare to the Max Length for an Encode
		CMP		ECX,dwMaxRun
		JA		_Finished

		// Compare the Bytes
		CMP		AL,[ESI + ECX]

		// Increment the Run Length
		LEA		ECX,[ECX + 1]

		// Decrement the Bytes Processed
		LEA		EDX,[EDX - 1]

		// Branch for the Comparison
		JE		_CompareBytes

		// Finished Encoding
		_Finished:

		// Decrement the Run Length for Encoding
		DEC		ECX

		// Increment the Pointer to the Source Data
		ADD		ESI,ECX
		MOV		pInput,ESI

		// Restore the Storage DWORD
		POP		ESI

		// Check for a 1:1 Character Copy
		CMP		ECX,1
		JNZ		_BuildCode

		// Move in the Character
		XOR		EBX,EBX
		MOV		BH,1
		MOV		BL,AL

		// Set the Code Length
		MOV		ECX,9

		// Jump to Checking the Bit Shifting
		JMP		_CheckShift

		// Build the Compression Code
		_BuildCode:
		MOV		EBX,ECX
		SHL		EBX,8
		MOV		BL,AL

		// Set the Code Length
		MOV		ECX,dwCodeLength

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

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

		// Shift the Output Data
		_ShiftData:

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

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

		// Compare for More Data
		_Continue:
		CMP		EDX,0
		JZ		_Exit

		// Go Back for More Bytes
		JMP		_LoadByte

		// Finished Encoding
		_Exit:

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

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

		// Increment the Compression Count
		ADD		dwNewCount,4

		// Done Encoding
		_Done:
	}

	// Return the Compressed Count
	return dwNewCount;
}

// Run Length Encode the Input Data to the Output Data
DWORD RunLengthEncode(BYTE *pInput,DWORD dwCount,BYTE *pOutput)
{
	// Compressed Count
	DWORD	dwNewCount = 4;

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

	// Max Run Length
	DWORD	dwMaxRun;

	__asm
	{
		// Calculate the Maximum Run Length
		MOV		EDX,1
		MOV		ECX,dwCodeLength
		SUB		ECX,9
		SHL		EDX,CL
		SUB		EDX,1
		MOV		dwMaxRun,EDX

		// Point to the Input Byte
		MOV		EDI,pOutput

		// Load the Count of Bytes to Encode
		MOV		EDX,dwCount

		// Store the Original Length in the Compressed Data
		MOV		[EDI],EDX

		// Increment the Input Data Pointer
		ADD		EDI,4
		MOV		pOutput,EDI

		// Initialize the Output Bits
		XOR		EDI,EDI

		// Initialize the Storage DWORD
		XOR		ESI,ESI

		// Load the Byte to Compare
		_LoadByte:

		// Save the Storage DWORD
		PUSH	ESI

		// Load a Byte
		MOV		ESI,pInput
		MOV		AL,[ESI]

		// Initialize the Run Length Count to 1
		MOV		ECX,DWORD PTR 1

		// Compare the Bytes
		_CompareBytes:

		// Check for EOD
		CMP		EDX,0
		JZ		_Finished

		// Compare to the Max Length for an Encode
		CMP		ECX,dwMaxRun
		JA		_Finished

		// Compare the Bytes
		CMP		AL,[ESI + ECX]

		// Increment the Run Length
		LEA		ECX,[ECX + 1]

		// Decrement the Bytes Processed
		LEA		EDX,[EDX - 1]

		// Branch for the Comparison
		JE		_CompareBytes

		// Finished Encoding
		_Finished:

		// Decrement the Run Length for Encoding
		DEC		ECX

		// Increment the Pointer to the Source Data
		ADD		ESI,ECX
		MOV		pInput,ESI

		// Restore the Storage DWORD
		POP		ESI

		// Check for a 1:1 Character Copy
		CMP		ECX,1
		JNZ		_BuildCode

		// Move in the Character
		XOR		EBX,EBX
		MOV		BH,1
		MOV		BL,AL

		// Set the Code Length
		MOV		ECX,9

		// Jump to Checking the Bit Shifting
		JMP		_CheckShift

		// Build the Compression Code
		_BuildCode:
		MOV		EBX,ECX
		SHL		EBX,8
		MOV		BL,AL

		// Set the Code Length
		MOV		ECX,dwCodeLength

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

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

		// Shift the Output Data
		_ShiftData:

		// 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
		ADD		EDI,4
		MOV		pOutput,EDI
		POP		EDI

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

		// Compare for More Data
		_Continue:
		CMP		EDX,0
		JZ		_Exit

		// Go Back for More Bytes
		JMP		_LoadByte

		// Finished Encoding
		_Exit:

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

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

		// Done Encoding
		_Done:
	}

	// Return the Compressed Count
	return dwNewCount;
}

// Run Length Decode the Input Data to the Output Data
DWORD RunLengthDecode(BYTE *pInput,BYTE *pOutput)
{
	// Compressed Count
	DWORD	dwCount;
	DWORD	dwCompCount;
	DWORD	dwCodeLength2;

	__asm
	{
		// Get the CodeLength - 1 for Checking a 1:1 Compression
		MOV		EAX,dwCodeLength
		DEC		EAX
		MOV		dwCodeLength2,EAX

		// Point to the Input Byte
		MOV		ESI,pInput

		// Point to the Output Byte
		MOV		EDI,pOutput

		// Load the Count of Bytes Encoded
		LODSD

		// Save the New Input Location
		MOV		pInput,ESI

		// Save the Count of the UnCompressed Data
		MOV		dwCompCount,EAX

		// Initialize the Count of Bytes Decoded
		MOV		dwCount,EAX

		// Initialize Number of Bits for Current Symbol to Process
		MOV		ESI,dwCodeLength

		// Initialize the Decode Storage
		XOR		EDX,EDX

		// Main Loop for Reading Input
		_LoopInput:

		// Save the Number of Bits for the Current Symbol
		PUSH	ESI

		// Point to the Input Data
		MOV		ESI,pInput

		// Read an Encoded DWORD
		LODSD

		// Save the Pointer to the Input Data
		MOV		pInput,ESI

		// Restore the Number of Bits for the Current Symbol
		POP		ESI

		// Initialize Number of Bits to Process
		MOV		EBX,32

		// Shift in an Encoded Symbol, 1 bit at a time
		_LeftShift:

		// Shift 1 Bit of the Input Code to the Output
		SHLD	EDX,EAX,1

		// Shift the Input Code 1 Bit to the Left
		SHL		EAX,1

		// Decrement the Number of Bits Processed
		DEC		ESI

		// Check for a Fully Encoded Symbol
		JZ		_Output

		// Compare the High Bit for RLE or Character Encode
		CMP		ESI,dwCodeLength2
		JNZ		_CheckBits

		// Compare the High Bit, 0 = RLE, 1 = 1:1 Character Encode
		CMP		EDX,0
		JZ		_CheckBits

		// Update the Bits Left to 8
		MOV		ESI,8

		// Check for More Bits to Process
		_CheckBits:

		// Decrement the Number of Bits Processed in the Input DWORD
		DEC		EBX

		// Continue Shifting More Bits
		JNZ		_LeftShift

		// Read Another DWORD of Data
		JMP		_LoopInput

		// Output the Run Length Amount of the Code
		_Output:

		// Get the Run Length
		MOV		ECX,EDX
		SHR		ECX,8

		// Get the Code
		AND		EDX,255

		// Save the Input DWORD
		PUSH	EAX

		// Copy the Code
		MOV		EAX,EDX

		// Save the Run Length
		PUSH	ECX

		// Output the Run Length Amount of the Code
		REP		STOSB

		// Restore the Run Length
		POP		ECX

		// Restore the Input DWORD
		POP		EAX

		// Check for More Data to Decode
		SUB		dwCompCount,ECX
		JZ		_Exit

		// Initialize the Decode Storage
		XOR		EDX,EDX

		// Initialize Number of Bits for Current Symbol to Process
		MOV		ESI,dwCodeLength

		// Check for More Bits to Process
		JMP		_CheckBits

		// Finished
		_Exit:
	}

	// Return the Count of Uncompressed Data
	return dwCount;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线一区二区| 亚洲手机成人高清视频| 免播放器亚洲一区| 日韩亚洲欧美在线观看| 国产一区激情在线| 久久精品男人的天堂| 成人午夜精品在线| 亚洲色图在线视频| 欧美日韩久久一区二区| 日本中文字幕一区二区视频| 制服丝袜一区二区三区| 九九国产精品视频| 亚洲国产精华液网站w| 波多野洁衣一区| 亚洲国产精品嫩草影院| 欧美一级欧美一级在线播放| 精品午夜久久福利影院| 日本一区二区三区视频视频| 色综合一个色综合| 青青草原综合久久大伊人精品优势| 日韩欧美一区二区久久婷婷| 成人免费av网站| 亚洲综合成人在线| 亚洲精品一区二区三区在线观看| 成人免费观看av| 亚洲www啪成人一区二区麻豆| 精品国产亚洲在线| 色噜噜狠狠色综合欧洲selulu| 日本免费在线视频不卡一不卡二| 久久精品一区二区| 欧美日韩一区 二区 三区 久久精品| 麻豆中文一区二区| 亚洲欧美区自拍先锋| 日韩视频免费直播| 一本久久精品一区二区| 激情综合色播五月| 一区二区三区日韩精品视频| 精品国产制服丝袜高跟| 在线日韩国产精品| 国产在线一区二区| 婷婷中文字幕一区三区| 国产精品久久久久久久久快鸭| 在线成人av网站| 色综合久久天天| 国产精品一区2区| 人人狠狠综合久久亚洲| 亚洲精品久久久久久国产精华液| 久久这里都是精品| 欧美日韩国产精品成人| 97久久精品人人做人人爽| 国产呦精品一区二区三区网站| 三级欧美韩日大片在线看| 国产精品成人免费在线| 久久亚区不卡日本| 91精品婷婷国产综合久久性色| 91美女片黄在线观看91美女| 国产精品自拍av| 狠狠色丁香婷婷综合久久片| 亚欧色一区w666天堂| 一级中文字幕一区二区| 国产精品国产三级国产| 欧美韩国日本不卡| 国产亚洲欧美在线| 精品少妇一区二区三区日产乱码 | 久久国产福利国产秒拍| 五月婷婷另类国产| 亚洲国产精品久久久男人的天堂| 亚洲精品欧美综合四区| 亚洲女性喷水在线观看一区| 国产精品色哟哟网站| 欧美国产日本韩| 国产日产欧美一区二区三区| 久久久久久久一区| 久久久久国产精品免费免费搜索| 精品国产区一区| 精品国产乱码久久久久久久久 | 91免费观看在线| 99精品1区2区| 一本一道综合狠狠老| 色拍拍在线精品视频8848| 在线观看成人小视频| 欧美在线高清视频| 在线观看91精品国产麻豆| 欧美乱熟臀69xxxxxx| 91精品国产综合久久香蕉的特点| 91麻豆精品国产91久久久更新时间| 欧美日韩三级在线| 欧美一级久久久久久久大片| 亚洲精品一线二线三线无人区| 日韩欧美国产系列| 国产视频在线观看一区二区三区 | caoporn国产精品| 91在线观看下载| 在线欧美小视频| 日韩一区二区三区三四区视频在线观看 | 一区二区三区毛片| 污片在线观看一区二区| 久久精品国产99| 国产精品69久久久久水密桃| 91在线你懂得| 555夜色666亚洲国产免| 久久亚洲精华国产精华液 | 色八戒一区二区三区| 3751色影院一区二区三区| 久久婷婷一区二区三区| 亚洲欧美乱综合| 久久电影网电视剧免费观看| av高清不卡在线| 91精品久久久久久久99蜜桃| 亚洲一区二区精品久久av| 精品午夜一区二区三区在线观看| 成人午夜精品在线| 欧美精品乱人伦久久久久久| 久久精品综合网| 午夜精品久久久久久久99樱桃| 国产在线播精品第三| 91极品美女在线| 久久在线观看免费| 亚洲综合成人网| 国产91综合网| 欧美福利视频一区| 国产精品嫩草影院com| 天天操天天综合网| 不卡的av中国片| 日韩精品一区二区三区老鸭窝| 欧美国产禁国产网站cc| 日韩av一级片| 在线一区二区三区四区五区| 久久久一区二区| 五月天中文字幕一区二区| 成人a免费在线看| 精品噜噜噜噜久久久久久久久试看 | 久久综合网色—综合色88| 亚洲黄色尤物视频| 成人免费毛片aaaaa**| 4438成人网| 一区二区三区四区不卡在线| 国产精品综合二区| 欧美一区二区在线播放| 亚洲最新视频在线播放| 成人免费毛片片v| 精品久久久久久最新网址| 亚洲午夜激情av| 色又黄又爽网站www久久| 亚洲国产精品v| 国产在线精品一区在线观看麻豆| 欧美日韩另类一区| 亚洲在线一区二区三区| 91在线无精精品入口| 国产人成一区二区三区影院| 蜜臀av一区二区在线免费观看| 欧美日韩视频在线观看一区二区三区 | 亚洲免费观看高清完整版在线观看 | 91精品国产综合久久福利软件| 亚洲免费av高清| 91在线观看地址| 亚洲视频狠狠干| 91天堂素人约啪| 国产精品福利一区| 99久久免费视频.com| 国产精品乱人伦| av不卡在线播放| 国产精品久久久久一区| 成人性生交大片免费看视频在线| 久久美女艺术照精彩视频福利播放| 美国av一区二区| 精品久久久久久综合日本欧美| 六月婷婷色综合| 日韩精品一区二区三区视频| 久色婷婷小香蕉久久| 日韩精品综合一本久道在线视频| 麻豆国产精品777777在线| 欧美不卡123| 国产精品一区免费在线观看| 国产日产精品1区| 不卡一区在线观看| 一区二区三区不卡在线观看 | 欧美一区二区三区思思人| 亚洲1区2区3区4区| 日韩欧美中文字幕公布| 精品一区二区日韩| 国产日韩精品一区二区三区| 成人高清免费观看| 亚洲精品国产a| 欧美精品丝袜久久久中文字幕| 日本怡春院一区二区| 精品欧美一区二区在线观看| 国产成人综合视频| 中文字幕一区二区三| 欧美性三三影院| 麻豆精品久久久| 中文字幕在线不卡| 欧美日韩精品高清| 国模无码大尺度一区二区三区| 中文字幕欧美日韩一区| 97精品久久久久中文字幕| 香蕉久久夜色精品国产使用方法| 日韩精品一区二区三区在线| 顶级嫩模精品视频在线看| 亚洲一区在线观看免费观看电影高清 |