libpgf  7.15.32
PGF - Progressive Graphics File
WaveletTransform.h
Go to the documentation of this file.
1 /*
2  * The Progressive Graphics File; http://www.libpgf.org
3  *
4  * $Date: 2006-05-18 16:03:32 +0200 (Do, 18 Mai 2006) $
5  * $Revision: 194 $
6  *
7  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
11  * as published by the Free Software Foundation; either version 2.1
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22  */
23 
28 
29 #ifndef PGF_WAVELETTRANSFORM_H
30 #define PGF_WAVELETTRANSFORM_H
31 
32 #include "PGFtypes.h"
33 #include "Subband.h"
34 
36 // Constants
37 const UINT32 FilterSizeL = 5;
38 const UINT32 FilterSizeH = 3;
40 
41 #ifdef __PGFROISUPPORT__
42 class CRoiIndices {
47 };
48 #endif //__PGFROISUPPORT__
49 
50 
56  friend class CSubband;
57 
58 public:
65  CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data = nullptr);
66 
70 
77  OSError ForwardTransform(int level, int quant);
78 
87  OSError InverseTransform(int level, UINT32* width, UINT32* height, DataT** data);
88 
93  CSubband* GetSubband(int level, Orientation orientation) {
94  ASSERT(level >= 0 && level < m_nLevels);
95  return &m_subband[level][orientation];
96  }
97 
98 #ifdef __PGFROISUPPORT__
99  void SetROI(PGFRect rect);
103 
109  const bool TileIsRelevant(int level, UINT32 tileX, UINT32 tileY) const { ASSERT(m_indices); ASSERT(level >= 0 && level < m_nLevels); return m_indices[level].IsInside(tileX, tileY); }
110 
115  UINT32 GetNofTiles(int level) const { ASSERT(level >= 0 && level < m_nLevels); return 1 << (m_nLevels - level - 1); }
116 
120  const PGFRect& GetAlignedROI(int level) const { return m_subband[level][LL].GetAlignedROI(); }
121 
122 #endif // __PGFROISUPPORT__
123 
124 private:
125  void Destroy() {
126  delete[] m_subband; m_subband = nullptr;
127  #ifdef __PGFROISUPPORT__
128  delete[] m_indices; m_indices = nullptr;
129  #endif
130  }
131  void InitSubbands(UINT32 width, UINT32 height, DataT* data);
132  void ForwardRow(DataT* buff, UINT32 width);
133  void InverseRow(DataT* buff, UINT32 width);
134  void InterleavedToSubbands(int destLevel, DataT* loRow, DataT* hiRow, UINT32 width);
135  void SubbandsToInterleaved(int srcLevel, DataT* loRow, DataT* hiRow, UINT32 width);
136 
137 #ifdef __PGFROISUPPORT__
138  PGFRect *m_indices;
139 #endif //__PGFROISUPPORT__
140 
141  int m_nLevels;
143 };
144 
145 #endif //PGF_WAVELETTRANSFORM_H
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
friend class CSubband
INT32 DataT
Definition: PGFtypes.h:262
void ForwardRow(DataT *buff, UINT32 width)
const UINT32 FilterSize
PGF wavelet subband class.
Orientation
Definition: PGFtypes.h:99
Wavelet channel class.
Definition: Subband.h:42
PGF wavelet transform.
void InverseRow(DataT *buff, UINT32 width)
OSError ForwardTransform(int level, int quant)
#define __max(x, y)
Definition: PGFplatform.h:92
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
CSubband * GetSubband(int level, Orientation orientation)
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
PGF definitions.
Definition: PGFtypes.h:99
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=nullptr)
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
Rectangle.
Definition: PGFtypes.h:222
#define NSubbands
number of subbands per level
Definition: PGFtypes.h:63
~CWaveletTransform()
Destructor.
const UINT32 FilterSizeH
number of coefficients of the high pass filter
const UINT32 FilterSizeL
number of coefficients of the low pass filter