⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spihtcoder.h

📁 小波图像编码中SPIHT算法的C++实现源码
💻 H
字号:
// SPIHTCoder.h: interface for the CSPIHTCoder class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SPIHTCODER_H__861EEFD9_9B24_11D5_B119_5254AB32C4D0__INCLUDED_)
#define AFX_SPIHTCODER_H__861EEFD9_9B24_11D5_B119_5254AB32C4D0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#pragma optimize("", off)

#include "Matrix2D.h"
#include "LinkList.h"
#include <stdio.h>
#include <math.h>

#define TYPE_A   0 /* binary 0 */
#define TYPE_B   1 /* binary 1 */

#define TO_MEMORY 0/* Write compressed file to memory */
#define TO_DISK   1/* Write compressed file to disk */

#define FROM_MEMORY 0/* Write compressed file to memory */
#define FROM_DISK   1/* Write compressed file to disk */


class CSPIHTCoder  
{
public:
	struct SPIHTFileHeader  
	{
		int height;
		int width;
		char level;
		float BitRate;
		int threshold;
		float fWaveParam;
		UINT selection;
	};
	
	struct CSPIHTFileInfo
	{
		SPIHTFileHeader header;
		LONG lCounts;   
		BYTE *pFirstByte;//The first of bytes which record real compressed file;
	};

	float m_fDecomBitRate;
	UINT selection;
	SPIHTFileHeader header;
	void SetImageSize(int x,int y);
	void SetLevel(char l);
	float BitRate;
	void SetBitRate(float b);
	BOOL stop;
	CMatrix2D<ElementType> *MR;
	void RefinementPass2(CMatrix2D<ElementType> *m,int threshold);
	void SortingPass2(CMatrix2D<ElementType> *m, int threshold);
	unsigned long  BitCount;
	unsigned char inputbyte;
	char GetBit();
	void Decode( );
	char * strFileNameOut;
	char * strFileNameIn;
	void Encode(ElementType *example);
	void RefinementPass1(CMatrix2D<ElementType> *m,int threshold);
	void SortingPass1(CMatrix2D<ElementType> *m, int threshold);
	BOOL TestSubset(CMatrix2D<ElementType> *m, int x, int y, int threshold, unsigned char type);
	BOOL ZeroTree(CMatrix2D<ElementType> *m, int x, int y, int threshold);
	void Initialization();
	void DumpBuffer();
	void PutBit(char bit);
	CLinkList * LIP;
	CLinkList *LIS;
	CLinkList *LSP;
	CSPIHTFileInfo CompressedFileInfo;
	unsigned int zeroes, ones;
	unsigned char outputbyte, mask;
	FILE * SPIHTFile;
	CMatrix2D<ElementType>* M;
	int nXDim;
	int nYDim;
	char cAction;
	CSPIHTCoder();
	virtual ~CSPIHTCoder();
private:
	unsigned char * pByte;
	char level;
protected:
	LPVOID lpMeta;
	CLinkList::ListElement* pNewlyAppended;

};
#pragma optimize("", on)

#endif // !defined(AFX_SPIHTCODER_H__861EEFD9_9B24_11D5_B119_5254AB32C4D0__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -