libpgf  7.21.2
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__
46 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__
102  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
#define __max(x, y)
Definition: PGFplatform.h:92
PGF definitions.
#define NSubbands
number of subbands per level
Definition: PGFtypes.h:63
Orientation
Definition: PGFtypes.h:99
@ LL
Definition: PGFtypes.h:99
INT32 DataT
Definition: PGFtypes.h:269
PGF wavelet subband class.
const UINT32 FilterSizeL
number of coefficients of the low pass filter
const UINT32 FilterSizeH
number of coefficients of the high pass filter
const UINT32 FilterSize
Wavelet channel class.
Definition: Subband.h:42
PGF wavelet transform.
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
void InverseRow(DataT *buff, UINT32 width)
~CWaveletTransform()
Destructor.
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
CSubband * GetSubband(int level, Orientation orientation)
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
OSError ForwardTransform(int level, int quant)
void ForwardRow(DataT *buff, UINT32 width)
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=nullptr)
friend class CSubband
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
Rectangle.
Definition: PGFtypes.h:225