libpgf
7.15.32
PGF - Progressive Graphics File
|
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) | |
~CEncoder () | |
Destructor. More... | |
void | FavorSpeedOverSize () |
Encoder favors speed over compression size. More... | |
void | Flush () |
void | UpdatePostHeaderSize (PGFPreHeader preHeader) |
UINT32 | WriteLevelLength (UINT32 *&levelLength) |
UINT32 | UpdateLevelLength () |
void | Partition (CSubband *band, int width, int height, int startPos, int pitch) |
void | SetEncodedLevel (int currentLevel) |
void | WriteValue (CSubband *band, int bandPos) |
INT64 | ComputeHeaderLength () const |
INT64 | ComputeBufferLength () const |
INT64 | ComputeOffset () const |
void | SetStreamPosToStart () |
Resets stream position to beginning of PGF pre-header. More... | |
void | SetBufferStartPos () |
Save current stream position as beginning of current level. More... | |
Private Member Functions | |
void | EncodeBuffer (ROIBlockHeader h) |
void | WriteMacroBlock (CMacroBlock *block) |
Private Attributes | |
CPGFStream * | m_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... | |
CMacroBlock * | m_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... | |
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.
stream | A PGF stream |
preHeader | A already filled in PGF pre-header |
header | An 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 |
useOMP | If true, then the encoder will use multi-threading based on openMP |
Write pre-header, header, postHeader, and levelLength. It might throw an IOException.
stream | A PGF stream |
preHeader | A already filled in PGF pre-header |
header | An 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 |
useOMP | If true, then the encoder will use multi-threading based on openMP |
Definition at line 70 of file Encoder.cpp.
CEncoder::~CEncoder | ( | ) |
Destructor.
Definition at line 147 of file Encoder.cpp.
|
inline |
Compute stream length of encoded buffer.
Definition at line 179 of file Encoder.h.
|
inline |
Compute stream length of header.
Definition at line 174 of file Encoder.h.
|
inline |
Compute file offset between real and expected levelLength position.
Definition at line 184 of file Encoder.h.
|
private |
Definition at line 341 of file Encoder.cpp.
|
inline |
void CEncoder::Flush | ( | ) |
Pad buffer with zeros and encode buffer. It might throw an IOException.
Definition at line 310 of file Encoder.cpp.
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.
band | A subband |
width | The width of the rectangle |
height | The height of the rectangle |
startPos | The absolute subband position of the top left corner of the rectangular region |
pitch | The number of bytes in row of the subband |
Definition at line 246 of file Encoder.cpp.
|
inline |
Save current stream position as beginning of current level.
Definition at line 192 of file Encoder.h.
|
inline |
Informs the encoder about the encoded level.
currentLevel | encoded level [0, nLevels) |
Definition at line 162 of file Encoder.h.
|
inline |
Resets stream position to beginning of PGF pre-header.
Definition at line 188 of file Encoder.h.
UINT32 CEncoder::UpdateLevelLength | ( | ) |
Write new levelLength into stream. It might throw an IOException.
Definition at line 202 of file Encoder.cpp.
void CEncoder::UpdatePostHeaderSize | ( | PGFPreHeader | preHeader | ) |
Increase post-header size and write new size into stream.
preHeader | An already filled in PGF pre-header It might throw an IOException. |
Definition at line 160 of file Encoder.cpp.
UINT32 CEncoder::WriteLevelLength | ( | UINT32 *& | levelLength | ) |
Create level length data structure and write a place holder into stream. It might throw an IOException.
levelLength | A reference to an integer array, large enough to save the relative file positions of all PGF levels |
Definition at line 177 of file Encoder.cpp.
|
private |
Definition at line 406 of file Encoder.cpp.
void CEncoder::WriteValue | ( | CSubband * | band, |
int | bandPos | ||
) |
Write a single value into subband at given position. It might throw an IOException.
band | A subband |
bandPos | A valid position in subband band |
Definition at line 326 of file Encoder.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |