libpgf 6.14.12
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#define FilterWidth 5
38#define FilterHeight 3
39
40#ifdef __PGFROISUPPORT__
45class CRoiIndices {
46 friend class CWaveletTransform;
47
50 CRoiIndices()
51 : m_nLevels(0)
52 , m_indices(0)
53 {}
54
57 ~CRoiIndices() { Destroy(); }
58
59 void Destroy() { delete[] m_indices; m_indices = 0; }
60 void CreateIndices();
61 void ComputeIndices(UINT32 width, UINT32 height, const PGFRect& rect);
62 const PGFRect& GetIndices(int level) const { ASSERT(m_indices); ASSERT(level >= 0 && level < m_nLevels); return m_indices[level]; }
63 void SetLevels(int levels) { ASSERT(levels > 0); m_nLevels = levels; }
64 void ComputeTileIndex(UINT32 width, UINT32 height, UINT32 pos, bool horizontal, bool isMin);
65
66public:
70 UINT32 GetNofTiles(int level) const { ASSERT(level >= 0 && level < m_nLevels); return 1 << (m_nLevels - level - 1); }
71
72private:
73 int m_nLevels;
74 PGFRect *m_indices;
75
76};
77#endif //__PGFROISUPPORT__
78
79
85 friend class CSubband;
86
87public:
94 CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data = NULL);
95
99
106 OSError ForwardTransform(int level, int quant);
107
116 OSError InverseTransform(int level, UINT32* width, UINT32* height, DataT** data);
117
122 CSubband* GetSubband(int level, Orientation orientation) {
123 ASSERT(level >= 0 && level < m_nLevels);
124 return &m_subband[level][orientation];
125 }
126
127#ifdef __PGFROISUPPORT__
131 void SetROI(const PGFRect& rect);
132
136 const PGFRect& GetTileIndices(int level) const { return m_ROIindices.GetIndices(level); }
137
141 UINT32 GetNofTiles(int level) const { return m_ROIindices.GetNofTiles(level); }
142
146 const PGFRect& GetROI(int level) const { return m_subband[level][LL].GetROI(); }
147
148#endif // __PGFROISUPPORT__
149
150private:
151 void Destroy() {
152 delete[] m_subband; m_subband = 0;
153 #ifdef __PGFROISUPPORT__
154 m_ROIindices.Destroy();
155 #endif
156 }
157 void InitSubbands(UINT32 width, UINT32 height, DataT* data);
158 void ForwardRow(DataT* buff, UINT32 width);
159 void InverseRow(DataT* buff, UINT32 width);
160 void LinearToMallat(int destLevel,DataT* loRow, DataT* hiRow, UINT32 width);
161 void MallatToLinear(int srcLevel, DataT* loRow, DataT* hiRow, UINT32 width);
162
163#ifdef __PGFROISUPPORT__
164 CRoiIndices m_ROIindices;
165#endif //__PGFROISUPPORT__
166
169};
170
171#endif //PGF_WAVELETTRANSFORM_H
PGF definitions.
#define NSubbands
number of subbands per level
Definition: PGFtypes.h:57
Orientation
Definition: PGFtypes.h:92
@ LL
Definition: PGFtypes.h:92
INT32 DataT
Definition: PGFtypes.h:219
PGF wavelet subband class.
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.
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=NULL)
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
void MallatToLinear(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
CSubband * GetSubband(int level, Orientation orientation)
OSError ForwardTransform(int level, int quant)
void ForwardRow(DataT *buff, UINT32 width)
void LinearToMallat(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
friend class CSubband
int m_nLevels
number of transform levels: one more than the number of level in PGFimage
Rectangle.
Definition: PGFtypes.h:194