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__
113 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__
253 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;
#define PGFROI
supports Regions Of Interest
void(* RefreshCB)(void *p)
#define MaxChannels
maximum number of (color) channels
#define PGF32
32 bit values are used -> allows at maximum 31 bits, otherwise 16 bit values are used -> allows at ma...
#define PGFVersion
current standard version
bool m_useOMPinDecoder
use Open MP in decoder
UINT32 Clamp31(DataT v) const
void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD *prgbColors) THROW_
UINT32 WriteImage(CPGFStream *stream, CallbackPtr cb=NULL, void *data=NULL) THROW_
UINT32 ChannelHeight(int c=0) const
CDecoder * m_decoder
PGF decoder.
void RgbToYuv(int pitch, UINT8 *rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data) THROW_
void SetHeader(const PGFHeader &header, BYTE flags=0, UINT8 *userData=0, UINT32 userDataLength=0) THROW_
bool m_useOMPinEncoder
use Open MP in encoder
UINT16 Clamp6(DataT v) const
UINT32 * m_levelLength
length of each level in bytes; first level starts immediately after this array
UINT32 m_height[MaxChannels]
height of each channel at current level
void ReadPreview() THROW_
PGFHeader m_header
PGF file header.
virtual ~CPGFImage()
Destructor: Destroy internal data structures.
void Downsample(int nChannel)
UINT32 GetMaxValue() const
UINT64 GetUserDataPos() const
UINT32 UpdatePostHeaderSize() THROW_
int m_currentLevel
transform level of current image
void SetChannel(DataT *channel, int c=0)
UINT32 ReadEncodedHeader(UINT8 *target, UINT32 targetLen) const THROW_
void ConfigureEncoder(bool useOMP=true, bool favorSpeedOverSize=false)
UINT32 Width(int level=0) const
DataT * m_channel[MaxChannels]
untransformed channels in YUV format
void Write(CPGFStream *stream, UINT32 *nWrittenBytes=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
UINT32 ChannelWidth(int c=0) const
static BYTE CurrentVersion(BYTE version=PGFVersion)
Return version.
UINT32 WriteHeader(CPGFStream *stream) THROW_
void * m_cbArg
refresh callback argument
const UINT8 * GetUserData(UINT32 &size) const
const PGFHeader * GetHeader() const
static UINT32 LevelWidth(UINT32 width, int level)
BYTE m_quant
quantization parameter
static bool ImportIsSupported(BYTE mode)
BYTE ChannelDepth() const
static UINT32 LevelHeight(UINT32 height, int level)
UINT16 Clamp16(DataT v) const
static BYTE CurrentChannelDepth(BYTE version=PGFVersion)
bool m_favorSpeedOverSize
favor encoding speed over compression ratio
void SetMaxValue(UINT32 maxValue)
BYTE UsedBitsPerChannel() const
CEncoder * m_encoder
PGF encoder.
bool IsOpen() const
Returns true if the PGF has been opened and not closed.
UINT8 Clamp8(DataT v) const
PGFRect m_roi
region of interest
void SetROI(PGFRect rect)
void Read(int level=0, CallbackPtr cb=NULL, void *data=NULL) THROW_
ProgressMode m_progressMode
progress mode used in Read and Write; PM_Relative is default mode
bool m_downsample
chrominance channels are downsampled
void ConfigureDecoder(bool useOMP=true, bool skipUserData=false)
UINT32 GetEncodedLevelLength(int level) const
bool ROIisSupported() const
UINT32 Height(int level=0) const
void ResetStreamPos() THROW_
Reset stream position to start of PGF pre-header.
void Open(CPGFStream *stream) THROW_
void Reconstruct(int level=0) THROW_
UINT32 m_width[MaxChannels]
width of each channel at current level
PGFPostHeader m_postHeader
PGF post-header.
void SetRefreshCallback(RefreshCB callback, void *arg)
UINT32 Write(int level, CallbackPtr cb=NULL, void *data=NULL) THROW_
RefreshCB m_cb
pointer to refresh callback procedure
void GetYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) const THROW_
UINT64 m_userDataPos
stream position of user data
bool m_skipUserData
skip user data (metadata) during open
UINT32 GetEncodedHeaderLength() const
void SetProgressMode(ProgressMode pm)
PGFPreHeader m_preHeader
PGF pre-header.
void Read(PGFRect &rect, int level=0, CallbackPtr cb=NULL, void *data=NULL) THROW_
double m_percent
progress [0..1]
UINT8 Clamp4(DataT v) const
void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
CWaveletTransform * m_wtChannel[MaxChannels]
wavelet transformed color channels
DataT * GetChannel(int c=0)
const RGBQUAD * GetColorTable() const
bool m_streamReinitialized
stream has been reinitialized
CPGFImage()
Standard constructor: It is used to create a PGF instance for opening and reading.
void ImportBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) THROW_
UINT32 ReadEncodedData(int level, UINT8 *target, UINT32 targetLen) const THROW_
void GetBitmap(int pitch, UINT8 *buff, BYTE bpp, int channelMap[]=NULL, CallbackPtr cb=NULL, void *data=NULL) const THROW_
Abstract stream base class.
UINT8 version
PGF version.