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

📄 subbands.h

📁 用C++语言实现的基于小波分析的源代码,实现了小波分析的诸多算法
💻 H
字号:
#ifndef SUBBANDS_H
#define SUBBANDS_H

/****
*
*	"subband" is either a "subband_leaf" or "subband_node"
*
*	
	doStuff(subband *sb) {
		if ( sb->leaf ) {
			subband_leaf *sbl;
			sbl = (subband_leaf *) sb;
			// use sbl
		} {
			subband_node *sbn;
			sbn = (subband_node *) sbn;
			if ( sbn->LL ) doStuff(sbn->LL);
			if ( sbn->LH ) doStuff(sbn->LH);
			if ( sbn->HL ) doStuff(sbn->HL);
			if ( sbn->HH ) doStuff(sbn->HH);
		}
	}
*
*****/

typedef struct _subband_leaf subband_leaf;
typedef struct _subband subband_node;
typedef struct _subband subband;

struct _subband_leaf {
	bool leaf;	// == true
	subband *prev;	// the node that points to me
	int width,height,rowpad,activity,max_value,type;
		// activity must be trasmitted ; max_val is for *encoder* reference only, and decisions must be transmitted
		//	max_val would help the BP coders

	bool transposed;
	int *band;
		// points into an image
	subband_leaf *parent;
		// parent is gauranteed to be half the width & same type of band
	subband_leaf *cntx1,*cntx2;	
		// both are already sent, cntx1 is probably parent, cntx1 == cntx2 is possible
	int cntx1shift,cntx2shift;
		// the band[x,y] 's context is cntx1[(x)>>cntx1shift,(y)>>cntx1shift]
		// in a normal EZ wavelet these are always 1
};

struct _subband {
	bool leaf;	// == false
	subband_node *prev;	// the node that points to me
	int width,height,rowpad,activity,max_value,type;

	subband *LL,*HL,*LH,*HH;
};

typedef struct _image image;
typedef struct _coder coder;
typedef struct _wavelet wavelet;

extern void freeSubbands(subband *root);
extern subband * imageToSubbands(image *im,int levels);
	/** image can be empty or full, the subbands just point to
	*	entry points in the image
	***/
	// might return NULL as a valid return (when levels == 0 )

extern subband * makeSubbandQuad(int *band,int w,int h,int fullw,int levels,subband_node *prev);

extern void encodeWaveletSubbands(wavelet *wavelet);
extern void decodeWaveletSubbands(wavelet *wavelet);

extern void activitySubbands(subband * sb);
extern void transposeSubbandLHs(subband *sb);

void findAllSubbandParents(subband *sb,int type);

void printSubbandInfo(subband *sb,FILE *fp,int depth);

#define leaf_op(sb,op) if ( ! (sb)->leaf ) ; else ((subband_leaf *)(sb))->op

#define TYPE_LL	0
#define TYPE_LH	1
#define TYPE_HL	2
#define TYPE_HH	3 

#endif //BANDLIST_H

⌨️ 快捷键说明

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