| 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;
39 const UINT32 FilterSize = __max(FilterSizeL, FilterSizeH);
40
41 #ifdef __PGFROISUPPORT__
42 class CRoiIndices {
47 };
48 #endif //__PGFROISUPPORT__
49
50
55 class CWaveletTransform {
56 friend class CSubband;
57
58 public:
65 CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT* data = nullptr);
66
69 ~CWaveletTransform() { Destroy(); }
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;
142 CSubband (*m_subband)[NSubbands];
143 };
144
145 #endif //PGF_WAVELETTRANSFORM_H
CWaveletTransform::InverseTransform
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
Definition: WaveletTransform.cpp:245
CWaveletTransform::CSubband
friend class CSubband
Definition: WaveletTransform.h:56
DataT
INT32 DataT
Definition: PGFtypes.h:268
CWaveletTransform::ForwardRow
void ForwardRow(DataT *buff, UINT32 width)
Definition: WaveletTransform.cpp:180
FilterSize
const UINT32 FilterSize
Definition: WaveletTransform.h:39
CWaveletTransform::Destroy
void Destroy()
Definition: WaveletTransform.h:125
Subband.h
PGF wavelet subband class.
Orientation
Orientation
Definition: PGFtypes.h:99
CSubband
Wavelet channel class.
Definition: Subband.h:42
CWaveletTransform
PGF wavelet transform.
Definition: WaveletTransform.h:55
CWaveletTransform::InverseRow
void InverseRow(DataT *buff, UINT32 width)
Definition: WaveletTransform.cpp:419
CWaveletTransform::ForwardTransform
OSError ForwardTransform(int level, int quant)
Definition: WaveletTransform.cpp:88
__max
#define __max(x, y)
Definition: PGFplatform.h:92
CWaveletTransform::m_nLevels
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
Definition: WaveletTransform.h:141
CWaveletTransform::GetSubband
CSubband * GetSubband(int level, Orientation orientation)
Definition: WaveletTransform.h:93
CWaveletTransform::SubbandsToInterleaved
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
Definition: WaveletTransform.cpp:444
CWaveletTransform::m_subband
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
Definition: WaveletTransform.h:142
CWaveletTransform::InterleavedToSubbands
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
Definition: WaveletTransform.cpp:206
PGFtypes.h
PGF definitions.
LL
Definition: PGFtypes.h:99
CWaveletTransform::CWaveletTransform
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=nullptr)
Definition: WaveletTransform.cpp:40
CWaveletTransform::InitSubbands
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
Definition: WaveletTransform.cpp:53
PGFRect
Rectangle.
Definition: PGFtypes.h:224
NSubbands
#define NSubbands
number of subbands per level
Definition: PGFtypes.h:63
CWaveletTransform::~CWaveletTransform
~CWaveletTransform()
Destructor.
Definition: WaveletTransform.h:69
FilterSizeH
const UINT32 FilterSizeH
number of coefficients of the high pass filter
Definition: WaveletTransform.h:38
FilterSizeL
const UINT32 FilterSizeL
number of coefficients of the low pass filter
Definition: WaveletTransform.h:37