1 /*
2  * -------------------------------------------------------------------------
3  * haar.c -- Haar wavelets coefficients.
4  * SWT - Scilab wavelet toolbox
5  * Copyright (C) 2005-2006  Roger Liu
6  * Copyright (C) 20010-2012  Holger Nahrstaedt
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  * -------------------------------------------------------------------------
22  */
23 
24 #include "swtlib.h"
25 
26 /*********************************************
27  * Local Variable (Filter Coefficent)
28  ********************************************/
29 
30 static const double haar[2] = {
31      7.071067811865475244008443621048490392848359376884740365883398e-01,
32  7.071067811865475244008443621048490392848359376884740365883398e-01
33  //0.70710678, 0.70710678
34 };
35 
36 /*********************************************
37  * Global Function
38  ********************************************/
39 
40 void
haar_analysis_initialize(int member,swt_wavelet * pWaveStruct)41 haar_analysis_initialize (int member, swt_wavelet *pWaveStruct)
42 {
43 //   double *pFilterCoef;
44 
45 //   pFilterCoef = haar;
46 
47   pWaveStruct->length = 2;
48 
49   wrev(haar, pWaveStruct->length,
50        LowDecomFilCoef, pWaveStruct->length);
51   qmf_wrev(haar, pWaveStruct->length,
52 	   HiDecomFilCoef, pWaveStruct->length);
53   pWaveStruct->pLowPass = LowDecomFilCoef;
54   pWaveStruct->pHiPass = HiDecomFilCoef;
55 
56   return;
57 }
58 
59 void
haar_synthesis_initialize(int member,swt_wavelet * pWaveStruct)60 haar_synthesis_initialize (int member, swt_wavelet *pWaveStruct)
61 {
62 //   double *pFilterCoef;
63 
64 //   pFilterCoef = haar;
65   pWaveStruct->length = 2;
66 
67   verbatim_copy(haar, pWaveStruct->length,
68 		LowReconFilCoef, pWaveStruct->length);
69   qmf_even(haar, pWaveStruct->length,
70       HiReconFilCoef, pWaveStruct->length);
71   pWaveStruct->pLowPass = LowReconFilCoef;
72   pWaveStruct->pHiPass = HiReconFilCoef;
73 
74   return;
75 }
76