libpgf 7.26.45
PGF - Progressive Graphics File
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#pragma once
30
31#include "PGFtypes.h"
32#include "Subband.h"
33
34namespace pgf {
36 // Constants
37 constexpr uint32_t FilterSizeL = 5;
38 constexpr uint32_t FilterSizeH = 3;
39 constexpr uint32_t FilterSize = __max(FilterSizeL, FilterSizeH);
40
41#ifdef __PGFROISUPPORT__
46 class CRoiIndices {
47 };
48#endif //__PGFROISUPPORT__
49
50
56 friend class CSubband;
57
58 public:
65 CWaveletTransform(uint32_t width, uint32_t height, int levels, DataT* data = nullptr);
66
70
77 OSError ForwardTransform(int level, int quant);
78
87 OSError InverseTransform(int level, uint32_t* width, uint32_t* height, DataT** data);
88
93 CSubband* GetSubband(int level, Orient::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_t tileX, uint32_t tileY) const { ASSERT(m_indices); ASSERT(level >= 0 && level < m_nLevels); return m_indices[level].IsInside(tileX, tileY); }
110
115 uint32_t 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][Orient::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_t width, uint32_t height, DataT* data);
132 void ForwardRow(DataT* buff, uint32_t width);
133 void InverseRow(DataT* buff, uint32_t width);
134 void InterleavedToSubbands(int destLevel, DataT* loRow, DataT* hiRow, uint32_t width);
135 void SubbandsToInterleaved(int srcLevel, DataT* loRow, DataT* hiRow, uint32_t width);
136
137#ifdef __PGFROISUPPORT__
138 PGFRect* m_indices;
139#endif //__PGFROISUPPORT__
140
143 };
144}
#define __max(x, y)
PGF definitions.
PGF wavelet subband class.
CSubband()
Standard constructor.
Definition Subband.cpp:36
~CWaveletTransform()
Destructor.
void InterleavedToSubbands(int destLevel, DataT *loRow, DataT *hiRow, uint32_t width)
CSubband(* m_subband)[NSubbands]
quadtree of subbands: LL HL LH HH
void ForwardRow(DataT *buff, uint32_t width)
void InitSubbands(uint32_t width, uint32_t height, DataT *data)
CWaveletTransform(uint32_t width, uint32_t height, int levels, DataT *data=nullptr)
OSError ForwardTransform(int level, int quant)
OSError InverseTransform(int level, uint32_t *width, uint32_t *height, DataT **data)
void SubbandsToInterleaved(int srcLevel, DataT *loRow, DataT *hiRow, uint32_t width)
int m_nLevels
number of LL levels: one more than header.nLevels in PGFimage
CSubband * GetSubband(int level, Orient::Orientation orientation)
void InverseRow(DataT *buff, uint32_t width)
constexpr Orientation LL
Definition PGFtypes.h:104
uint8_t Orientation
Definition PGFtypes.h:102
Definition PGFimage.h:33
constexpr uint32_t FilterSizeH
number of coefficients of the high pass filter
constexpr uint32_t FilterSize
int32_t DataT
Definition PGFtypes.h:367
constexpr int NSubbands
number of subbands per level
Definition PGFtypes.h:63
constexpr uint32_t FilterSizeL
number of coefficients of the low pass filter
Rectangle.
Definition PGFtypes.h:258