libpgf  6.12.24
PGF - Progressive Graphics File
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CEncoder Class Reference

PGF encoder. More...

#include <Encoder.h>

Classes

class  CMacroBlock
 A macro block is an encoding unit of fixed size (uncoded) More...
 

Public Member Functions

 CEncoder (CPGFStream *stream, PGFPreHeader preHeader, PGFHeader header, const PGFPostHeader &postHeader, UINT64 &userDataPos, bool useOMP) THROW_
 
 ~CEncoder ()
 Destructor. More...
 
void FavorSpeedOverSize ()
 Encoder favors speed over compression size. More...
 
void Flush () THROW_
 
void UpdatePostHeaderSize (PGFPreHeader preHeader) THROW_
 
UINT32 WriteLevelLength (UINT32 *&levelLength) THROW_
 
UINT32 UpdateLevelLength () THROW_
 
void Partition (CSubband *band, int width, int height, int startPos, int pitch) THROW_
 
void SetEncodedLevel (int currentLevel)
 
void WriteValue (CSubband *band, int bandPos) THROW_
 
INT64 ComputeHeaderLength () const
 
INT64 ComputeBufferLength () const
 
INT64 ComputeOffset () const
 
void SetBufferStartPos ()
 Save current stream position as beginning of current level. More...
 

Private Member Functions

void EncodeBuffer (ROIBlockHeader h) THROW_
 
void WriteMacroBlock (CMacroBlock *block) THROW_
 

Private Attributes

CPGFStreamm_stream
 output PMF stream More...
 
UINT64 m_startPosition
 stream position of PGF start (PreHeader) More...
 
UINT64 m_levelLengthPos
 stream position of Metadata More...
 
UINT64 m_bufferStartPos
 stream position of encoded buffer More...
 
CMacroBlock ** m_macroBlocks
 array of macroblocks More...
 
int m_macroBlockLen
 array length More...
 
int m_lastMacroBlock
 array index of the last created macro block More...
 
CMacroBlockm_currentBlock
 current macro block (used by main thread) More...
 
UINT32 * m_levelLength
 temporary saves the level index More...
 
int m_currLevelIndex
 counts where (=index) to save next value More...
 
UINT8 m_nLevels
 number of levels More...
 
bool m_favorSpeed
 favor speed over size More...
 
bool m_forceWriting
 all macro blocks have to be written into the stream More...
 

Detailed Description

PGF encoder.

PGF encoder class.

Author
C. Stamm

Definition at line 46 of file Encoder.h.

Constructor & Destructor Documentation

CEncoder::CEncoder ( CPGFStream stream,
PGFPreHeader  preHeader,
PGFHeader  header,
const PGFPostHeader postHeader,
UINT64 &  userDataPos,
bool  useOMP 
)

Write pre-header, header, post-Header, and levelLength. It might throw an IOException.

Parameters
streamA PGF stream
preHeaderA already filled in PGF pre-header
headerAn already filled in PGF header
postHeader[in] An already filled in PGF post-header (containing color table, user data, ...)
userDataPos[out] File position of user data
useOMPIf true, then the encoder will use multi-threading based on openMP

Write pre-header, header, postHeader, and levelLength. It might throw an IOException.

Parameters
streamA PGF stream
preHeaderA already filled in PGF pre-header
headerAn already filled in PGF header
postHeader[in] An already filled in PGF post-header (containing color table, user data, ...)
userDataPos[out] File position of user data
useOMPIf true, then the encoder will use multi-threading based on openMP

Definition at line 70 of file Encoder.cpp.

71 : m_stream(stream)
74 , m_nLevels(header.nLevels)
75 , m_favorSpeed(false)
76 , m_forceWriting(false)
77 #ifdef __PGFROISUPPORT__
78 , m_roi(false)
79 #endif
80 {
81  ASSERT(m_stream);
82 
83  int count;
84 
85  // set number of threads
86 #ifdef LIBPGF_USE_OPENMP
87  m_macroBlockLen = omp_get_num_procs();
88 #else
89  m_macroBlockLen = 1;
90 #endif
91 
92  if (useOMP && m_macroBlockLen > 1) {
93 #ifdef LIBPGF_USE_OPENMP
94  omp_set_num_threads(m_macroBlockLen);
95 #endif
96  // create macro block array
97  m_macroBlocks = new(std::nothrow) CMacroBlock*[m_macroBlockLen];
98  if (!m_macroBlocks) ReturnWithError(InsufficientMemory);
99  for (int i=0; i < m_macroBlockLen; i++) m_macroBlocks[i] = new CMacroBlock(this);
100  m_lastMacroBlock = 0;
102  } else {
103  m_macroBlocks = 0;
104  m_macroBlockLen = 1;
105  m_currentBlock = new CMacroBlock(this);
106  }
107 
108  // save file position
110 
111  // write preHeader
112  preHeader.hSize = __VAL(preHeader.hSize);
113  count = PreHeaderSize;
114  m_stream->Write(&count, &preHeader);
115 
116  // write file header
117  header.height = __VAL(header.height);
118  header.width = __VAL(header.width);
119  count = HeaderSize;
120  m_stream->Write(&count, &header);
121 
122  // write postHeader
123  if (header.mode == ImageModeIndexedColor) {
124  // write color table
125  count = ColorTableSize;
126  m_stream->Write(&count, (void *)postHeader.clut);
127  }
128  // save user data file position
129  userDataPos = m_stream->GetPos();
130  if (postHeader.userDataLen) {
131  if (postHeader.userData) {
132  // write user data
133  count = postHeader.userDataLen;
134  m_stream->Write(&count, postHeader.userData);
135  } else {
136  m_stream->SetPos(FSFromCurrent, count);
137  }
138  }
139 
140  // save level length file position
142 }
#define ImageModeIndexedColor
Definition: PGFplatform.h:100
UINT8 mode
image mode according to Adobe&#39;s image modes
Definition: PGFtypes.h:131
int m_macroBlockLen
array length
Definition: Encoder.h:211
virtual void Write(int *count, void *buffer)=0
UINT32 width
image width in pixels
Definition: PGFtypes.h:125
#define ColorTableSize
Definition: PGFtypes.h:232
#define __VAL(x)
Definition: PGFplatform.h:604
UINT32 userDataLen
user data size in bytes
Definition: PGFtypes.h:144
UINT8 * userData
user data of size userDataLen
Definition: PGFtypes.h:143
#define HeaderSize
Definition: PGFtypes.h:231
virtual void SetPos(short posMode, INT64 posOff)=0
UINT8 nLevels
number of DWT levels
Definition: PGFtypes.h:127
#define PreHeaderSize
Definition: PGFtypes.h:230
bool m_forceWriting
all macro blocks have to be written into the stream
Definition: Encoder.h:219
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
UINT32 hSize
total size of PGFHeader, [ColorTable], and [UserData] in bytes
Definition: PGFtypes.h:115
CMacroBlock ** m_macroBlocks
array of macroblocks
Definition: Encoder.h:210
UINT64 m_startPosition
stream position of PGF start (PreHeader)
Definition: Encoder.h:206
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_bufferStartPos
stream position of encoded buffer
Definition: Encoder.h:208
UINT64 m_levelLengthPos
stream position of Metadata
Definition: Encoder.h:207
bool m_favorSpeed
favor speed over size
Definition: Encoder.h:218
int m_currLevelIndex
counts where (=index) to save next value
Definition: Encoder.h:216
int m_lastMacroBlock
array index of the last created macro block
Definition: Encoder.h:212
UINT8 m_nLevels
number of levels
Definition: Encoder.h:217
UINT32 height
image height in pixels
Definition: PGFtypes.h:126
RGBQUAD clut[ColorTableLen]
color table for indexed color images
Definition: PGFtypes.h:142
CEncoder::~CEncoder ( )

Destructor.

Definition at line 146 of file Encoder.cpp.

146  {
147  delete m_currentBlock;
148  delete[] m_macroBlocks;
149 }
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
CMacroBlock ** m_macroBlocks
array of macroblocks
Definition: Encoder.h:210

Member Function Documentation

INT64 CEncoder::ComputeBufferLength ( ) const
inline

Compute stream length of encoded buffer.

Returns
encoded buffer length

Definition at line 175 of file Encoder.h.

175 { return m_stream->GetPos() - m_bufferStartPos; }
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_bufferStartPos
stream position of encoded buffer
Definition: Encoder.h:208
INT64 CEncoder::ComputeHeaderLength ( ) const
inline

Compute stream length of header.

Returns
header length

Definition at line 170 of file Encoder.h.

170 { return m_levelLengthPos - m_startPosition; }
UINT64 m_startPosition
stream position of PGF start (PreHeader)
Definition: Encoder.h:206
UINT64 m_levelLengthPos
stream position of Metadata
Definition: Encoder.h:207
INT64 CEncoder::ComputeOffset ( ) const
inline

Compute file offset between real and expected levelLength position.

Returns
file offset

Definition at line 180 of file Encoder.h.

180 { return m_stream->GetPos() - m_levelLengthPos; }
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_levelLengthPos
stream position of Metadata
Definition: Encoder.h:207
void CEncoder::EncodeBuffer ( ROIBlockHeader  h)
private

Definition at line 336 of file Encoder.cpp.

336  {
337  ASSERT(m_currentBlock);
338 #ifdef __PGFROISUPPORT__
339  ASSERT(m_roi && h.rbh.bufferSize <= BufferSize || h.rbh.bufferSize == BufferSize);
340 #else
341  ASSERT(h.rbh.bufferSize == BufferSize);
342 #endif
344 
345  // macro block management
346  if (m_macroBlockLen == 1) {
349  } else {
350  // save last level index
351  int lastLevelIndex = m_currentBlock->m_lastLevelIndex;
352 
354  // encode macro blocks
355  /*
356  volatile OSError error = NoError;
357  #pragma omp parallel for ordered default(shared)
358  for (int i=0; i < m_lastMacroBlock; i++) {
359  if (error == NoError) {
360  m_macroBlocks[i]->BitplaneEncode();
361  #pragma omp ordered
362  {
363  try {
364  WriteMacroBlock(m_macroBlocks[i]);
365  } catch (IOException& e) {
366  error = e.error;
367  }
368  delete m_macroBlocks[i]; m_macroBlocks[i] = 0;
369  }
370  }
371  }
372  if (error != NoError) ReturnWithError(error);
373  */
374  #pragma omp parallel for default(shared) //no declared exceptions in next block
375  for (int i=0; i < m_lastMacroBlock; i++) {
377  }
378  for (int i=0; i < m_lastMacroBlock; i++) {
380  }
381 
382  // prepare for next round
383  m_forceWriting = false;
384  m_lastMacroBlock = 0;
385  }
386  // re-initialize macro block
387  m_currentBlock = m_macroBlocks[m_lastMacroBlock++];
388  m_currentBlock->Init(lastLevelIndex);
389  }
390 }
struct ROIBlockHeader::RBH rbh
ROI block header.
UINT16 bufferSize
number of uncoded UINT32 values in a block
Definition: PGFtypes.h:167
int m_macroBlockLen
array length
Definition: Encoder.h:211
void WriteMacroBlock(CMacroBlock *block) THROW_
Definition: Encoder.cpp:395
int m_lastLevelIndex
index of last encoded level: [0, nLevels); used because a level-end can occur before a buffer is full...
Definition: Encoder.h:86
#define BufferSize
must be a multiple of WordWidth
Definition: PGFtypes.h:77
bool m_forceWriting
all macro blocks have to be written into the stream
Definition: Encoder.h:219
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
CMacroBlock ** m_macroBlocks
array of macroblocks
Definition: Encoder.h:210
ROIBlockHeader m_header
block header
Definition: Encoder.h:82
int m_lastMacroBlock
array index of the last created macro block
Definition: Encoder.h:212
void Init(int lastLevelIndex)
Definition: Encoder.h:67
void CEncoder::FavorSpeedOverSize ( )
inline

