39#define BufferLen (BufferSize/WordWidth)
40#define CodeBufferLen BufferSize
57#pragma warning( suppress : 4351 )
71 void Init(
int lastLevelIndex) {
93 UINT32
RLESigns(UINT32 codePos, UINT32* signBits, UINT32 signLen);
94 UINT32
DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32 codePos, UINT32* sigBits, UINT32* refBits, UINT32* signBits, UINT32& signLen, UINT32& codeLen);
96 bool GetBitAtPos(UINT32 pos, UINT32 planeMask)
const {
return (abs(
m_value[pos]) & planeMask) > 0; }
113 UINT64& userDataPos,
bool useOMP);
194#ifdef __PGFROISUPPORT__
202 void SetROI() { m_roi =
true; }
206 void DumpBuffer()
const;
228#ifdef __PGFROISUPPORT__
#define CodeBufferLen
number of words in code buffer (CodeBufferLen > BufferLen)
#define BufferSize
must be a multiple of WordWidth, BufferSize <= UINT16_MAX
PGF wavelet subband class.
A macro block is an encoding unit of fixed size (uncoded)
DataT m_value[BufferSize]
input buffer of values with index m_valuePos
UINT8 NumberOfBitplanes()
UINT32 DecomposeBitplane(UINT32 bufferSize, UINT32 planeMask, UINT32 codePos, UINT32 *sigBits, UINT32 *refBits, UINT32 *signBits, UINT32 &signLen, UINT32 &codeLen)
UINT32 RLESigns(UINT32 codePos, UINT32 *signBits, UINT32 signLen)
UINT32 m_codeBuffer[CodeBufferLen]
output buffer for encoded bitstream
int m_lastLevelIndex
index of last encoded level: [0, nLevels); used because a level-end can occur before a buffer is full
UINT32 m_codePos
current position in encoded bitstream
CMacroBlock(CEncoder *encoder)
UINT32 m_valuePos
current buffer position
bool m_sigFlagVector[BufferSize+1]
bool GetBitAtPos(UINT32 pos, UINT32 planeMask) const
UINT32 m_maxAbsValue
maximum absolute coefficient in each buffer
ROIBlockHeader m_header
block header
void Init(int lastLevelIndex)
void SetBufferStartPos()
Save current stream position as beginning of current level.
UINT64 m_bufferStartPos
stream position of encoded buffer
bool m_favorSpeed
favor speed over size
void Partition(CSubband *band, int width, int height, int startPos, int pitch)
UINT64 m_startPosition
stream position of PGF start (PreHeader)
INT64 ComputeBufferLength() const
void EncodeBuffer(ROIBlockHeader h)
bool m_forceWriting
all macro blocks have to be written into the stream
UINT64 m_levelLengthPos
stream position of Metadata
CMacroBlock * m_currentBlock
current macro block (used by main thread)
void WriteValue(CSubband *band, int bandPos)
INT64 ComputeHeaderLength() const
UINT32 * m_levelLength
temporary saves the level index
CMacroBlock ** m_macroBlocks
array of macroblocks
UINT8 m_nLevels
number of levels
int m_currLevelIndex
counts where (=index) to save next value
INT64 ComputeOffset() const
UINT32 UpdateLevelLength()
void FavorSpeedOverSize()
Encoder favors speed over compression size.
int m_lastMacroBlock
array index of the last created macro block
void WriteMacroBlock(CMacroBlock *block)
void SetEncodedLevel(int currentLevel)
CPGFStream * m_stream
output PMF stream
UINT32 WriteLevelLength(UINT32 *&levelLength)
void UpdatePostHeaderSize(PGFPreHeader preHeader)
void SetStreamPosToStart()
Resets stream position to beginning of PGF pre-header.
int m_macroBlockLen
array length
Abstract stream base class.
virtual void SetPos(short posMode, INT64 posOff)=0
virtual UINT64 GetPos() const =0