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

📄 integerdwt_testedok.c

📁 Implementation of Integerwavelet transform Plus SPIHT encoding for an image
💻 C
📖 第 1 页 / 共 3 页
字号:
			LSP2[LSPcount]=LIP2[k];			LIP1[k]=120;			LIP2[k]=120;			LSPcount=LSPcount+1;			LSPsize=LSPsize+1;           	}                                                      else			{           			st[bitCount]= 0;                       	        bitCount = bitCount + 1;			}	}//end of for looptmpLIPcount = 0;	    //% only investigate to the last used index    for (k1=0;k1<LIPsize;k1++)	{		BB=LIP1[k1];	    CC=LIP2[k1];		if ((BB== 120))		{		}		else		{            tmpLIP1[tmpLIPcount] = LIP1[k1];			tmpLIP2[tmpLIPcount] = LIP2[k1];            tmpLIPcount = tmpLIPcount + 1;        }	}                        //clear tmpLIP;        LIPcount = tmpLIPcount;    LIPsize = tmpLIPcount;	for (k2=0;k2<LIPsize;k2++)		{		 LIP1[k2]=	tmpLIP1[k2]; 		 LIP2[k2]=	tmpLIP2[k2] ;		}//////////////////////END OF LIP	notDone = 1;    currset = 0;        if (LISsize <= 0)	{        notDone = 0;    }///////////////////////////////////////////while (notDone){				if (LIS4[currset] == -1)				{													AAA=LIS1[currset];						AAA=AAA+1;						BBB=LIS2[currset];						BBB=BBB+1;						CCC=LIS3[currset];						DDD=LIS4[currset];						coeffMax = checkSignificance(AAA,BBB,CCC,DDD,T,xDim,yDim,level);			  			LIS4[currset] = coeffMax;					    if(coeffMax < T) sign = 0;
				        else sign=1;														}				else				{         									if (LIS4[currset] >= T)									{												sign = 1;												AAA=LIS1[currset];												AAA=AAA+1;												BBB=LIS2[currset];												BBB=BBB+1;												CCC=LIS3[currset];												DDD=LIS4[currset];																							getChildren(AAA,BBB,CCC,DDD,xDim,yDim,level);									}									else									{										sign = 0;									}				}        			 st[bitCount]= sign;                       			 bitCount = bitCount + 1;		      		                if (sign==1)		{                       if (LIS3[currset] == D)			{             							for (k=0;k<4;k++)							{																		LIP_1=descArrS.desc1[k];										LIP_2=descArrS.desc2[k];										LIP_1=LIP_1;										LIP_2=LIP_2;												currCoeff = Ad[LIP_1][LIP_2];								                    																							if (abs(currCoeff) >= T)										{													st[bitCount]= 1;                       													bitCount = bitCount + 1;											            														if (currCoeff >= 0)																{                												st[bitCount]= 1;                       																bitCount = bitCount + 1;																															}																										else															{               													st[bitCount]= 0;                       																bitCount = bitCount + 1;																 																	}																																												LSP1[LSPcount]=LIP_1;														LSP2[LSPcount]=LIP_2;																												LSPcount=LSPcount+1;														LSPsize=LSPsize+1;																					}														else										{											st[bitCount]= 0;                       											bitCount = bitCount + 1;																											LIP1[LIPcount]=LIP_1;											LIP2[LIPcount]=LIP_2;											LIPcount=LIPcount+1;											LIPsize=LIPsize+1;																		}													                                                              							}										LIS1[currset]=120;						LIS2[currset]=120;						LIS3[currset]=120;						LIS4[currset]=120;						//LISsize = LISsize-1;													}				}						currset = currset + 1;						if (currset > (LIScount - 1))						{							notDone = 0;						}}	////*			 tmpLIScount =0;       	for (k1=0;k1<LISsize;k1++)	{		BB=LIS1[k1];	    CC=LIS2[k1];		if ((BB!= 120))		{            tmpLIS1[tmpLIScount] = LIS1[k1];			tmpLIS2[tmpLIScount] = LIS2[k1];			tmpLIS3[tmpLIScount] = LIS3[k1];			tmpLIS4[tmpLIScount] = LIS4[k1];            tmpLIScount = tmpLIScount + 1;        }	}                        //clear tmpLIP;       LIScount = tmpLIScount;    //LISsize = tmpLIScount-1;	  LISsize = tmpLIScount;
	  		for (k2=0;k2<LISsize;k2++)		{		 LIS1[k2]=tmpLIS1[k2]; 		 LIS2[k2]=tmpLIS2[k2];		 LIS3[k2]=tmpLIS3[k2]; 		 LIS4[k2]=tmpLIS4[k2];		}		//////////////////////////////////////////////////////									for (k=0;k<=OldLSPCount;k++)	{		LSP1_1=LSP1[k];		LSP1_2=LSP2[k];		Coeff=Ad[LSP1_1][LSP1_2];        Refinement=((floor(abs(Coeff)))/T);        Val = (Refinement&1);		st[bitCount]=Val;		bitCount = bitCount + 1;		}	OldLSPCount = LSPcount - 1;////////////////////////LIS		if (T == 1)		{ 		totalbitCount=bitCount;        break;		}		T = T/2;	}//end of while loopreturn Tact;}//END OF cpiht FUNCTION////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void dSPIHT(int Tact){		int AAA,BBB,CCC,DDD,AAAA,BBBB;		int Refinement;		int Coeff;		int L=1;		int A,B,BB,CC;		//int xDim=4;		//int yDim=4;		int level=1;		int rows,columns,l,m,i,k,k1,k2,j;		int Val;		int LSPcount = 0;		int OldLSPCount = -1;		int LSPinc = 50;		int LSPsize = -1;		int scaling;		//int sigBit;		int LISsize = 0;		unsigned int LIScount = 0;		unsigned char LISinc = 50;		int currCoeff;		unsigned int tmpLIPcount = 0;		unsigned int tmpLIScount =0;		int LIPsize = 0;		unsigned int LIPcount = 0;		int LIPinc = 50;		int notDone =0;		int index_st;		int currSet;		int bitCount=10;		int bitbudget = 100000;		
		/*int LIP_2;		int LIP_1;		int LSP1_1;		int LSP1_2;*/
		unsigned char LIP_1,LIP_2,LSP1_1,LSP1_2;
				
		int coeffMax;		int sign;		int lL;		int mM;						int desc1a,desc2a,desc3a,desc4a,cnty;		T = Tact;		xDim = st[1];		yDim = st[2];		level = st[3];				scaling = 2;		rows=yDim/scaling;		columns=xDim/scaling;		/*for(i=0;i<ROW;i++);		{			for(j=0;j<COL;j++);			{				Ad[i][j]=0;			}		}*/
					for(l=0;l<rows;l++)		{					for(m=0;m<columns;m++)		{   			 LIP1[LIPcount]=l;			 LIP2[LIPcount]=m;			              LIPcount = LIPcount + 1;  			mM=m+1;			lL=l+1;								AAAA=(((lL&1))&&((mM&1)));					if(AAAA!=1)					{											LIS1[LIScount] = l;					LIS2[LIScount] = m;					LIS3[LIScount] = D;					LIS4[LIScount] = -1;					LIScount = LIScount + 1;																	}		}		}LIPsize = LIPcount - 1;LISsize = LIScount - 1;///////////////////T=pow(2,sigBit);/////////////////////////////*st[0] = sigBit;st[1] = xDim;st[2] = yDim;st[3] = level;st[4] = 0;st[5] = 0;st[6] = 0;st[7] = 0;st[8] = 0;st[9] = 0;*////////////////////////////while (bitCount < bitbudget){//////////////////////////////////////////// LIP	for (k=0;k<=LIPsize;k++)	{		LIP_1=LIP1[k];	LIP_2=LIP2[k];	currCoeff = Ad[LIP_1][LIP_2];	if (st[bitCount]==1)	{		bitCount = bitCount + 1;			if (st[bitCount]==0)			{				AAAA=LIP1[k];				BBBB=LIP2[k];                Ad[AAAA][BBBB] = (Ad[AAAA][BBBB] - T);			}            else				{                AAAA=LIP1[k];				BBBB=LIP2[k];                Ad[AAAA][BBBB] = (Ad[AAAA][BBBB] + T);          				}                      	        bitCount = bitCount + 1;			                        LSP1[LSPcount]=LIP1[k];			LSP2[LSPcount]=LIP2[k];			LIP1[k] = 120;			LIP2[k] = 120;			LSPcount=LSPcount+1;			LSPsize=LSPsize+1;           	}                                                      else			{           	                   	        bitCount = bitCount + 1;						}	}//end of for looptmpLIPcount = 0;	    //% only investigate to the last used index    for (k1=0;k1<=LIPsize;k1++)	{		BB=LIP1[k1];	    CC=LIP2[k1];		if ((BB== 120))		{		}		else		{            tmpLIP1[tmpLIPcount] = LIP1[k1];			tmpLIP2[tmpLIPcount] = LIP2[k1];            tmpLIPcount = tmpLIPcount + 1;        }	}                    LIPcount = tmpLIPcount;    LIPsize = tmpLIPcount-1;	for (k2=0;k2<=LIPsize;k2++)		{		 LIP1[k2]=  tmpLIP1[k2]; 		 LIP2[k2]=	tmpLIP2[k2] ;		}/////////////////		notDone = 1;    currset = 0;        if (LISsize < 0)	{        notDone = 0;    }///////////////////////////////////////////									////////////////////////////////////////////////////////////////////////////////////while (notDone){				sign=st[bitCount];				if (LIS4[currset] == -1)				{													if (sign==0)						{			  			LIS4[currset] = T;						}													}				bitCount = bitCount + 1;		         			                if (sign==1)		{           		AAA=LIS1[currset];				AAA=AAA+1;				BBB=LIS2[currset];				BBB=BBB+1;				CCC=LIS3[currset];				DDD=LIS4[currset];				getChildren(AAA,BBB,CCC,DDD,xDim,yDim,level);            if (LIS3[currset] == D)			{             							for (k=0;k<4;k++)							{																		LIP_1=descArrS.desc1[k];										LIP_2=descArrS.desc2[k];										//LIP_1=LIP_1-1;										//LIP_2=LIP_2-1;												currCoeff = Ad[LIP_1][LIP_2];								                  																						if (st[bitCount]==1)											{												bitCount = bitCount + 1;													if (st[bitCount]==1)													{														AAAA=LIP_1;														BBBB=LIP_2;														Ad[AAAA][BBBB] = Ad[AAAA][BBBB] + T;													}													else														{																										AAAA=LIP_1;														BBBB=LIP_2;														Ad[AAAA][BBBB] = Ad[AAAA][BBBB] - T;          														                    																										}															bitCount = bitCount + 1;																																								LSP1[LSPcount]=LIP_1;														LSP2[LSPcount]=LIP_2;														LSPcount=LSPcount+1;														LSPsize=LSPsize+1;																									}																							else										{

⌨️ 快捷键说明

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