libpgf
6.14.12
PGF - Progressive Graphics File
Toggle main menu visibility
Loading...
Searching...
No Matches
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__
45
class
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
66
public
:
70
UINT32 GetNofTiles(
int
level)
const
{ ASSERT(level >= 0 && level < m_nLevels);
return
1 << (m_nLevels - level - 1); }
71
72
private
:
73
int
m_nLevels;
74
PGFRect
*m_indices;
75
76
};
77
#endif
//__PGFROISUPPORT__
78
79
84
class
CWaveletTransform
{
85
friend
class
CSubband
;
86
87
public
:
94
CWaveletTransform
(UINT32 width, UINT32 height,
int
levels,
DataT
* data = NULL);
95
98
~CWaveletTransform
() {
Destroy
(); }
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
150
private
:
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
167
int
m_nLevels
;
168
CSubband
(*
m_subband
)[
NSubbands
];
169
};
170
171
#endif
//PGF_WAVELETTRANSFORM_H
PGFtypes.h
PGF definitions.
NSubbands
#define NSubbands
number of subbands per level
Definition
PGFtypes.h:57
Orientation
Orientation
Definition
PGFtypes.h:92
LL
@ LL
Definition
PGFtypes.h:92
DataT
INT32 DataT
Definition
PGFtypes.h:219
Subband.h
PGF wavelet subband class.
CSubband::CSubband
CSubband()
Standard constructor.
Definition
Subband.cpp:35
CWaveletTransform
PGF wavelet transform.
Definition
WaveletTransform.h:84
CWaveletTransform::m_subband
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
Definition
WaveletTransform.h:168
CWaveletTransform::InverseRow
void InverseRow(DataT *buff, UINT32 width)
Definition
WaveletTransform.cpp:418
CWaveletTransform::~CWaveletTransform
~CWaveletTransform()
Destructor.
Definition
WaveletTransform.h:98
CWaveletTransform::CWaveletTransform
CWaveletTransform(UINT32 width, UINT32 height, int levels, DataT *data=NULL)
Definition
WaveletTransform.cpp:40
CWaveletTransform::InverseTransform
OSError InverseTransform(int level, UINT32 *width, UINT32 *height, DataT **data)
Definition
WaveletTransform.cpp:245
CWaveletTransform::MallatToLinear
void MallatToLinear(int srcLevel, DataT *loRow, DataT *hiRow, UINT32 width)
Definition
WaveletTransform.cpp:443
CWaveletTransform::InitSubbands
void InitSubbands(UINT32 width, UINT32 height, DataT *data)
Definition
WaveletTransform.cpp:53
CWaveletTransform::GetSubband
CSubband * GetSubband(int level, Orientation orientation)
Definition
WaveletTransform.h:122
CWaveletTransform::ForwardTransform
OSError ForwardTransform(int level, int quant)
Definition
WaveletTransform.cpp:88
CWaveletTransform::Destroy
void Destroy()
Definition
WaveletTransform.h:151
CWaveletTransform::ForwardRow
void ForwardRow(DataT *buff, UINT32 width)
Definition
WaveletTransform.cpp:181
CWaveletTransform::LinearToMallat
void LinearToMallat(int destLevel, DataT *loRow, DataT *hiRow, UINT32 width)
Definition
WaveletTransform.cpp:207
CWaveletTransform::CSubband
friend class CSubband
Definition
WaveletTransform.h:85
CWaveletTransform::m_nLevels
int m_nLevels
number of transform levels: one more than the number of level in PGFimage
Definition
WaveletTransform.h:167
PGFRect
Rectangle.
Definition
PGFtypes.h:194
src
WaveletTransform.h
Generated on
for libpgf by
1.18.0