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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? huffcompress.c

?? VC++網(wǎng)絡通信編程實例案例精選》源代碼 第三部分
?? 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一区二区三区免费野_久草精品视频
久久99精品国产| 亚洲男人电影天堂| 免费观看91视频大全| 制服.丝袜.亚洲.中文.综合| 亚洲成人1区2区| 欧美一二三区在线观看| 精品一区二区三区免费毛片爱 | 中文字幕一区二区三区不卡| 成人听书哪个软件好| 一区二区中文字幕在线| 在线亚洲+欧美+日本专区| 亚洲国产精品久久久久婷婷884| 欧美精品乱码久久久久久按摩| 麻豆成人久久精品二区三区红| 欧美成人激情免费网| 国产成人无遮挡在线视频| 国产精品国产a| 欧美系列一区二区| 久久精品国产一区二区| 欧美激情一区二区三区在线| 色婷婷av一区二区三区gif | 日韩二区三区四区| 亚洲精品在线观看网站| av在线一区二区| 全国精品久久少妇| 国产精品久久久久久久第一福利 | 欧美视频一区二区| 免费在线观看不卡| 国产精品沙发午睡系列990531| 在线视频欧美精品| 久久99国产精品麻豆| 亚洲青青青在线视频| 欧美一二三区在线观看| 99久久精品一区| 久久福利资源站| 亚洲动漫第一页| 国产欧美一区二区在线观看| 欧美日韩小视频| 国产成人免费9x9x人网站视频| 首页欧美精品中文字幕| 国产精品视频看| 精品处破学生在线二十三| 91黄色在线观看| 东方aⅴ免费观看久久av| 美女网站色91| 亚洲国产一区二区在线播放| 国产欧美精品一区| 日韩视频免费观看高清完整版在线观看 | 91激情五月电影| 国产成人精品免费一区二区| 亚洲va欧美va国产va天堂影院| 国产喷白浆一区二区三区| 91精品国产综合久久久久久久 | 国产性色一区二区| 欧美一级二级三级蜜桃| 色狠狠综合天天综合综合| 国产白丝精品91爽爽久久 | 日韩美女天天操| 欧美日韩五月天| 色系网站成人免费| av电影在线不卡| 国产成人亚洲精品狼色在线| 狠狠狠色丁香婷婷综合激情| 午夜不卡av免费| 一级做a爱片久久| 亚洲乱码精品一二三四区日韩在线| 久久天天做天天爱综合色| 欧美xxxx在线观看| 91精品国产综合久久精品性色| 91精品1区2区| 欧美一a一片一级一片| 色综合久久综合网欧美综合网 | 日本高清免费不卡视频| av在线不卡网| 91视频免费看| 色综合中文字幕国产| 99久久精品99国产精品| 99视频一区二区三区| 成人精品电影在线观看| 成人精品视频网站| 成人激情开心网| 97久久精品人人做人人爽| 91论坛在线播放| 欧美怡红院视频| 欧美精选一区二区| 日韩欧美成人激情| 久久免费国产精品| 国产精品污网站| 最新日韩在线视频| 一区二区成人在线| 日本va欧美va精品发布| 韩国成人精品a∨在线观看| 国产在线视频一区二区| 国产成人综合网站| av不卡免费在线观看| 色综合色综合色综合| 欧美日韩中文字幕一区二区| 88在线观看91蜜桃国自产| 日韩欧美第一区| 国产精品三级久久久久三级| 中文字幕佐山爱一区二区免费| 亚洲一区在线视频| 日本亚洲视频在线| 韩国女主播一区| 波多野结衣中文一区| 欧美三片在线视频观看 | 国产综合久久久久影院| 成人性生交大合| 欧美亚洲国产一区二区三区 | 久久精品人人做| 亚洲私人影院在线观看| 亚洲va韩国va欧美va| 韩国成人福利片在线播放| 99久久99久久综合| 欧美疯狂做受xxxx富婆| 久久久久久夜精品精品免费| 亚洲婷婷在线视频| 久久精品72免费观看| av激情成人网| 欧美大片国产精品| 亚洲欧洲成人自拍| 毛片av中文字幕一区二区| 欧美日韩精品久久久| 欧美岛国在线观看| 一区二区三区日韩精品| 国产乱子伦视频一区二区三区| 99精品国产99久久久久久白柏| 欧美一区二区三区色| 国产精品九色蝌蚪自拍| 捆绑紧缚一区二区三区视频| 91色.com| 国产三级精品视频| 免费黄网站欧美| 在线日韩国产精品| 国产精品人成在线观看免费| 青青草国产成人av片免费| 色综合天天在线| 久久精品视频在线看| 蜜臀99久久精品久久久久久软件| 99久久亚洲一区二区三区青草| 欧美精品一区二区三区在线| 午夜精品福利久久久| 色先锋aa成人| 亚洲欧美一区二区在线观看| 激情另类小说区图片区视频区| 欧美日韩国产影片| 亚洲少妇最新在线视频| 成人午夜大片免费观看| 欧美变态口味重另类| 日本亚洲免费观看| 欧美日韩国产123区| 一个色妞综合视频在线观看| 成人av网站在线观看免费| 精品福利一区二区三区| 蜜桃视频一区二区三区| 欧美日韩不卡视频| 午夜精品久久久久久久久久久| 日本大香伊一区二区三区| **性色生活片久久毛片| av中文字幕在线不卡| 国产精品久久久久久久久久久免费看 | 日韩理论片在线| 国产成人在线视频网站| 久久久久久久网| 国内欧美视频一区二区| 欧美tickling挠脚心丨vk| 日韩电影一区二区三区| 欧美狂野另类xxxxoooo| 天天综合色天天| 欧美一区二区三区的| 欧美a一区二区| 欧美一二区视频| 国产综合色产在线精品| 久久蜜桃一区二区| 国产91富婆露脸刺激对白| 国产精品私人影院| 99精品偷自拍| 亚洲一区视频在线观看视频| 在线观看欧美黄色| 视频一区免费在线观看| 欧美xxx久久| 国产成a人亚洲精品| 中文字幕亚洲成人| 色成年激情久久综合| 亚洲成av人片在线观看无码| 欧美性猛片aaaaaaa做受| 三级亚洲高清视频| 精品国产免费视频| 99久久99精品久久久久久| 亚洲女同女同女同女同女同69| 欧洲另类一二三四区| 日韩不卡免费视频| 国产嫩草影院久久久久| 91久久免费观看| 另类综合日韩欧美亚洲| 欧美国产欧美综合| 在线观看区一区二| 老汉av免费一区二区三区| 国产精品久久夜| 欧美精品乱人伦久久久久久|