Encoder favors speed over compression size.

Definition at line 117 of file Encoder.h.

117 { m_favorSpeed = true; }
bool m_favorSpeed
favor speed over size
Definition: Encoder.h:218
void CEncoder::Flush ( )

Pad buffer with zeros and encode buffer. It might throw an IOException.

Definition at line 305 of file Encoder.cpp.

305  {
306  if (m_currentBlock->m_valuePos > 0) {
307  // pad buffer with zeros
310 
311  // encode buffer
312  m_forceWriting = true; // makes sure that the following EncodeBuffer is really written into the stream
314  }
315 }
UINT32 m_valuePos
current buffer position
Definition: Encoder.h:83
#define BufferSize
must be a multiple of WordWidth
Definition: PGFtypes.h:77
#define DataTSize
Definition: PGFtypes.h:233
void EncodeBuffer(ROIBlockHeader h) THROW_
Definition: Encoder.cpp:336
Block header used with ROI coding scheme.
Definition: PGFtypes.h:151
bool m_forceWriting
all macro blocks have to be written into the stream
Definition: Encoder.h:219
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
DataT m_value[BufferSize]
input buffer of values with index m_valuePos
Definition: Encoder.h:80
void CEncoder::Partition ( CSubband band,
int  width,
int  height,
int  startPos,
int  pitch 
)

Partitions a rectangular region of a given subband. Partitioning scheme: The plane is partitioned in squares of side length LinBlockSize. Write wavelet coefficients from subband into the input buffer of a macro block. It might throw an IOException.

Parameters
bandA subband
widthThe width of the rectangle
heightThe height of the rectangle
startPosThe absolute subband position of the top left corner of the rectangular region
pitchThe number of bytes in row of the subband

Definition at line 241 of file Encoder.cpp.

241  {
242  ASSERT(band);
243 
244  const div_t hh = div(height, LinBlockSize);
245  const div_t ww = div(width, LinBlockSize);
246  const int ws = pitch - LinBlockSize;
247  const int wr = pitch - ww.rem;
248  int pos, base = startPos, base2;
249 
250  // main height
251  for (int i=0; i < hh.quot; i++) {
252  // main width
253  base2 = base;
254  for (int j=0; j < ww.quot; j++) {
255  pos = base2;
256  for (int y=0; y < LinBlockSize; y++) {
257  for (int x=0; x < LinBlockSize; x++) {
258  WriteValue(band, pos);
259  pos++;
260  }
261  pos += ws;
262  }
263  base2 += LinBlockSize;
264  }
265  // rest of width
266  pos = base2;
267  for (int y=0; y < LinBlockSize; y++) {
268  for (int x=0; x < ww.rem; x++) {
269  WriteValue(band, pos);
270  pos++;
271  }
272  pos += wr;
273  base += pitch;
274  }
275  }
276  // main width
277  base2 = base;
278  for (int j=0; j < ww.quot; j++) {
279  // rest of height
280  pos = base2;
281  for (int y=0; y < hh.rem; y++) {
282  for (int x=0; x < LinBlockSize; x++) {
283  WriteValue(band, pos);
284  pos++;
285  }
286  pos += ws;
287  }
288  base2 += LinBlockSize;
289  }
290  // rest of height
291  pos = base2;
292  for (int y=0; y < hh.rem; y++) {
293  // rest of width
294  for (int x=0; x < ww.rem; x++) {
295  WriteValue(band, pos);
296  pos++;
297  }
298  pos += wr;
299  }
300 }
#define LinBlockSize
side length of a coefficient block in a HH or LL subband
Definition: PGFtypes.h:79
void WriteValue(CSubband *band, int bandPos) THROW_
Definition: Encoder.cpp:321
void CEncoder::SetBufferStartPos ( )
inline

Save current stream position as beginning of current level.

Definition at line 184 of file Encoder.h.

virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_bufferStartPos
stream position of encoded buffer
Definition: Encoder.h:208
void CEncoder::SetEncodedLevel ( int  currentLevel)
inline

Informs the encoder about the encoded level.

Parameters
currentLevelencoded level [0, nLevels)

Definition at line 158 of file Encoder.h.

158 { ASSERT(currentLevel >= 0); m_currentBlock->m_lastLevelIndex = m_nLevels - currentLevel - 1; m_forceWriting = true; }
int m_lastLevelIndex
index of last encoded level: [0, nLevels); used because a level-end can occur before a buffer is full...
Definition: Encoder.h:86
bool m_forceWriting
all macro blocks have to be written into the stream
Definition: Encoder.h:219
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
UINT8 m_nLevels
number of levels
Definition: Encoder.h:217
UINT32 CEncoder::UpdateLevelLength ( )

Write new levelLength into stream. It might throw an IOException.

Returns
Written image bytes.

Definition at line 197 of file Encoder.cpp.

197  {
198  UINT64 curPos = m_stream->GetPos(); // end of image
199 
200  // set file pos to levelLength
201  m_stream->SetPos(FSFromStart, m_levelLengthPos);
202 
203  if (m_levelLength) {
204  #ifdef PGF_USE_BIG_ENDIAN
205  UINT32 levelLength;
206  int count = WordBytes;
207 
208  for (int i=0; i < m_currLevelIndex; i++) {
209  levelLength = __VAL(UINT32(m_levelLength[i]));
210  m_stream->Write(&count, &levelLength);
211  }
212  #else
213  int count = m_currLevelIndex*WordBytes;
214 
215  m_stream->Write(&count, m_levelLength);
216  #endif //PGF_USE_BIG_ENDIAN
217  } else {
218  int count = m_currLevelIndex*WordBytes;
219  m_stream->SetPos(FSFromCurrent, count);
220  }
221 
222  // begin of image
223  UINT32 retValue = UINT32(curPos - m_stream->GetPos());
224 
225  // restore file position
226  m_stream->SetPos(FSFromStart, curPos);
227 
228  return retValue;
229 }
virtual void Write(int *count, void *buffer)=0
#define __VAL(x)
Definition: PGFplatform.h:604
virtual void SetPos(short posMode, INT64 posOff)=0
UINT32 * m_levelLength
temporary saves the level index
Definition: Encoder.h:215
#define WordBytes
sizeof(UINT32)
Definition: PGFplatform.h:76
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_levelLengthPos
stream position of Metadata
Definition: Encoder.h:207
int m_currLevelIndex
counts where (=index) to save next value
Definition: Encoder.h:216
void CEncoder::UpdatePostHeaderSize ( PGFPreHeader  preHeader)

Increase post-header size and write new size into stream.

Parameters
preHeaderAn already filled in PGF pre-header It might throw an IOException.

Definition at line 155 of file Encoder.cpp.

155  {
156  UINT64 curPos = m_stream->GetPos(); // end of user data
157  int count = PreHeaderSize;
158 
159  // write preHeader
160  m_stream->SetPos(FSFromStart, m_startPosition);
161  preHeader.hSize = __VAL(preHeader.hSize);
162  m_stream->Write(&count, &preHeader);
163 
164  m_stream->SetPos(FSFromStart, curPos);
165 }
virtual void Write(int *count, void *buffer)=0
#define __VAL(x)
Definition: PGFplatform.h:604
virtual void SetPos(short posMode, INT64 posOff)=0
#define PreHeaderSize
Definition: PGFtypes.h:230
UINT32 hSize
total size of PGFHeader, [ColorTable], and [UserData] in bytes
Definition: PGFtypes.h:115
UINT64 m_startPosition
stream position of PGF start (PreHeader)
Definition: Encoder.h:206
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT32 CEncoder::WriteLevelLength ( UINT32 *&  levelLength)

