wavelet.h ( File view )

  • By c654162067 2013-10-31
  • View(s):227
  • Download(s):9
  • Point(s): 3
			#ifndef _WAVELETE_KIT_
#define _WAVELETE_KIT_
#endif
#ifdef _WAVELETE_KIT_
/*---------------------------------------------------------------------------*/
// Baseline Wavelet Transform Coder Construction Kit
//
// Geoff Davis
// gdavis@cs.dartmouth.edu
// http://www.cs.dartmouth.edu/~gdavis
//
// Copyright 1996 Geoff Davis 9/11/96
//
// Permission is granted to use this software for research purposes as
// long as this notice stays attached to this software.
//
/*---------------------------------------------------------------------------*/
#ifndef _GLOBAL_
#define _GLOBAL_
/*---------------------------------------------------------------------------*/
// global parameters
/*---------------------------------------------------------------------------*/
//#define DEBUG
// Use PGM images as default (comment this line out to use Raw images)
#define PGM
//#define DOUBLE_REAL
#define FLOAT_REAL

#ifdef DOUBLE_REAL
typedef double Real;
#endif
#ifdef FLOAT_REAL
//typedef float Real;
//typedef Real float;
#define Real float
#endif
/*---------------------------------------------------------------------------*/
// standard #defines
/*---------------------------------------------------------------------------*/
#define TRUE  1
#define FALSE 0

#define BACKSPACE 8
#define BS        8
#define ESC       27
/*---------------------------------------------------------------------------*/
// useful constants
/*---------------------------------------------------------------------------*/
#ifdef DOUBLE_REAL
const Real eps = 1.e-15;
const double MaxReal = 1.0e+100;
#endif
#ifdef FLOAT_REAL
const Real eps = 1.e-8;
const double MaxReal = 1.0e+100;
#endif

//const Real Pi = (Real)3.14159265358979;
#define Pi 3.14159265358979
//const Real TwoPi = 2.0 * Pi;
#define TwoPi 2*3.14159265358979
//const Real Sqrt2 = (Real)sqrt(2.0);
#define Sqrt2 1.41421356237;
//const Real Log2 = (Real)log(2.0)
#define Log2 0.301029995663

/*---------------------------------------------------------------------------*/
// helpful inline functions
/*---------------------------------------------------------------------------*/
#ifndef min
#define min(x,y) (((x)<(y))?(x):(y))
#define max(x,y) (((x)>(y))?(x):(y))
#endif

/*---------------------------------------------------------------------------*/
inline Real mod (Real x, Real N)
{

   Real xmodN = x - N*((int)(x/N));
   if (xmodN < 0) xmodN += N;
   return xmodN;

}

/*---------------------------------------------------------------------------*/
inline Real square (Real x) {
 return (x*x); 
}
/*---------------------------------------------------------------------------*/
inline int  isquare (int x) {
 return (x*x); 
}
/*---------------------------------------------------------------------------*/
inline int  sign (Real x)   {
 return (x > 0 ? 1 : x < 0 ? -1 : 0); 
}
/*---------------------------------------------------------------------------*/
inline int log2 (int x) {

   int count = 0;

   while (x > 1)  {

      x >>= 1;
      count++;
   
}
   return count;

}

/*---------------------------------------------------------------------------*/
// functions in global.cc
/*---------------------------------------------------------------------------*/
void init ();
void shut_down ();
volatile void error (char *format, ...);
void warning (char *format, ...);
void no_more_memory ();
/*---------------------------------------------------------------------------*/
#endif
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
// Baseline Wavelet Transform Coder Construction Kit
//
// Geoff Davis
// gdavis@cs.dartmouth.edu
// http://www.cs.dartmouth.edu/~gdavis
//
// Copyright 1996 Geoff Davis 9/11/96
//
// Permission is granted to use this software for research purposes as
// long as this notice stays attached to this software.
//
/*---------------------------------------------------------------------------*/
#ifndef _WAVELET_
#define _WAVELET_
//#include "global.h"
/*---------------------------------------------------------------------------*/

class Filter {

public:
  int size, firstIndex, center;
  Real *coeff;

  Filter () {
coeff = NULL; size = 0; firstIndex = 0;
};
  Filter (int size, int firstIndex = 0, Real *coeff = NULL)
            {
 init (size, firstIndex, coeff); 
};
  Filter (const Filter &filter) {
coeff=NULL; copy(filter);
};
  ~Filter ();
  
  void init (int size, int firstIndex, Real *coeff);
  Filter& operator= (const Filter &filter) {
copy(filter); return *this;
};
  Real& operator[] (int index) {
return coeff[index-firstIndex];
};

protected:
  void copy (const Filter &filter);

};

/*---------------------------------------------------------------------------*/

class FilterSet {

public:
  FilterSet () {
symmetric = FALSE; analysisLow = analysisHigh =
		synthesisLow = synthesisHigh = NULL;
};
  FilterSet (int symmetric, 
	     Real *anLow, int anLowSize, int anLowFirst,  
	     Real *synLow = NULL, int synLowSize = 0, int
	     synLowFirst = 0);
  FilterSet (const FilterSet &filterset);
  ~FilterSet ();

  void init (int symmetric, 
	     Real *anLow, int anLowSize, int anLowFirst, 
	     Real *synLow, int synLowSize, int synLowFirst);
  FilterSet& operator= (const FilterSet filterset);

  int symmetric;
  Filter *analysisLow, *analysisHigh, *synthesisLow,
    *synthesisHigh;

protected:
  void copy (const FilterSet& filterset);

};

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

class Wavelet {

public:
	void Antoninitransform1d (Real *input, Real *output, int size);
	void processWave(Real *input, Real *output, int size , int level , int nstep , int sym_ext=-1 );
  Wavelet (FilterSet *filterset);
  ~Wavelet ();
  
  void transform1d (Real *input, Real *output, int size,
		     int nsteps, int sym_ext = -1);
  void invert1d (Real *input, Real *output, int size,
		  int nsteps, int sym_ext = -1);
  
  void transform2d (Real *input, Real *output, int hsize, int vsize,
		     int nsteps, int sym_ext = -1);
  void invert2d (Real *input, Real *output, int hsize, int vsize, 
		  int nsteps, int sym_ext = -1);

  Filter *analysisLow, *analysisHigh;    // H and G
  Filter *synthesisLow, *synthesisHigh;  // H~ and G~
  int symmetric;  // TRUE if filter set is symmetric

  void symmetric_extension (Real *output, int size, int left_ext, int
			    right_ext, int symmetry);
  void periodic_extension (Real *output, int size);
  int npad;
  
 protected:
  void transform_step (Real *input, Real *output, int size, int sym_ext);
  void invert_step (Real *input, Real *output, int size, int sym_ext);

  // copy length elements from p1 to p2
  void copy (const Real *p1, Real *p2, const int length)
  {
int temp = length; while(temp--) *p2++ = *p1++;
}
  void copy (const Real *p1, const int stride1, Real *p2, 
	     const int length)
  {
int temp = length; while(temp--) {
*p2++ = *p1; p1 += stride1;
}
}
  void copy (const Real *p1, Real *p2, const int stride2,
	     const int length)
  {
int temp = length; while(temp--) {
*p2 = *p1++; p2 += stride2;
}
}

};

/*---------------------------------------------------------------------------*/
//enum {
 SPLINE, HAAR, ADELSON, DAUB4, DAUB6, DAUB8 
};
//extern const Wavelet *(wavelets[]);
//extern const char *(wavelet_name[]);

extern FilterSet Haar, Daub4, Daub6, Daub8, Antonini, Villa, Adelson,
  Brislawn, Brislawn2, Villa1, Villa2, Villa3, Villa4, Villa5, Villa6, 
  Odegard,Villa1810,Meyer;
