|
libpgf
6.11.42
PGF - Progressive Graphics File
|
ROI and tile support. More...
#include <WaveletTransform.h>
Public Member Functions | |
| UINT32 | GetNofTiles (int level) const |
| const PGFRect & | GetROI (int level) const |
Private Member Functions | |
| CROIs (int levels) | |
| ~CROIs () | |
| void | Destroy () |
| void | CreateROIs () |
| void | CreateIndices () |
| void | ComputeIndices (UINT32 width, UINT32 height, const PGFRect &rect) |
| void | SetROI (int level, const PGFRect &rect) |
| const PGFRect & | GetIndices (int level) const |
| UINT32 | Left (int level) const |
| UINT32 | Top (int level) const |
| bool | ROIisSupported () const |
| void | ComputeTileIndex (UINT32 width, UINT32 height, UINT32 pos, bool horizontal, bool isMin) |
Private Attributes | |
| int | m_nLevels |
| number of levels of the image | |
| PGFRect * | m_ROIs |
| array of region of interests (ROI) | |
| PGFRect * | m_indices |
| array of tile indices | |
Friends | |
| class | CWaveletTransform |
ROI and tile support.
PGF ROI and tile support. This is a helper class for CWaveletTransform.
Definition at line 45 of file WaveletTransform.h.
| CROIs::CROIs | ( | int | levels | ) | [inline, private] |
Constructor: Creates a ROI helper object
| levels | The number of levels (>= 0) |
Definition at line 51 of file WaveletTransform.h.
| CROIs::~CROIs | ( | ) | [inline, private] |
| void CROIs::ComputeIndices | ( | UINT32 | width, |
| UINT32 | height, | ||
| const PGFRect & | rect | ||
| ) | [private] |
Compute tile indices for given rectangle (ROI)
| width | PGF image width |
| height | PGF image height |
| rect | ROI |
Definition at line 596 of file WaveletTransform.cpp.
{
ComputeTileIndex(width, height, rect.left, true, true);
ComputeTileIndex(width, height, rect.top, false, true);
ComputeTileIndex(width, height, rect.right, true, false);
ComputeTileIndex(width, height, rect.bottom, false, false);
}
| void CROIs::ComputeTileIndex | ( | UINT32 | width, |
| UINT32 | height, | ||
| UINT32 | pos, | ||
| bool | horizontal, | ||
| bool | isMin | ||
| ) | [private] |
Computes a tile index either in x- or y-direction for a given image position.
| width | PGF image width |
| height | PGF image height |
| pos | A valid image position: (0 <= pos < width) or (0 <= pos < height) |
| horizontal | If true, then pos must be a x-value, otherwise a y-value |
| isMin | If true, then pos is left/top, else pos right/bottom |
Definition at line 554 of file WaveletTransform.cpp.
{
ASSERT(m_indices);
UINT32 m;
UINT32 tileIndex = 0;
UINT32 tileMin = 0, tileMax = (horizontal) ? width : height;
ASSERT(pos <= tileMax);
// compute tile index with binary search
for (int i=m_nLevels - 1; i >= 0; i--) {
// store values
if (horizontal) {
if (isMin) {
m_indices[i].left = tileIndex;
} else {
m_indices[i].right = tileIndex + 1;
}
} else {
if (isMin) {
m_indices[i].top = tileIndex;
} else {
m_indices[i].bottom = tileIndex + 1;
}
}
// compute values
tileIndex <<= 1;
m = (tileMin + tileMax)/2;
if (pos >= m) {
tileMin = m;
tileIndex++;
} else {
tileMax = m;
}
}
}
| void CROIs::CreateIndices | ( | ) | [private] |
| void CROIs::CreateROIs | ( | ) | [private] |
| void CROIs::Destroy | ( | ) | [inline, private] |
| const PGFRect& CROIs::GetIndices | ( | int | level | ) | const [inline, private] |
Definition at line 62 of file WaveletTransform.h.
| UINT32 CROIs::GetNofTiles | ( | int | level | ) | const [inline] |
Returns the number of tiles at a given level.
| level | A wavelet transform pyramid level (>= 0 && < Levels()) |
Definition at line 72 of file WaveletTransform.h.
| const PGFRect& CROIs::GetROI | ( | int | level | ) | const [inline] |
Return region of interest at a given level.
| level | A wavelet transform pyramid level (>= 0 && < Levels()) |
Definition at line 77 of file WaveletTransform.h.
| UINT32 CROIs::Left | ( | int | level | ) | const [inline, private] |
| bool CROIs::ROIisSupported | ( | ) | const [inline, private] |
Definition at line 65 of file WaveletTransform.h.
{ return m_ROIs != 0; }
| void CROIs::SetROI | ( | int | level, |
| const PGFRect & | rect | ||
| ) | [inline, private] |
Definition at line 61 of file WaveletTransform.h.
| UINT32 CROIs::Top | ( | int | level | ) | const [inline, private] |
friend class CWaveletTransform [friend] |
Definition at line 46 of file WaveletTransform.h.
PGFRect* CROIs::m_indices [private] |
array of tile indices
Definition at line 82 of file WaveletTransform.h.
int CROIs::m_nLevels [private] |
number of levels of the image
Definition at line 80 of file WaveletTransform.h.
PGFRect* CROIs::m_ROIs [private] |
array of region of interests (ROI)
Definition at line 81 of file WaveletTransform.h.