Create level length data structure and write a place holder into stream. It might throw an IOException.

Parameters
levelLengthA reference to an integer array, large enough to save the relative file positions of all PGF levels
Returns
number of bytes written into stream

Definition at line 172 of file Encoder.cpp.

172  {
173  // renew levelLength
174  delete[] levelLength;
175  levelLength = new(std::nothrow) UINT32[m_nLevels];
176  if (!levelLength) ReturnWithError(InsufficientMemory);
177  for (UINT8 l = 0; l < m_nLevels; l++) levelLength[l] = 0;
178  m_levelLength = levelLength;
179 
180  // save level length file position
182 
183  // write dummy levelLength
184  int count = m_nLevels*WordBytes;
185  m_stream->Write(&count, m_levelLength);
186 
187  // save current file position
189 
190  return count;
191 }
void SetBufferStartPos()
Save current stream position as beginning of current level.
Definition: Encoder.h:184
virtual void Write(int *count, void *buffer)=0
UINT32 * m_levelLength
temporary saves the level index
Definition: Encoder.h:215
#define WordBytes
sizeof(UINT32)
Definition: PGFplatform.h:76
virtual UINT64 GetPos() const =0
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT64 m_levelLengthPos
stream position of Metadata
Definition: Encoder.h:207
UINT8 m_nLevels
number of levels
Definition: Encoder.h:217
void CEncoder::WriteMacroBlock ( CMacroBlock block)
private

Definition at line 395 of file Encoder.cpp.

395  {
396  ASSERT(block);
397 
398  ROIBlockHeader h = block->m_header;
399  UINT16 wordLen = UINT16(NumberOfWords(block->m_codePos)); ASSERT(wordLen <= CodeBufferLen);
400  int count = sizeof(UINT16);
401 
402 #ifdef TRACE
403  //UINT32 filePos = (UINT32)m_stream->GetPos();
404  //printf("EncodeBuffer: %d\n", filePos);
405 #endif
406 
407 #ifdef PGF_USE_BIG_ENDIAN
408  // write wordLen
409  UINT16 wl = __VAL(wordLen);
410  m_stream->Write(&count, &wl); ASSERT(count == sizeof(UINT16));
411 
412 #ifdef __PGFROISUPPORT__
413  // write ROIBlockHeader
414  if (m_roi) {
415  h.val = __VAL(h.val);
416  m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
417  }
418 #endif // __PGFROISUPPORT__
419 
420  // convert data
421  for (int i=0; i < wordLen; i++) {
422  block->m_codeBuffer[i] = __VAL(block->m_codeBuffer[i]);
423  }
424 #else
425  // write wordLen
426  m_stream->Write(&count, &wordLen); ASSERT(count == sizeof(UINT16));
427 
428 #ifdef __PGFROISUPPORT__
429  // write ROIBlockHeader
430  if (m_roi) {
431  m_stream->Write(&count, &h.val); ASSERT(count == sizeof(UINT16));
432  }
433 #endif // __PGFROISUPPORT__
434 #endif // PGF_USE_BIG_ENDIAN
435 
436  // write encoded data into stream
437  count = wordLen*WordBytes;
438  m_stream->Write(&count, block->m_codeBuffer);
439 
440  // store levelLength
441  if (m_levelLength) {
442  // store level length
443  // EncodeBuffer has been called after m_lastLevelIndex has been updated
444  ASSERT(m_currLevelIndex < m_nLevels);
446  m_currLevelIndex = block->m_lastLevelIndex + 1;
447 
448  }
449 
450  // prepare for next buffer
452 
453  // reset values
454  block->m_valuePos = 0;
455  block->m_maxAbsValue = 0;
456 }
void SetBufferStartPos()
Save current stream position as beginning of current level.
Definition: Encoder.h:184
virtual void Write(int *count, void *buffer)=0
#define __VAL(x)
Definition: PGFplatform.h:604
UINT32 * m_levelLength
temporary saves the level index
Definition: Encoder.h:215
Block header used with ROI coding scheme.
Definition: PGFtypes.h:151
#define WordBytes
sizeof(UINT32)
Definition: PGFplatform.h:76
INT64 ComputeBufferLength() const
Definition: Encoder.h:175
CPGFStream * m_stream
output PMF stream
Definition: Encoder.h:205
UINT16 val
Definition: PGFtypes.h:160
UINT32 NumberOfWords(UINT32 pos)
Definition: BitStream.h:269
int m_currLevelIndex
counts where (=index) to save next value
Definition: Encoder.h:216
UINT8 m_nLevels
number of levels
Definition: Encoder.h:217
#define CodeBufferLen
number of words in code buffer (CodeBufferLen &gt; BufferLen)
Definition: Decoder.h:40
void CEncoder::WriteValue ( CSubband band,
int  bandPos 
)