/*---------------------------------------------------------------------------*/
#endif
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
// Baseline Wavelet Transform Coder Construction Kit
//
// Geoff Davis
// gdavis@cs.dartmouth.edu
// http://www.cs.dartmouth.edu/~gdavis
//
// Copyright 1996 Geoff Davis 9/11/96
//
// Permission is granted to use this software for research purposes as
// long as this notice stays attached to this software.
//
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
#endif
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 3

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.96 kB
~$?+?+?-+?-?+???+?final.doc162.00 B2013-10-21 17:36
01.96 kB
01.96 kB
1001099ECG.txt303.95 kB2011-10-27 09:55
1001104ECG.txt449.72 kB2011-10-27 09:55
1001105ECG.txt300.11 kB2011-10-27 09:55
1002122ECG.txt298.52 kB2011-10-27 09:55
20090010ECG.txt306.25 kB2011-10-27 09:55
01.96 kB
01.96 kB
1002093ECG.txt298.05 kB2011-10-27 09:55
1002113ECG.txt297.83 kB2011-10-27 09:55
20080962ECG.txt300.06 kB2011-10-27 09:55
20080983ECG.txt302.18 kB2011-10-27 09:55
20091662ECG.txt302.89 kB2011-10-27 09:55
01.96 kB
cplxCput.cpp1.31 kB2011-10-27 09:55
cplxCput.h816.00 B2011-10-27 09:55
01.96 kB
cplxCput.obj21.55 kB2011-10-27 15:16
cplxCput.sbr1.33 MB2011-10-27 15:16
ECG.bsc5.12 MB2011-10-27 09:55
ECG.exe176.07 kB2013-10-24 18:12
ECG.ilk537.42 kB2013-10-24 18:12
ECG.obj25.34 kB2011-10-27 15:16
ECG.pch6.93 MB2011-10-27 15:16
ECG.pdb593.00 kB2013-10-24 18:12
ECG.res4.60 kB2011-10-27 15:16
ECG.sbr1.34 MB2011-10-27 15:16
ECGDlg.obj153.13 kB2013-10-24 18:12
ECGDlg.sbr1.56 MB2013-10-24 18:12
HeartAnalyse.obj20.09 kB2011-10-27 15:16
HeartAnalyse.sbr1.31 MB2011-10-27 15:16
mfc42d.dll908.05 kB2011-10-27 09:55
mfco42d.dll780.05 kB2011-10-27 09:55
MSVCIRTD.DLL92.08 kB2011-10-27 09:55
msvcrt.dll335.00 kB2011-10-27 09:55
msvcrtd.dll392.07 kB2011-10-27 09:55
Parameter.obj19.91 kB2011-10-27 15:16
Parameter.sbr1.31 MB2011-10-27 15:16
StdAfx.obj103.36 kB2011-10-27 15:16
StdAfx.sbr1.31 MB2011-10-27 15:16
vc60.idb601.00 kB2013-10-25 10:15
vc60.pdb484.00 kB2013-10-24 18:12
WaveCoef.obj13.76 kB2011-10-27 15:16
WaveCoef.sbr1.31 MB2011-10-27 15:16
wavelet.obj75.29 kB2011-10-27 09:55
wavelet.sbr22.38 kB2011-10-27 09:55
WaveParamSet.obj25.86 kB2011-10-27 15:16
WaveParamSet.sbr1.31 MB2011-10-27 15:16
ECG.APS24.64 kB2011-11-10 20:30
ECG.clw5.99 kB2011-11-10 21:56
ECG.cpp2.01 kB2011-10-27 09:55
ECG.dsp4.88 kB2011-10-27 09:55
ECG.dsw531.00 B2011-10-27 09:55
ECG.h1.26 kB2011-10-27 09:55
ECG.ncb553.00 kB2013-10-25 18:56
ECG.opt452.00 kB2013-10-25 18:56
ECG.plg240.00 B2013-10-25 10:15
ECG.rc9.51 kB2011-10-27 09:55
ECGDlg.cpp52.35 kB2013-10-24 18:12
ECGDlg.cpp.bak49.92 kB2013-10-24 13:59
ECGDlg.h3.12 kB2011-10-27 09:55
HeartAnalyse.cpp1.25 kB2011-10-27 09:55
HeartAnalyse.h1.29 kB2011-10-27 09:55
Parameter.cpp1.03 kB2011-10-27 09:55
Parameter.h1.22 kB2011-10-27 09:55
ReadMe.txt3.44 kB2011-10-27 09:55
01.96 kB
resource.h2.47 kB2011-10-27 09:55
cursor1.cur326.00 B2011-10-27 09:55
ECG.ico1.05 kB2011-10-27 09:55
ECG.rc2395.00 B2011-10-27 09:55
StdAfx.cpp205.00 B2011-10-27 09:55
StdAfx.h1.03 kB2011-10-27 09:55
WaveCoef.cpp667.00 B2011-10-27 09:55
WaveCoef.h703.00 B2011-10-27 09:55
wavelet.cpp33.78 kB2011-10-27 09:55
wavelet.h8.32 kB2011-10-27 09:55
WaveParamSet.cpp1.75 kB2011-10-27 09:55
WaveParamSet.h1.26 kB2011-10-27 09:55
~VCBAE.tmp432.00 kB2013-10-23 19:28
<~VCBAF.tmp>0.00 B2013-10-23 19:28
?-???+?+?-+?-?+???+?final.doc495.50 kB2011-11-10 20:06
-?-???4.33 MB2012-01-28 17:39
...
Sponsored links

wavelet.h (14.44 MB)

Need 3 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D