29 #ifndef PGF_PGFIMAGE_H 30 #define PGF_PGFIMAGE_H 101 void Read(
int level = 0, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
103 #ifdef __PGFROISUPPORT__ 104 void Read(
PGFRect& rect,
int level = 0, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
147 void GetBitmap(
int pitch, UINT8* buff, BYTE bpp,
int channelMap[] = NULL, CallbackPtr cb = NULL,
void *data = NULL) const THROW_;
164 void GetYUV(
int pitch,
DataT* buff, BYTE bpp,
int channelMap[] = NULL, CallbackPtr cb = NULL,
void *data = NULL) const THROW_;
182 void ImportBitmap(
int pitch, UINT8 *buff, BYTE bpp,
int channelMap[] = NULL, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
199 void ImportYUV(
int pitch,
DataT *buff, BYTE bpp,
int channelMap[] = NULL, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
214 void Write(
CPGFStream* stream, UINT32* nWrittenBytes = NULL, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
237 #ifdef __PGFROISUPPORT__ 238 UINT32
Write(
int level, CallbackPtr cb = NULL,
void *data = NULL) THROW_;
286 void SetHeader(
const PGFHeader& header, BYTE flags = 0, UINT8* userData = 0, UINT32 userDataLength = 0) THROW_;
315 void SetColorTable(UINT32 iFirstColor, UINT32 nColors,
const RGBQUAD* prgbColors) THROW_;
329 void GetColorTable(UINT32 iFirstColor, UINT32 nColors, RGBQUAD* prgbColors)
const THROW_;
390 UINT32
ReadEncodedData(
int level, UINT8* target, UINT32 targetLen)
const THROW_;
491 static UINT32
LevelWidth(UINT32 width,
int level) { ASSERT(level >= 0); UINT32 w = (width >> level);
return ((w << level) == width) ? w : w + 1; }
498 static UINT32
LevelHeight(UINT32 height,
int level) { ASSERT(level >= 0); UINT32 h = (height >> level);
return ((h << level) == height) ? h : h + 1; }
529 #ifdef __PGFROISUPPORT__ 542 void RgbToYuv(
int pitch, UINT8* rgbBuff, BYTE bpp,
int channelMap[], CallbackPtr cb,
void *data) THROW_;
547 #ifdef __PGFROISUPPORT__ 552 if (v & 0xFFFFFFF0)
return (v < 0) ? (UINT8)0: (UINT8)15;
else return (UINT8)v;
555 if (v & 0xFFFFFFC0)
return (v < 0) ? (UINT16)0: (UINT16)63;
else return (UINT16)v;
559 if (v & 0xFFFFFF00)
return (v < 0) ? (UINT8)0 : (UINT8)255;
else return (UINT8)v;
562 if (v & 0xFFFF0000)
return (v < 0) ? (UINT16)0: (UINT16)65535;
else return (UINT16)v;
565 return (v < 0) ? 0 : (UINT32)v;
569 #endif //PGF_PGFIMAGE_H 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.
#define PGFVersion
current standard version
UINT32 Height(int level=0) const
#define MaxChannels
maximum number of (color) channels
static BYTE CurrentVersion(BYTE version=PGFVersion)
Return version.
Abstract stream base class.
UINT32 ReadEncodedData(int level, UINT8 *target, UINT32 targetLen) const THROW_
BYTE UsedBitsPerChannel() const
bool m_skipUserData
skip user data (metadata) during open
void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
DataT * GetChannel(int c=0)
void(* RefreshCB)(void *p)
void RgbToYuv(int pitch, UINT8 *rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data) THROW_
void Write(CPGFStream *stream, UINT32 *nWrittenBytes=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
CDecoder * m_decoder
PGF decoder.
void Open(CPGFStream *stream) THROW_
UINT32 GetEncodedLevelLength(int level) const
PGFHeader m_header
PGF file header.
bool m_streamReinitialized
stream has been reinitialized
void ConfigureDecoder(bool useOMP=true, bool skipUserData=false)
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.
void GetBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) const THROW_
static BYTE CurrentChannelDepth(BYTE version=PGFVersion)
void SetProgressMode(ProgressMode pm)
void SetROI(PGFRect rect)
const RGBQUAD * GetColorTable() const
const UINT8 * GetUserData(UINT32 &size) const
void ReadPreview() THROW_
void GetYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) const THROW_
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
void Read(int level=0, CallbackPtr cb=NULL, void *data=NULL) THROW_
PGFPostHeader m_postHeader
PGF post-header.
UINT32 Clamp31(DataT v) const
UINT16 Clamp16(DataT v) const
UINT32 ReadEncodedHeader(UINT8 *target, UINT32 targetLen) const THROW_
bool m_downsample
chrominance channels are downsampled
void SetRefreshCallback(RefreshCB callback, void *arg)
UINT32 UpdatePostHeaderSize() THROW_
UINT32 * m_levelLength
length of each level in bytes; first level starts immediately after this array
UINT32 m_width[MaxChannels]
width of each channel at current level
CPGFImage()
Standard constructor: It is used to create a PGF instance for opening and reading.
void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD *prgbColors) THROW_
void ImportBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
bool ROIisSupported() const
#define PGFROI
supports Regions Of Interest
bool IsOpen() const
Returns true if the PGF has been opened and not closed.
void Reconstruct(int level=0) THROW_
bool m_useOMPinEncoder
use Open MP in encoder
virtual ~CPGFImage()
Destructor: Destroy internal data structures.
UINT8 Clamp8(DataT v) const
UINT32 ChannelHeight(int c=0) const
UINT8 Clamp4(DataT v) const
BYTE ChannelDepth() const
UINT32 GetEncodedHeaderLength() const
double m_percent
progress [0..1]
void SetChannel(DataT *channel, int c=0)
static UINT32 LevelWidth(UINT32 width, int level)
#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)
UINT32 WriteHeader(CPGFStream *stream) THROW_
RefreshCB m_cb
pointer to refresh callback procedure
static bool ImportIsSupported(BYTE mode)
CEncoder * m_encoder
PGF encoder.
UINT32 Width(int level=0) const
const PGFHeader * GetHeader() const
void ResetStreamPos() THROW_
Reset stream position to start of PGF pre-header.
void Downsample(int nChannel)
UINT32 WriteImage(CPGFStream *stream, CallbackPtr cb=NULL, void *data=NULL) THROW_
int m_currentLevel
transform level of current image
void SetHeader(const PGFHeader &header, BYTE flags=0, UINT8 *userData=0, UINT32 userDataLength=0) THROW_
void ConfigureEncoder(bool useOMP=true, bool favorSpeedOverSize=false)
UINT32 m_height[MaxChannels]
height of each channel at current level
PGFRect m_roi
region of interest
static UINT32 LevelHeight(UINT32 height, int level)
UINT64 GetUserDataPos() const