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

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

?? rle.c

?? 《Visual C++網絡通信編程實用案例精選》配套源碼
?? 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一区二区三区免费野_久草精品视频
欧美色图在线观看| 国产99精品视频| 亚洲一二三级电影| 国产欧美精品区一区二区三区| 日韩欧美一区二区三区在线| 欧美一区二区三区性视频| 欧美日韩一区中文字幕| 欧美日精品一区视频| 日本高清视频一区二区| 色欧美乱欧美15图片| 91女人视频在线观看| 91在线观看下载| 日本韩国视频一区二区| 色噜噜狠狠一区二区三区果冻| 成人app软件下载大全免费| 91视频一区二区| 欧美亚洲高清一区| 91精品婷婷国产综合久久| 欧美精品粉嫩高潮一区二区| 欧美午夜精品一区| 日韩一区二区电影在线| 日韩精品中文字幕在线一区| 欧美mv和日韩mv的网站| 国产欧美一区二区三区在线老狼| 国产日韩v精品一区二区| 国产精品乱码久久久久久| 亚洲三级小视频| 五月婷婷另类国产| 麻豆国产欧美一区二区三区| 国产一区二区福利视频| 91女人视频在线观看| 欧美精品一卡二卡| 久久久精品人体av艺术| 亚洲色图欧洲色图婷婷| 日本亚洲一区二区| 丁香六月综合激情| 欧美视频精品在线观看| 日韩欧美亚洲国产另类| 国产精品天美传媒| 日韩av一区二区三区| 国产成a人亚洲| 欧美色成人综合| 国产欧美日韩三区| 香蕉乱码成人久久天堂爱免费| 久久99蜜桃精品| 在线观看日韩电影| 久久久一区二区三区| 亚洲综合清纯丝袜自拍| 国模大尺度一区二区三区| 一本色道久久综合亚洲91| 日韩视频在线你懂得| 亚洲欧美日韩国产手机在线| 精品制服美女丁香| 欧美午夜一区二区三区免费大片| 久久久久久免费| 天堂成人免费av电影一区| 成人av在线看| 久久久国产午夜精品| 婷婷综合另类小说色区| 91在线视频网址| 久久久国产精品不卡| 日韩在线一区二区| 色视频成人在线观看免| 国产精品三级av| 国产精品亚洲第一| 日韩免费一区二区| 午夜精品福利一区二区三区蜜桃| aaa亚洲精品| 欧美—级在线免费片| 狠狠色丁香久久婷婷综合_中 | 五月婷婷综合激情| 成人污视频在线观看| 精品国产123| 麻豆高清免费国产一区| 欧美高清你懂得| 天天综合网天天综合色| 在线观看免费成人| 亚洲一区成人在线| 91老司机福利 在线| 国产精品国产成人国产三级| 国产美女av一区二区三区| 精品国产免费视频| 国产一区二区精品久久91| 欧美mv和日韩mv国产网站| 精品一区二区影视| 精品99一区二区| 国产一区视频导航| 国产日韩欧美精品综合| 丁香婷婷综合网| √…a在线天堂一区| 日本国产一区二区| 五月天丁香久久| 日韩午夜精品视频| 国产精品一区三区| 中文字幕乱码久久午夜不卡| voyeur盗摄精品| 亚洲精品精品亚洲| 欧美精品自拍偷拍动漫精品| 另类专区欧美蜜桃臀第一页| 久久久久久久久一| 成人福利视频在线看| 一区二区三区在线观看国产| 欧美猛男gaygay网站| 麻豆极品一区二区三区| 国产精品三级在线观看| 91免费观看视频在线| 亚洲午夜精品一区二区三区他趣| 欧美精品欧美精品系列| 狠狠狠色丁香婷婷综合激情| 国产精品欧美久久久久无广告| 91黄色激情网站| 另类调教123区| 成人免费在线视频| 欧美一级爆毛片| 成人18视频日本| 日日欢夜夜爽一区| 中文字幕中文字幕一区| 91精品婷婷国产综合久久性色 | 亚洲精品中文字幕在线观看| 51午夜精品国产| 国产成人午夜视频| 亚洲高清免费观看高清完整版在线观看 | 石原莉奈一区二区三区在线观看| 国产亚洲一区二区在线观看| 欧美最猛黑人xxxxx猛交| 国产一区二区0| 日韩成人午夜电影| 亚洲视频你懂的| 久久青草欧美一区二区三区| 欧美性受极品xxxx喷水| 国产成人午夜精品5599 | 欧美一区二区三区视频在线观看| 成人妖精视频yjsp地址| 日韩高清一区二区| 一级精品视频在线观看宜春院 | 一区二区中文视频| 久久综合色鬼综合色| 欧美亚洲日本一区| 国产电影一区二区三区| 亚洲第一av色| 亚洲日穴在线视频| 久久这里都是精品| 欧美人体做爰大胆视频| 欧美自拍偷拍午夜视频| 国产麻豆精品久久一二三| 亚洲另类色综合网站| 久久精品人人做| 在线亚洲一区二区| 国产丶欧美丶日本不卡视频| 无码av免费一区二区三区试看| 日本一二三不卡| 欧美人成免费网站| 精品视频1区2区3区| 成人精品视频.| 国产麻豆精品久久一二三| 亚洲成av人片一区二区三区| 亚洲综合清纯丝袜自拍| 18成人在线观看| 国产亚洲欧美在线| 精品欧美一区二区久久| 久久综合九色综合97婷婷| 欧美精品 国产精品| 色美美综合视频| 99久久夜色精品国产网站| 色综合久久99| 99精品国产99久久久久久白柏| 国产福利视频一区二区三区| 黄网站免费久久| 国产自产高清不卡| 韩国一区二区三区| 久久99精品国产91久久来源| 亚洲18色成人| 亚洲激情中文1区| 五月天丁香久久| 蜜臀av亚洲一区中文字幕| 日韩国产欧美在线观看| 亚洲成人激情社区| 日韩精品91亚洲二区在线观看| 亚洲成人av免费| 亚洲电影一级黄| 亚洲1区2区3区4区| 国内精品久久久久影院薰衣草| 捆绑调教一区二区三区| 国产制服丝袜一区| 国产成人自拍高清视频在线免费播放| 国产成人精品一区二| jizzjizzjizz欧美| 欧美主播一区二区三区| 色八戒一区二区三区| 91精品国产入口| 精品国免费一区二区三区| 久久精品男人的天堂| 中文av一区二区| 亚洲午夜影视影院在线观看| 天天综合网 天天综合色| 久久99九九99精品| 国产成人综合网| 欧美日韩国产综合一区二区三区| 欧美大片国产精品| 亚洲欧洲精品一区二区三区不卡|