00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028
00029 #ifndef PGF_SUBBAND_H
00030 #define PGF_SUBBAND_H
00031
00032 #include "PGFtypes.h"
00033
00034 class CEncoder;
00035 class CDecoder;
00036 class CRoiIndices;
00037
00042 class CSubband {
00043 friend class CWaveletTransform;
00044
00045 public:
00048 CSubband();
00049
00052 ~CSubband();
00053
00057 bool AllocMemory();
00058
00061 void FreeMemory();
00062
00071 void ExtractTile(CEncoder& encoder, bool tile = false, UINT32 tileX = 0, UINT32 tileY = 0) THROW_;
00072
00081 void PlaceTile(CDecoder& decoder, int quantParam, bool tile = false, UINT32 tileX = 0, UINT32 tileY = 0) THROW_;
00082
00088 void Quantize(int quantParam);
00089
00095 void Dequantize(int quantParam);
00096
00101 void SetData(UINT32 pos, DataT v) { ASSERT(pos < m_size); m_data[pos] = v; }
00102
00106 DataT* GetBuffer() { return m_data; }
00107
00112 DataT GetData(UINT32 pos) const { ASSERT(pos < m_size); return m_data[pos]; }
00113
00117 int GetLevel() const { return m_level; }
00118
00122 int GetHeight() const { return m_height; }
00123
00127 int GetWidth() const { return m_width; }
00128
00134 Orientation GetOrientation() const { return m_orientation; }
00135
00136 #ifdef __PGFROISUPPORT__
00140 void IncBuffRow(UINT32 pos) { m_dataPos = pos + BufferWidth(); }
00141
00142 #endif
00143
00144 private:
00145 void Initialize(UINT32 width, UINT32 height, int level, Orientation orient);
00146 void WriteBuffer(DataT val) { ASSERT(m_dataPos < m_size); m_data[m_dataPos++] = val; }
00147 void SetBuffer(DataT* b) { ASSERT(b); m_data = b; }
00148 DataT ReadBuffer() { ASSERT(m_dataPos < m_size); return m_data[m_dataPos++]; }
00149
00150 UINT32 GetBuffPos() const { return m_dataPos; }
00151
00152 #ifdef __PGFROISUPPORT__
00153 UINT32 BufferWidth() const { return m_ROI.Width(); }
00154 void TilePosition(UINT32 tileX, UINT32 tileY, UINT32& left, UINT32& top, UINT32& w, UINT32& h) const;
00155 const PGFRect& GetROI() const { return m_ROI; }
00156 void SetNTiles(UINT32 nTiles) { m_nTiles = nTiles; }
00157 void SetROI(const PGFRect& roi) { ASSERT(roi.right <= m_width); ASSERT(roi.bottom <= m_height); m_ROI = roi; }
00158 void InitBuffPos(UINT32 left = 0, UINT32 top = 0) { m_dataPos = top*BufferWidth() + left; ASSERT(m_dataPos < m_size); }
00159 #else
00160 void InitBuffPos() { m_dataPos = 0; }
00161 #endif
00162
00163 private:
00164 UINT32 m_width;
00165 UINT32 m_height;
00166 UINT32 m_size;
00167 int m_level;
00168 Orientation m_orientation;
00169 UINT32 m_dataPos;
00170 DataT* m_data;
00171
00172 #ifdef __PGFROISUPPORT__
00173 PGFRect m_ROI;
00174 UINT32 m_nTiles;
00175 #endif
00176 };
00177
00178 #endif //PGF_SUBBAND_H