libpgf  6.11.42
PGF - Progressive Graphics File
CROIs Class Reference

ROI and tile support. More...

#include <WaveletTransform.h>

List of all members.

Public Member Functions

UINT32 GetNofTiles (int level) const
const PGFRectGetROI (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 PGFRectGetIndices (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
PGFRectm_ROIs
 array of region of interests (ROI)
PGFRectm_indices
 array of tile indices

Friends

class CWaveletTransform

Detailed Description

ROI and tile support.

PGF ROI and tile support. This is a helper class for CWaveletTransform.

Author:
C. Stamm

Definition at line 45 of file WaveletTransform.h.


Constructor & Destructor Documentation

CROIs::CROIs ( int  levels) [inline, private]

Constructor: Creates a ROI helper object

Parameters:
levelsThe number of levels (>= 0)

Definition at line 51 of file WaveletTransform.h.

: m_nLevels(levels), m_ROIs(0), m_indices(0) { ASSERT(levels > 0); }
CROIs::~CROIs ( ) [inline, private]

Destructor

Definition at line 55 of file WaveletTransform.h.

{ Destroy(); }

Member Function Documentation

void CROIs::ComputeIndices ( UINT32  width,
UINT32  height,
const PGFRect rect 
) [private]

Compute tile indices for given rectangle (ROI)

Parameters:
widthPGF image width
heightPGF image height
rectROI

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.

Parameters:
widthPGF image width
heightPGF image height
posA valid image position: (0 <= pos < width) or (0 <= pos < height)
horizontalIf true, then pos must be a x-value, otherwise a y-value
isMinIf 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]

Definition at line 540 of file WaveletTransform.cpp.

                          {
        if (!m_indices) {
                // create tile indices 
                m_indices = new PGFRect[m_nLevels];
        }
}
void CROIs::CreateROIs ( ) [private]

Definition at line 532 of file WaveletTransform.cpp.

                       {
        if (!m_ROIs) {
                // create ROIs 
                m_ROIs = new PGFRect[m_nLevels];
        }
}
void CROIs::Destroy ( ) [inline, private]

Definition at line 57 of file WaveletTransform.h.

{ delete[] m_ROIs; m_ROIs = 0; delete[] m_indices; m_indices = 0; }
const PGFRect& CROIs::GetIndices ( int  level) const [inline, private]

Definition at line 62 of file WaveletTransform.h.

{ ASSERT(m_indices); ASSERT(level >= 0 && level < m_nLevels); return m_indices[level]; }
UINT32 CROIs::GetNofTiles ( int  level) const [inline]

Returns the number of tiles at a given level.

Parameters:
levelA wavelet transform pyramid level (>= 0 && < Levels())

Definition at line 72 of file WaveletTransform.h.

{ ASSERT(level >= 0 && level < m_nLevels); return 1 << (m_nLevels - level - 1); }
const PGFRect& CROIs::GetROI ( int  level) const [inline]

Return region of interest at a given level.

Parameters:
levelA wavelet transform pyramid level (>= 0 && < Levels())

Definition at line 77 of file WaveletTransform.h.

{ ASSERT(m_ROIs); ASSERT(level >= 0 && level < m_nLevels); return m_ROIs[level]; }
UINT32 CROIs::Left ( int  level) const [inline, private]

Definition at line 63 of file WaveletTransform.h.

{ ASSERT(m_ROIs); ASSERT(level >= 0 && level < m_nLevels); return m_ROIs[level].left; }
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.

{ ASSERT(m_ROIs); ASSERT(level >= 0 && level < m_nLevels); m_ROIs[level] = rect; }
UINT32 CROIs::Top ( int  level) const [inline, private]

Definition at line 64 of file WaveletTransform.h.

{ ASSERT(m_ROIs); ASSERT(level >= 0 && level < m_nLevels); return m_ROIs[level].top; }

Friends And Related Function Documentation

friend class CWaveletTransform [friend]

Definition at line 46 of file WaveletTransform.h.


Member Data Documentation

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.


The documentation for this class was generated from the following files: