29 #ifndef PGF_PGFIMAGE_H 30 #define PGF_PGFIMAGE_H 91 void Read(
int level = 0, CallbackPtr cb =
nullptr,
void *data =
nullptr);
93 #ifdef __PGFROISUPPORT__ 94 void Read(
PGFRect& rect,
int level = 0, CallbackPtr cb =
nullptr,
void *data =
nullptr);
137 void GetBitmap(
int pitch, UINT8* buff, BYTE bpp,
int channelMap[] =
nullptr, CallbackPtr cb =
nullptr,
void *data =
nullptr)
const;
154 void GetYUV(
int pitch,
DataT* buff, BYTE bpp,
int channelMap[] =
nullptr, CallbackPtr cb =
nullptr,
void *data =
nullptr)
const;
172 void ImportBitmap(
int pitch, UINT8 *buff, BYTE bpp,
int channelMap[] =
nullptr, CallbackPtr cb =
nullptr,
void *data =
nullptr);
189 void ImportYUV(
int pitch,
DataT *buff, BYTE bpp,
int channelMap[] =
nullptr, CallbackPtr cb =
nullptr,
void *data =
nullptr);
204 void Write(
CPGFStream* stream, UINT32* nWrittenBytes =
nullptr, CallbackPtr cb =
nullptr,
void *data =
nullptr);
227 #ifdef __PGFROISUPPORT__ 228 UINT32
Write(
int level, CallbackPtr cb =
nullptr,
void *data =
nullptr);
282 void SetHeader(
const PGFHeader& header, BYTE flags = 0,
const UINT8* userData = 0, UINT32 userDataLength = 0);
311 void SetColorTable(UINT32 iFirstColor, UINT32 nColors,
const RGBQUAD* prgbColors);
325 void GetColorTable(UINT32 iFirstColor, UINT32 nColors, RGBQUAD* prgbColors)
const;
354 const UINT8*
GetUserData(UINT32& cachedSize, UINT32* pTotalSize =
nullptr)
const;
387 UINT32
ReadEncodedData(
int level, UINT8* target, UINT32 targetLen)
const;
468 #ifdef __PGFROISUPPORT__ 499 static UINT32
LevelSizeL(UINT32 size,
int level) { ASSERT(level >= 0); UINT32 d = 1 << level;
return (size + d - 1) >> level; }
506 static UINT32
LevelSizeH(UINT32 size,
int level) { ASSERT(level >= 0); UINT32 d = 1 << (level - 1);
return (size + d - 1) >> level; }
539 #ifdef __PGFROISUPPORT__ 553 void RgbToYuv(
int pitch, UINT8* rgbBuff, BYTE bpp,
int channelMap[], CallbackPtr cb,
void *data);
558 #ifdef __PGFROISUPPORT__ 564 if (v & 0xFFFFFFF0)
return (v < 0) ? (UINT8)0: (UINT8)15;
else return (UINT8)v;
567 if (v & 0xFFFFFFC0)
return (v < 0) ? (UINT16)0: (UINT16)63;
else return (UINT16)v;
571 if (v & 0xFFFFFF00)
return (v < 0) ? (UINT8)0 : (UINT8)255;
else return (UINT8)v;
574 if (v & 0xFFFF0000)
return (v < 0) ? (UINT16)0: (UINT16)65535;
else return (UINT16)v;
577 return (v < 0) ? 0 : (UINT32)v;
581 #endif //PGF_PGFIMAGE_H void Open(CPGFStream *stream)
void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD *prgbColors)
void Read(int level=0, CallbackPtr cb=nullptr, void *data=nullptr)
bool m_favorSpeedOverSize
favor encoding speed over compression ratio
UINT64 m_userDataPos
stream position of user data
bool m_useOMPinDecoder
use Open MP in decoder
UINT8 version
PGF version.
UINT32 ReadEncodedHeader(UINT8 *target, UINT32 targetLen) const
#define PGFVersion
current standard version
void GetYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) const
const UINT8 * GetUserData(UINT32 &cachedSize, UINT32 *pTotalSize=nullptr) const
UINT32 Height(int level=0) const
#define MaxChannels
maximum number of (color) channels
Abstract stream base class.
BYTE UsedBitsPerChannel() const
void GetBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr) const
DataT * GetChannel(int c=0)
void(* RefreshCB)(void *p)
UINT32 ReadEncodedData(int level, UINT8 *target, UINT32 targetLen) const
CDecoder * m_decoder
PGF decoder.
UINT32 GetEncodedLevelLength(int level) const
void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr)
PGFHeader m_header
PGF file header.
bool m_streamReinitialized
stream has been reinitialized
BYTE m_quant
quantization parameter
void * m_cbArg
refresh callback argument
DataT * m_channel[MaxChannels]
untransformed channels in YUV format
PGFPreHeader m_preHeader
PGF pre-header.
static UINT32 LevelSizeL(UINT32 size, int level)
void SetProgressMode(ProgressMode pm)
void SetROI(PGFRect rect)
const RGBQUAD * GetColorTable() const
PGFRect GetAlignedROI(int c=0) const
UINT32 WriteImage(CPGFStream *stream, CallbackPtr cb=nullptr, void *data=nullptr)
static BYTE CodecMajorVersion(BYTE version=PGFVersion)
Return major version.
UINT16 Clamp6(DataT v) const
UINT32 GetMaxValue() const
ProgressMode m_progressMode
progress mode used in Read and Write; PM_Relative is default mode
CWaveletTransform * m_wtChannel[MaxChannels]
wavelet transformed color channels
PGFPostHeader m_postHeader
PGF post-header.
UINT32 Clamp31(DataT v) const
UINT16 Clamp16(DataT v) const
bool m_downsample
chrominance channels are downsampled
void SetRefreshCallback(RefreshCB callback, void *arg)
UINT32 * m_levelLength
length of each level in bytes; first level starts immediately after this array
UINT32 WriteHeader(CPGFStream *stream)
UINT32 m_width[MaxChannels]
width of each channel at current level
CPGFImage()
Standard constructor.
void SetHeader(const PGFHeader &header, BYTE flags=0, const UINT8 *userData=0, UINT32 userDataLength=0)
bool ROIisSupported() const
#define PGFROI
supports Regions Of Interest
bool IsOpen() const
Returns true if the PGF has been opened for reading.
bool m_useOMPinEncoder
use Open MP in encoder
virtual ~CPGFImage()
Destructor.
void Reconstruct(int level=0)
bool IsFullyRead() const
Return true if all levels have been read.
UINT8 Clamp8(DataT v) const
UINT32 ChannelHeight(int c=0) const
UINT8 Clamp4(DataT v) const
static UINT32 LevelSizeH(UINT32 size, int level)
BYTE ChannelDepth() const
UINT16 major
major version number
UINT32 GetEncodedHeaderLength() const
void ConfigureDecoder(bool useOMP=true, UserdataPolicy policy=UP_CacheAll, UINT32 prefixSize=0)
UINT32 m_userDataPolicy
user data (metadata) policy during open
double m_percent
progress [0..1]
void RgbToYuv(int pitch, UINT8 *rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data)
void SetChannel(DataT *channel, int c=0)
void ImportBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=nullptr, CallbackPtr cb=nullptr, void *data=nullptr)
void ResetStreamPos(bool startOfData)
#define PGF32
32 bit values are used -> allows at maximum 31 bits, otherwise 16 bit values are used -> allows at ma...
UINT32 ChannelWidth(int c=0) const
void SetMaxValue(UINT32 maxValue)
RefreshCB m_cb
pointer to refresh callback procedure
static bool ImportIsSupported(BYTE mode)
CEncoder * m_encoder
PGF encoder.
static BYTE MaxChannelDepth(BYTE version=PGFVersion)
UINT32 Width(int level=0) const
const PGFHeader * GetHeader() const
void Downsample(int nChannel)
int m_currentLevel
transform level of current image
PGFRect ComputeLevelROI() const
void Write(CPGFStream *stream, UINT32 *nWrittenBytes=nullptr, CallbackPtr cb=nullptr, void *data=nullptr)
void ConfigureEncoder(bool useOMP=true, bool favorSpeedOverSize=false)
UINT32 m_height[MaxChannels]
height of each channel at current level
UINT32 UpdatePostHeaderSize()
PGFRect m_roi
region of interest
UINT64 GetUserDataPos() const