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