Write a single value into subband at given position. It might throw an IOException.

Parameters
bandA subband
bandPosA valid position in subband band

Definition at line 321 of file Encoder.cpp.

321  {
324  }
325  DataT val = m_currentBlock->m_value[m_currentBlock->m_valuePos++] = band->GetData(bandPos);
326  UINT32 v = abs(val);
328 }
UINT32 m_valuePos
current buffer position
Definition: Encoder.h:83
INT32 DataT
Definition: PGFtypes.h:219
#define BufferSize
must be a multiple of WordWidth
Definition: PGFtypes.h:77
UINT32 m_maxAbsValue
maximum absolute coefficient in each buffer
Definition: Encoder.h:84
void EncodeBuffer(ROIBlockHeader h) THROW_
Definition: Encoder.cpp:336
Block header used with ROI coding scheme.
Definition: PGFtypes.h:151
CMacroBlock * m_currentBlock
current macro block (used by main thread)
Definition: Encoder.h:213
DataT GetData(UINT32 pos) const
Definition: Subband.h:112
DataT m_value[BufferSize]
input buffer of values with index m_valuePos
Definition: Encoder.h:80

Member Data Documentation

UINT64 CEncoder::m_bufferStartPos
private

stream position of encoded buffer

Definition at line 208 of file Encoder.h.

CMacroBlock* CEncoder::m_currentBlock
private

current macro block (used by main thread)

Definition at line 213 of file Encoder.h.

int CEncoder::m_currLevelIndex
private

counts where (=index) to save next value

Definition at line 216 of file Encoder.h.

bool CEncoder::m_favorSpeed
private

favor speed over size

Definition at line 218 of file Encoder.h.

bool CEncoder::m_forceWriting
private

all macro blocks have to be written into the stream

Definition at line 219 of file Encoder.h.

int CEncoder::m_lastMacroBlock
private

array index of the last created macro block

Definition at line 212 of file Encoder.h.

UINT32* CEncoder::m_levelLength
private

temporary saves the level index

Definition at line 215 of file Encoder.h.

UINT64 CEncoder::m_levelLengthPos
private

stream position of Metadata

Definition at line 207 of file Encoder.h.

int CEncoder::m_macroBlockLen
private

array length

Definition at line 211 of file Encoder.h.

CMacroBlock** CEncoder::m_macroBlocks
private

array of macroblocks

Definition at line 210 of file Encoder.h.

UINT8 CEncoder::m_nLevels
private

number of levels

Definition at line 217 of file Encoder.h.

UINT64 CEncoder::m_startPosition
private

stream position of PGF start (PreHeader)

Definition at line 206 of file Encoder.h.

CPGFStream* CEncoder::m_stream
private

output PMF stream

Definition at line 205 of file Encoder.h.


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