www.pudn.com > EZW_.rar > EZW.H


/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/	 
/* EZW2 - Embedded Zerotree Wavelet Coder 
 *  
 * Author : Mow-Song, Ng 
 * Data   : 20-07-2002 
 * 
 * Last update : 31-08-2002 
 * 
 * A large portion/idea of the codes come from: 
 * C. Valens - Embedded Zerotree Wavelet Encoder Tutorial. 
 * G. Davis - Baseline Wavelet Transform Coder Construction Kit 
 * 
 * The authors copyrights to the codes are acknowledged. 
 * The EZW coder is patented by Jerome Shapiro. As far as I know, these are 
 * the patent numbers  
 * 5315670 (Issued May 24, 1994), 5321776 (Issued June 14, 1994) and  
 * 5412741 (Issued May 2, 1995). 
 * 
 * 
 * Well, I wrote the coder with some one else codes, add some lines, remove  
 * some lines, sometimes just verbatim. Any way, if you feel that I am worth 
 * the acknowledgement, please do so, or perhaps drop me an e-mail. 
 * 
 * Please refer to my website for more info. 
 * 
 * My contact: 
 * msng@mmu.edu.my 
 * http://www.pesona.mmu.edu.my/~msng 
 * 
 */ 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/	 
  
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/	 
/* $TODO 
 * ----- 
 * - Add some other scan methods. 
 * - etc... 
 * 
 */ 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/	 
 
/* disable unused variabled warning */ 
#pragma warning (disable : 4101) 
 
#include  
#include  
#include  
#include  
#include  
 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/ 
#include "global.h" 
#include "mem.h" 
#include "image.h" 
#include "wavelet.h" 
#include "wtransform.h" 
#include "aricacm.h" 
#include "map.h" 
#include "subbandsymbol.h" 
#include "memchk.h" 
 
/* Code alphabet */ 
#define ZTR   0x00  
#define POS   0x01  
#define NEG   0x02  
#define IZ    0x03 
 
#define ImageXSizeBits		13 
#define ImageYSizeBits		13 
#define ScanOrderBits		2 
#define ScaleBits				4 
#define WaveletIndexBits	4 
#define ImageMeanBits		32 
#define ThresholdBits		16 
#define MaxHistoCountBits	12 
 
#define BASEBAND_PARENT_SIGNIFICANT FALSE 
 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/ 
static char *FilterName[16] = {"antonini", "adelson", "odegard", "villa1810",  
										 "brislawn", "brislawn2", "haar", "daub4",  
										 "daub6", "daub8", "villa1", "villa2",  
										 "villa3", "villa4", "villa5", "villa6"}; 
 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/ 
typedef struct DominantPassNodeStruct { 
  short int x; 
  short int y; 
  char scale; 
  char orientation; 
  char code; 
} DLNode; 
 
/*----------------------------------------------------------------------------*/	 
/*----------------------------------------------------------------------------*/ 
typedef struct SubordinatePastNodeStruct { 
  short int x; 
  short int y; 
  char scale; 
  char orientation; 
  int qvalue; 
  int rvalue; 
} SLNode; 
 
 
/* 
int ScanOrderX[4]={0, 1, 0, 1}; 
int ScanOrderY[4]={0, 0, 1, 1}; 
*/ 
 
 
int ScanOrderX[4]={0, 0, 1, 1}; 
int ScanOrderY[4]={0, 1, 1, 0}; 
 
 
/* 
int ScanOrderX[4]={0, 0, 1, 1}; 
int ScanOrderY[4]={0, 1, 0, 1}; 
*/