PGFimage.h   PGFimage.h 
skipping to change at line 34 skipping to change at line 34
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/// @file PGFimage.h /// @file PGFimage.h
/// @brief PGF image class /// @brief PGF image class
/// @author C. Stamm /// @author C. Stamm
#ifndef PGF_PGFIMAGE_H #ifndef PGF_PGFIMAGE_H
#define PGF_PGFIMAGE_H #define PGF_PGFIMAGE_H
#include "PGFstream.h" #include "PGFstream.h"
//////////////////////////////////////////////////////////////////////
// types
enum ProgressMode { PM_Relative, PM_Absolute };
//////////////////////////////////////////////////////////////////////
// prototypes
class CDecoder; class CDecoder;
class CEncoder; class CEncoder;
class CWaveletTransform; class CWaveletTransform;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/// PGF image class is the main class. You always need a PGF object /// PGF image class is the main class. You always need a PGF object
/// for encoding or decoding image data. /// for encoding or decoding image data.
/// Decoding: /// Decoding:
/// pgf.Open(...) /// pgf.Open(...)
/// pgf.Read(...) /// pgf.Read(...)
skipping to change at line 196 skipping to change at line 202
/// It might throw an IOException. /// It might throw an IOException.
/// @param pitch The number of bytes of a row of the image buffer. /// @param pitch The number of bytes of a row of the image buffer.
/// @param buff An image buffer. /// @param buff An image buffer.
/// @param bpp The number of bits per pixel used in image buffer. /// @param bpp The number of bits per pixel used in image buffer.
/// @param channelMap A integer array containing the mapping of inpu t channel ordering to expected channel ordering. /// @param channelMap A integer array containing the mapping of inpu t channel ordering to expected channel ordering.
/// @param cb A pointer to a callback procedure. The procedure is ca lled after each imported buffer row. If cb returns true, then it stops proc eeding. /// @param cb A pointer to a callback procedure. The procedure is ca lled after each imported buffer row. If cb returns true, then it stops proc eeding.
/// @param data Data Pointer to C++ class container to host callback procedure. /// @param data Data Pointer to C++ class container to host callback procedure.
void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[] = NULL, CallbackPtr cb = NULL, void *data = NULL) THROW_; void ImportYUV(int pitch, DataT *buff, BYTE bpp, int channelMap[] = NULL, CallbackPtr cb = NULL, void *data = NULL) THROW_;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Encode and write a PGF image at current stream position. /// Encode and write a entire PGF image (header and image) at curren t stream position.
/// A PGF image is structered in levels, numbered between 0 and Leve ls() - 1. /// A PGF image is structered in levels, numbered between 0 and Leve ls() - 1.
/// Each level can be seen as a single image, containing the same co ntent /// Each level can be seen as a single image, containing the same co ntent
/// as all other levels, but in a different size (width, height). /// as all other levels, but in a different size (width, height).
/// The image size at level i is double the size (width, height) of the image at level i+1. /// The image size at level i is double the size (width, height) of the image at level i+1.
/// The image at level 0 contains the original size. /// The image at level 0 contains the original size.
/// Precondition: the PGF image contains a valid header (see also Se tHeader(...)). /// Precondition: the PGF image contains a valid header (see also Se tHeader(...)).
/// Please note: the earlier parameter nLevels has now to be set wit
h SetHeader. Either specify the number of levels
/// or use the value 0 for automatic setting.
/// It might throw an IOException. /// It might throw an IOException.
/// @param stream A PGF stream /// @param stream A PGF stream
/// @param nWrittenBytes [in-out] The number of bytes written into s tream are added to the input value. /// @param nWrittenBytes [in-out] The number of bytes written into s tream are added to the input value.
/// @param cb A pointer to a callback procedure. The procedure is ca lled after writing a single level. If cb returns true, then it stops procee ding. /// @param cb A pointer to a callback procedure. The procedure is ca lled after writing a single level. If cb returns true, then it stops procee ding.
/// @param data Data Pointer to C++ class container to host callback procedure. /// @param data Data Pointer to C++ class container to host callback procedure.
void Write(CPGFStream* stream, UINT32* nWrittenBytes = NULL, Callbac kPtr cb = NULL, void *data = NULL) THROW_; void Write(CPGFStream* stream, UINT32* nWrittenBytes = NULL, Callbac kPtr cb = NULL, void *data = NULL) THROW_;
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
/// Create wavelet transform channels and encoder. /// Create wavelet transform channels and encoder. Write header at c
/// Call this method before your first call of Write(int level), but urrent stream position.
after SetHeader(). /// Call this method before your first call of Write(int level) or W
/// Don't use this method when you call Write(). riteImage(), but after SetHeader().
/// This method is called inside of Write(stream, ...).
/// It might throw an IOException. /// It might throw an IOException.
/// @param stream A PGF stream /// @param stream A PGF stream
/// @return The number of bytes written into stream. /// @return The number of bytes written into stream.
UINT32 WriteHeader(CPGFStream* stream) THROW_; UINT32 WriteHeader(CPGFStream* stream) THROW_;
////////////////////////////////////////////////////////////////////
//
/// Encode and write the one and only image at current stream positi
on.
/// Call this method after WriteHeader(). In case you want to write
uncached metadata,
/// then do that after WriteHeader() and before WriteImage().
/// This method is called inside of Write(stream, ...).
/// It might throw an IOException.
/// @param stream A PGF stream
/// @param cb A pointer to a callback procedure. The procedure is ca
lled after writing a single level. If cb returns true, then it stops procee
ding.
/// @param data Data Pointer to C++ class container to host callback
procedure.
/// @return The number of bytes written into stream.
UINT32 WriteImage(CPGFStream* stream, CallbackPtr cb = NULL, void *d
ata = NULL) THROW_;
#ifdef __PGFROISUPPORT__ #ifdef __PGFROISUPPORT__
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
/// Encode and write down to given level at current stream position. /// Encode and write down to given level at current stream position.
/// A PGF image is structered in levels, numbered between 0 and Leve ls() - 1. /// A PGF image is structered in levels, numbered between 0 and Leve ls() - 1.
/// Each level can be seen as a single image, containing the same co ntent /// Each level can be seen as a single image, containing the same co ntent
/// as all other levels, but in a different size (width, height). /// as all other levels, but in a different size (width, height).
/// The image size at level i is double the size (width, height) of the image at level i+1. /// The image size at level i is double the size (width, height) of the image at level i+1.
/// The image at level 0 contains the original size. /// The image at level 0 contains the original size.
/// Precondition: the PGF image contains a valid header (see also Se /// Preconditions: the PGF image contains a valid header (see also S
tHeader(...)) and etHeader(...)) and
/// WriteHeader() has been called before Write(). /// WriteHeader() has been called before. Levels() > 0.
/// The ROI encoding scheme is used. /// The ROI encoding scheme must be used (see also SetHeader(...)).
/// It might throw an IOException. /// It might throw an IOException.
/// @param level [0, nLevels) The image level of the resulting image in the internal image buffer. /// @param level [0, nLevels) The image level of the resulting image in the internal image buffer.
/// @param cb A pointer to a callback procedure. The procedure is ca lled after writing a single level. If cb returns true, then it stops procee ding. /// @param cb A pointer to a callback procedure. The procedure is ca lled after writing a single level. If cb returns true, then it stops procee ding.
/// @param data Data Pointer to C++ class container to host callback procedure. /// @param data Data Pointer to C++ class container to host callback procedure.
/// @return The number of bytes written into stream. /// @return The number of bytes written into stream.
UINT32 Write(int level, CallbackPtr cb = NULL, void *data = NULL) TH ROW_; UINT32 Write(int level, CallbackPtr cb = NULL, void *data = NULL) TH ROW_;
#endif #endif
//////////////////////////////////////////////////////////////////// / //////////////////////////////////////////////////////////////////// /
/// Configures the encoder. /// Configures the encoder.
/// @param useOMP Use parallel threading with Open MP during encodin g. Default value: true. Influences the encoding only if the codec has been compiled with OpenMP support. /// @param useOMP Use parallel threading with Open MP during encodin g. Default value: true. Influences the encoding only if the codec has been compiled with OpenMP support.
/// @param favorSpeedOverSize Favors encoding speed over compression ratio. Default value: false /// @param favorSpeedOverSize Favors encoding speed over compression ratio. Default value: false
void ConfigureEncoder(bool useOMP = true, bool favorSpeedOverSize = false) { m_useOMPinEncoder = useOMP; m_favorSpeedOverSize = favorSpeedOverS ize; } void ConfigureEncoder(bool useOMP = true, bool favorSpeedOverSize = false) { m_useOMPinEncoder = useOMP; m_favorSpeedOverSize = favorSpeedOverS ize; }
//////////////////////////////////////////////////////////////////// / //////////////////////////////////////////////////////////////////// /
/// Configures the encoder. /// Configures the decoder.
/// @param useOMP Use parallel threading with Open MP during decodin g. Default value: true. Influences the decoding only if the codec has been compiled with OpenMP support. /// @param useOMP Use parallel threading with Open MP during decodin g. Default value: true. Influences the decoding only if the codec has been compiled with OpenMP support.
void ConfigureDecoder(bool useOMP = true) { m_useOMPinDecoder = useO /// @param skipUserData The file might contain user data (metadata).
MP; } User data ist usually read during Open and stored in memory. Set this flag
to false when storing in memory is not needed.
//////////////////////////////////////////////////////////////////// void ConfigureDecoder(bool useOMP = true, bool skipUserData = false)
// { m_useOMPinDecoder = useOMP; m_skipUserData = skipUserData; }
/// Set background of an RGB image with transparency channel or rese
t to default background.
/// @param bg A pointer to a background color or NULL (reset to defa
ult background)
//void SetBackground(const RGBTRIPLE* bg);
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// /// Reset stream position to start of PGF pre-header
/// Set background of an RGB image with transparency channel. void ResetStreamPos() THROW_;
/// @param red A red value (0..255)
/// @param green A green value (0..255)
/// @param blue A blue value (0..255)
//void SetBackground(BYTE red, BYTE green, BYTE blue)
{ /*m_backgroundSet = true;*/ m_header.background.rgbtRed = red
; m_header.background.rgbtGreen = green; m_header.background.rgbtBlue = blu
e; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Set internal PGF image buffer channel. /// Set internal PGF image buffer channel.
/// @param channel A YUV data channel /// @param channel A YUV data channel
/// @param c A channel index /// @param c A channel index
void SetChannel(DataT* channel, int c = 0) { ASSERT(c >= 0 && c < MaxChannels); m_channel[c] = cha nnel; } void SetChannel(DataT* channel, int c = 0) { ASSERT(c >= 0 && c < MaxChannels); m_channel[c] = cha nnel; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Set PGF header and user data. /// Set PGF header and user data.
/// Precondition: The PGF image has been closed with Close(...) or n ever opened with Open(...). /// Precondition: The PGF image has been closed with Close(...) or n ever opened with Open(...).
/// It might throw an IOException. /// It might throw an IOException.
/// @param header A valid and already filled in PGF header structure /// @param header A valid and already filled in PGF header structure
/// @param flags A combination of additional version flags /// @param flags A combination of additional version flags. In case
/// @param userData A user-defined memory block you use level-wise encoding then set flag = PGFROI.
/// @param userData A user-defined memory block containing any kind
of cached metadata.
/// @param userDataLength The size of user-defined memory block in b ytes /// @param userDataLength The size of user-defined memory block in b ytes
void SetHeader(const PGFHeader& header, BYTE flags = 0, UINT8* userD ata = 0, UINT32 userDataLength = 0) THROW_; // throws IOException void SetHeader(const PGFHeader& header, BYTE flags = 0, UINT8* userD ata = 0, UINT32 userDataLength = 0) THROW_; // throws IOException
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Set maximum intensity value for image modes with more than eight bits per channel. /// Set maximum intensity value for image modes with more than eight bits per channel.
/// Call this method after SetHeader, but before ImportBitmap. /// Call this method after SetHeader, but before ImportBitmap.
/// @param maxValue The maximum intensity value. /// @param maxValue The maximum intensity value.
void SetMaxValue(UINT32 maxValue); void SetMaxValue(UINT32 maxValue);
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Returns number of used bits per input/output image channel. /// Set progress mode used in Read and Write.
/// Precondition: header must be initialized. /// Default mode is PM_Relative.
/// @return number of used bits per input/output image channel. /// This method must be called before Open() or SetHeader().
BYTE UsedBitsPerChannel() const; /// PM_Relative: 100% = level difference between current level and t
arget level of Read/Write
/// PM_Absolute: 100% = number of levels
void SetProgressMode(ProgressMode pm)
{ m_progressMode = pm; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Set refresh callback procedure and its parameter. /// Set refresh callback procedure and its parameter.
/// The refresh callback is called during Read(...) after each level read. /// The refresh callback is called during Read(...) after each level read.
/// @param callback A refresh callback procedure /// @param callback A refresh callback procedure
/// @param arg A parameter of the refresh callback procedure /// @param arg A parameter of the refresh callback procedure
void SetRefreshCallback(RefreshCB callback, void* arg) { m_cb = callback; m_cbArg = arg; } void SetRefreshCallback(RefreshCB callback, void* arg) { m_cb = callback; m_cbArg = arg; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Sets the red, green, blue (RGB) color values for a range of entr ies in the palette (clut). /// Sets the red, green, blue (RGB) color values for a range of entr ies in the palette (clut).
/// It might throw an IOException. /// It might throw an IOException.
/// @param iFirstColor The color table index of the first entry to s et. /// @param iFirstColor The color table index of the first entry to s et.
/// @param nColors The number of color table entries to set. /// @param nColors The number of color table entries to set.
/// @param prgbColors A pointer to the array of RGBQUAD structures t o set the color table entries. /// @param prgbColors A pointer to the array of RGBQUAD structures t o set the color table entries.
void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD * prgbColors) THROW_; void SetColorTable(UINT32 iFirstColor, UINT32 nColors, const RGBQUAD * prgbColors) THROW_;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the background color of an RGB image with transparency ch
annel.
/// @return Background color in RGB
//RGBTRIPLE Background() const
{ return m_header.background; }
////////////////////////////////////////////////////////////////////
//
/// Return an internal YUV image channel. /// Return an internal YUV image channel.
/// @param c A channel index /// @param c A channel index
/// @return An internal YUV image channel /// @return An internal YUV image channel
DataT* GetChannel(int c = 0) { ASSERT(c >= 0 && c < MaxChannels); return m_c hannel[c]; } DataT* GetChannel(int c = 0) { ASSERT(c >= 0 && c < MaxChannels); return m_c hannel[c]; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Retrieves red, green, blue (RGB) color values from a range of en tries in the palette of the DIB section. /// Retrieves red, green, blue (RGB) color values from a range of en tries in the palette of the DIB section.
/// It might throw an IOException. /// It might throw an IOException.
/// @param iFirstColor The color table index of the first entry to r etrieve. /// @param iFirstColor The color table index of the first entry to r etrieve.
/// @param nColors The number of color table entries to retrieve. /// @param nColors The number of color table entries to retrieve.
skipping to change at line 342 skipping to change at line 348
/// @return A PGF header structure /// @return A PGF header structure
const PGFHeader* GetHeader() const { return &m_header; } const PGFHeader* GetHeader() const { return &m_header; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Get maximum intensity value for image modes with more than eight bits per channel. /// Get maximum intensity value for image modes with more than eight bits per channel.
/// Don't call this method before the PGF header has been read. /// Don't call this method before the PGF header has been read.
/// @return The maximum intensity value. /// @return The maximum intensity value.
UINT32 GetMaxValue() const { return (1 << m_header.usedBitsPerChan nel) - 1; } UINT32 GetMaxValue() const { return (1 << m_header.usedBitsPerChan nel) - 1; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the stream position of the user data or 0.
/// Precondition: The PGF image has been opened with a call of Open(
...).
UINT64 GetUserDataPos() const
{ return m_userDataPos; }
////////////////////////////////////////////////////////////////////
//
/// Return user data and size of user data. /// Return user data and size of user data.
/// Precondition: The PGF image has been opened with a call of Open( ...).
/// @param size [out] Size of user data in bytes. /// @param size [out] Size of user data in bytes.
/// @return A pointer to user data or NULL if there is no user data. /// @return A pointer to user data or NULL if there is no user data.
const UINT8* GetUserData(UINT32& size) const; const UINT8* GetUserData(UINT32& size) const;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the length of all encoded headers in bytes. /// Return the length of all encoded headers in bytes.
/// Precondition: The PGF image has been opened with a call of Open( ...). /// Precondition: The PGF image has been opened with a call of Open( ...).
/// @return The length of all encoded headers in bytes /// @return The length of all encoded headers in bytes
UINT32 GetEncodedHeaderLength() const; UINT32 GetEncodedHeaderLength() const;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the length of an encoded PGF level in bytes. /// Return the length of an encoded PGF level in bytes.
/// Precondition: The PGF image has been opened with a call of Open( ...). /// Precondition: The PGF image has been opened with a call of Open( ...).
/// @param level The image level /// @param level The image level
/// @return The length of a PGF level in bytes /// @return The length of a PGF level in bytes
UINT32 GetEncodedLevelLength(int level) const { ASSERT(level >= 0 && level < m_header.nLevels); return m_leve lLength[m_header.nLevels - level - 1]; } UINT32 GetEncodedLevelLength(int level) const { ASSERT(level >= 0 && level < m_header.nLevels); return m_leve lLength[m_header.nLevels - level - 1]; }
////////////////////////////////////////////////////////////////////
/// Reset stream position to start of PGF pre-header
void ResetStreamPos() THROW_;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Reads the encoded PGF headers and copies it to a target buffer. /// Reads the encoded PGF headers and copies it to a target buffer.
/// Precondition: The PGF image has been opened with a call of Open( ...). /// Precondition: The PGF image has been opened with a call of Open( ...).
/// It might throw an IOException. /// It might throw an IOException.
/// @param target The target buffer /// @param target The target buffer
/// @param targetLen The length of the target buffer in bytes /// @param targetLen The length of the target buffer in bytes
/// @return The number of bytes copied to the target buffer /// @return The number of bytes copied to the target buffer
UINT32 ReadEncodedHeader(UINT8* target, UINT32 targetLen) const THRO W_; UINT32 ReadEncodedHeader(UINT8* target, UINT32 targetLen) const THRO W_;
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
skipping to change at line 450 skipping to change at line 458
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the image mode. /// Return the image mode.
/// An image mode is a predefined constant value (see also PGFtypes. h) compatible with Adobe Photoshop. /// An image mode is a predefined constant value (see also PGFtypes. h) compatible with Adobe Photoshop.
/// It represents an image type and format. /// It represents an image type and format.
/// @return Image mode /// @return Image mode
BYTE Mode() const { return m_header.mode; } BYTE Mode() const { return m_header.mode; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return the number of bits per pixel. /// Return the number of bits per pixel.
/// Valid values can be 1, 8, 12, 16, 24, 31, 32, 48, 64. /// Valid values can be 1, 8, 12, 16, 24, 32, 48, 64.
/// @return Number of bits per pixel. /// @return Number of bits per pixel.
BYTE BPP() const { return m_header.bpp; } BYTE BPP() const { return m_header.bpp; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Return true if the pgf image supports Region Of Interest (ROI). /// Return true if the pgf image supports Region Of Interest (ROI).
/// @return true if the pgf image supports ROI. /// @return true if the pgf image supports ROI.
bool ROIisSupported() const { return (m_preHeader.version & PGFROI) == PGFROI; } bool ROIisSupported() const { return (m_preHeader.version & PGFROI) == PGFROI; }
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Returns number of used bits per input/output image channel.
/// Precondition: header must be initialized.
/// @return number of used bits per input/output image channel.
BYTE UsedBitsPerChannel() const;
////////////////////////////////////////////////////////////////////
//
/// Returns images' PGF version /// Returns images' PGF version
/// @return PGF codec version of the image /// @return PGF codec version of the image
BYTE Version() const { return CurrentVersion(m_preHeader.ver sion); } BYTE Version() const { return CurrentVersion(m_preHeader.ver sion); }
//class methods //class methods
//////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////// //
/// Check for valid import image mode. /// Check for valid import image mode.
/// @param mode Image mode /// @param mode Image mode
/// @return True if an image of given mode can be imported with Impo rtBitmap(...) /// @return True if an image of given mode can be imported with Impo rtBitmap(...)
skipping to change at line 504 skipping to change at line 518
static BYTE CurrentChannelDepth(BYTE version = PGFVersion) { return (version & PGF32) ? 32 : 16; } static BYTE CurrentChannelDepth(BYTE version = PGFVersion) { return (version & PGF32) ? 32 : 16; }
protected: protected:
CWaveletTransform* m_wtChannel[MaxChannels]; ///< wavelet transfo rmed color channels CWaveletTransform* m_wtChannel[MaxChannels]; ///< wavelet transfo rmed color channels
DataT* m_channel[MaxChannels]; ///< untransformed channels in YUV format DataT* m_channel[MaxChannels]; ///< untransformed channels in YUV format
CDecoder* m_decoder; ///< PGF decoder CDecoder* m_decoder; ///< PGF decoder
CEncoder* m_encoder; ///< PGF encoder CEncoder* m_encoder; ///< PGF encoder
UINT32* m_levelLength; ///< length of each level in bytes; first level starts immediately after this array 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 curren t level UINT32 m_width[MaxChannels]; ///< width of each channel at curren t level
UINT32 m_height[MaxChannels]; ///< height of each channel at curre nt level UINT32 m_height[MaxChannels]; ///< height of each channel at curre nt level
PGFPreHeader m_preHeader; ///< PGF pre header PGFPreHeader m_preHeader; ///< PGF pre-header
PGFHeader m_header; ///< PGF file header PGFHeader m_header; ///< PGF file header
PGFPostHeader m_postHeader; ///< PGF post header PGFPostHeader m_postHeader; ///< PGF post-header
UINT64 m_userDataPos; ///< stream position of user
data
int m_currentLevel; ///< transform level of current image int m_currentLevel; ///< transform level of current image
BYTE m_quant; ///< quantization pa rameter BYTE m_quant; ///< quantization pa rameter
bool m_downsample; ///< chrominance cha nnels are downsampled bool m_downsample; ///< chrominance cha nnels are downsampled
bool m_favorSpeedOverSize; ///< favor encoding speed ov er compression ratio bool m_favorSpeedOverSize; ///< favor encoding speed ov er compression ratio
bool m_useOMPinEncoder; ///< use Open MP in encoder bool m_useOMPinEncoder; ///< use Open MP in encoder
bool m_useOMPinDecoder; ///< use Open MP in decoder bool m_useOMPinDecoder; ///< use Open MP in decoder
bool m_skipUserData; ///< skip user data (metadat a) during open
#ifdef __PGFROISUPPORT__ #ifdef __PGFROISUPPORT__
bool m_levelwise; ///< write level-wis e (only used with WriteNextLevel)
bool m_streamReinitialized; ///< stream has been reiniti alized bool m_streamReinitialized; ///< stream has been reiniti alized
PGFRect m_roi; ///< region of inter est PGFRect m_roi; ///< region of inter est
#endif #endif
private: private:
RefreshCB m_cb; ///< pointer to refr esh callback procedure RefreshCB m_cb; ///< pointer to refr esh callback procedure
void *m_cbArg; ///< refresh callbac k argument void *m_cbArg; ///< refresh callbac k argument
double m_percent; ///< progress [0..1]
ProgressMode m_progressMode; ///< progress mode used in Read and
Write; PM_Relative is default mode
void ComputeLevels(); void ComputeLevels();
void CompleteHeader(); void CompleteHeader();
void RgbToYuv(int pitch, UINT8* rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data) THROW_; void RgbToYuv(int pitch, UINT8* rgbBuff, BYTE bpp, int channelMap[], CallbackPtr cb, void *data) THROW_;
void Downsample(int nChannel); void Downsample(int nChannel);
UINT32 UpdatePostHeaderSize() THROW_;
void WriteLevel() THROW_; void WriteLevel() THROW_;
#ifdef __PGFROISUPPORT__ #ifdef __PGFROISUPPORT__
void SetROI(PGFRect rect); void SetROI(PGFRect rect);
#endif #endif
UINT8 Clamp4(DataT v) const { UINT8 Clamp4(DataT v) const {
if (v & 0xFFFFFFF0) return (v < 0) ? (UINT8)0: (UINT8)15; el se return (UINT8)v; if (v & 0xFFFFFFF0) return (v < 0) ? (UINT8)0: (UINT8)15; el se return (UINT8)v;
} }
UINT16 Clamp6(DataT v) const { UINT16 Clamp6(DataT v) const {
 End of changes. 23 change blocks. 
55 lines changed or deleted 82 lines changed or added


 PGFplatform.h   PGFplatform.h 
skipping to change at line 108 skipping to change at line 108
#define ImageModeBitmap 0 #define ImageModeBitmap 0
#define ImageModeGrayScale 1 #define ImageModeGrayScale 1
#define ImageModeIndexedColor 2 #define ImageModeIndexedColor 2
#define ImageModeRGBColor 3 #define ImageModeRGBColor 3
#define ImageModeCMYKColor 4 #define ImageModeCMYKColor 4
#define ImageModeHSLColor 5 #define ImageModeHSLColor 5
#define ImageModeHSBColor 6 #define ImageModeHSBColor 6
#define ImageModeMultichannel 7 #define ImageModeMultichannel 7
#define ImageModeDuotone 8 #define ImageModeDuotone 8
#define ImageModeLabColor 9 #define ImageModeLabColor 9
#define ImageModeGray16 10 #define ImageModeGray16 10 // 5 65
#define ImageModeRGB48 11 #define ImageModeRGB48 11
#define ImageModeLab48 12 #define ImageModeLab48 12
#define ImageModeCMYK64 13 #define ImageModeCMYK64 13
#define ImageModeDeepMultichannel 14 #define ImageModeDeepMultichannel 14
#define ImageModeDuotone16 15 #define ImageModeDuotone16 15
// pgf extension // pgf extension
#define ImageModeRGBA 17 #define ImageModeRGBA 17
#define ImageModeGray32 18 #define ImageModeGray32 18 // M SB is 0 (can be interpreted as signed 15.16 fixed point format)
#define ImageModeRGB12 19 #define ImageModeRGB12 19
#define ImageModeRGB16 20 #define ImageModeRGB16 20
#define ImageModeUnknown 255 #define ImageModeUnknown 255
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// WINDOWS 32 // WINDOWS 32
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
#if defined(WIN32) || defined(WINCE) #if defined(WIN32) || defined(WINCE)
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows he aders #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows he aders
skipping to change at line 421 skipping to change at line 421
BYTE rgbBlue; BYTE rgbBlue;
BYTE rgbGreen; BYTE rgbGreen;
BYTE rgbRed; BYTE rgbRed;
BYTE rgbReserved; BYTE rgbReserved;
} RGBQUAD; } RGBQUAD;
typedef union _LARGE_INTEGER { typedef union _LARGE_INTEGER {
struct { struct {
DWORD LowPart; DWORD LowPart;
LONG HighPart; LONG HighPart;
};
struct {
DWORD LowPart;
LONG HighPart;
} u; } u;
LONGLONG QuadPart; LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER; } LARGE_INTEGER, *PLARGE_INTEGER;
#endif // __POSIX__ #endif // __POSIX__
#if defined(__POSIX__) || defined(WINCE) #if defined(__POSIX__) || defined(WINCE)
// CMYK macros // CMYK macros
#define GetKValue(cmyk) ((BYTE)(cmyk)) #define GetKValue(cmyk) ((BYTE)(cmyk))
#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8)) #define GetYValue(cmyk) ((BYTE)((cmyk)>> 8))
#define GetMValue(cmyk) ((BYTE)((cmyk)>>16)) #define GetMValue(cmyk) ((BYTE)((cmyk)>>16))
skipping to change at line 492 skipping to change at line 488
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// constants // constants
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
#define FSFromStart SEEK_SET #define FSFromStart SEEK_SET
#define FSFromCurrent SEEK_CUR #define FSFromCurrent SEEK_CUR
#define FSFromEnd SEEK_END #define FSFromEnd SEEK_END
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// IO Error constants // IO Error constants
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
#define NoError 0x0000 #define NoError 0x0000 ///< no error
#define AppError 0x2000 ///< all application error messages must be larger than this value #define AppError 0x2000 ///< all application error messages must be larger than this value
#define InsufficientMemory 0x2001 ///< memory allocation wasn't successfull #define InsufficientMemory 0x2001 ///< memory allocation wasn't successfull
#define InvalidStreamPos 0x2002 ///< invalid memory stream position #define InvalidStreamPos 0x2002 ///< invalid memory stream position
#define EscapePressed 0x2003 ///< user br eak by ESC #define EscapePressed 0x2003 ///< user br eak by ESC
#define WrongVersion 0x2004 ///< wrong p gf version #define WrongVersion 0x2004 ///< wrong p gf version
#define FormatCannotRead 0x2005 ///< wrong d ata file format #define FormatCannotRead 0x2005 ///< wrong d ata file format
#define ImageTooSmall 0x2006 ///< image i s too small #define ImageTooSmall 0x2006 ///< image i s too small
#define ZlibError 0x2007 ///< error in zlib functions #define ZlibError 0x2007 ///< error in zlib functions
#define ColorTableError 0x2008 ///< errors related to color table size #define ColorTableError 0x2008 ///< errors related to color table size
#define PNGError 0x2009 ///< errors in png functions #define PNGError 0x2009 ///< errors in png functions
 End of changes. 4 change blocks. 
7 lines changed or deleted 3 lines changed or added


 PGFtypes.h   PGFtypes.h 
skipping to change at line 43 skipping to change at line 43
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// Constraints // Constraints
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// BufferSize <= UINT16_MAX // BufferSize <= UINT16_MAX
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// Codec versions // Codec versions
// //
// Version 2: modified data structure PGFHeader (backward compatibility as sured) // Version 2: modified data structure PGFHeader (backward compatibility as sured)
// Version 3: DataT: INT32 instead of INT16, allows 31 bit per pixel and c hannel (backward compatibility assured) // Version 4: DataT: INT32 instead of INT16, allows 31 bit per pixel and c hannel (backward compatibility assured)
// Version 5: ROI, new block-reordering scheme (backward compatibility ass ured) // Version 5: ROI, new block-reordering scheme (backward compatibility ass ured)
// Version 6: modified data structure PGFPreHeader: hSize (header size) is now a UINT32 instead of a UINT16 (backward compatibility assured) // Version 6: modified data structure PGFPreHeader: hSize (header size) is now a UINT32 instead of a UINT16 (backward compatibility assured)
// //
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
#define PGFCodecVersion "6.11.42" ///< Major number #define PGFCodecVersion "6.12.24" ///< Major number
///< Minor number: Year (2) Week (2) ///< Minor number: Year (2) Week (2)
#define PGFCodecVersionID 0x061142 ///< Codec version ID to us e for API check in client implementation #define PGFCodecVersionID 0x061224 ///< Codec version ID to us e for API check in client implementation
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// Image constants // Image constants
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
#define Magic "PGF" ///< PGF identification #define Magic "PGF" ///< PGF identification
#define MaxLevel 30 ///< maximum number of transform levels #define MaxLevel 30 ///< maximum number of transform levels
#define NSubbands 4 ///< number of subbands per level #define NSubbands 4 ///< number of subbands per level
#define MaxChannels 8 ///< maximum number of (color) channels #define MaxChannels 8 ///< maximum number of (color) channels
#define DownsampleThreshold 3 ///< if qual ity is larger than this threshold than downsampling is used #define DownsampleThreshold 3 ///< if qual ity is larger than this threshold than downsampling is used
#define DefaultBGColor 255 ///< default background color is white
#define ColorTableLen 256 ///< size of color lookup table (clut) #define ColorTableLen 256 ///< size of color lookup table (clut)
// version flags // version flags
#define Version2 2 ///< data structure PGFHeader of major version 2 #define Version2 2 ///< data structure PGFHeader of major version 2
#define PGF32 4 ///< 32 bit values are used -> allows at maximum 31 bits, otherwise 16 bit values are used -> allows at maximum 15 bits #define PGF32 4 ///< 32 bit values are used -> allows at maximum 31 bits, otherwise 16 bit values are used -> allows at maximum 15 bits
#define PGFROI 8 ///< supports Regions Of Interest #define PGFROI 8 ///< supports Regions Of Interest
#define Version5 16 ///< new coding scheme since major version 5 #define Version5 16 ///< new coding scheme since major version 5
#define Version6 32 ///< new HeaderSize: 32 bits instead of 16 bits #define Version6 32 ///< new HeaderSize: 32 bits instead of 16 bits
// version numbers // version numbers
#ifdef __PGF32SUPPORT__ #ifdef __PGF32SUPPORT__
#define PGFVersion (Version2 | PGF32 | Version5 | Versi on6) ///< current standard version #define PGFVersion (Version2 | PGF32 | Version5 | Versi on6) ///< current standard version
skipping to change at line 95 skipping to change at line 94
#define MaxBitPlanes 15 ///< maximum number of bit planes of m_value: 16 minus sign bit #define MaxBitPlanes 15 ///< maximum number of bit planes of m_value: 16 minus sign bit
#endif #endif
#define MaxBitPlanesLog 5 ///< number of bits to code the maximum number of bit planes (in 32 or 16 bit mode) #define MaxBitPlanesLog 5 ///< number of bits to code the maximum number of bit planes (in 32 or 16 bit mode)
#define MaxQuality MaxBitPlanes ///< maximum quality #define MaxQuality MaxBitPlanes ///< maximum quality
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
// Types // Types
//------------------------------------------------------------------------- ------ //------------------------------------------------------------------------- ------
enum Orientation { LL=0, HL=1, LH=2, HH=3 }; enum Orientation { LL=0, HL=1, LH=2, HH=3 };
/// general file structure /// general PGF file structure
/// PGFPreHeaderV6 PGFHeader PGFPostHeader LevelLengths Level_n-1 Level_n-2 ... Level_0 /// PGFPreHeaderV6 PGFHeader PGFPostHeader LevelLengths Level_n-1 Level_n-2 ... Level_0
/// PGFPostHeader ::= [ColorTable] [UserData] /// PGFPostHeader ::= [ColorTable] [UserData]
/// LevelLengths ::= UINT32[nLevels] /// LevelLengths ::= UINT32[nLevels]
#pragma pack(1) #pragma pack(1)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
/// PGF magic and version (part of PGF pre-header) /// PGF magic and version (part of PGF pre-header)
/// @author C. Stamm /// @author C. Stamm
/// @brief PGF identification and version /// @brief PGF identification and version
struct PGFMagicVersion { struct PGFMagicVersion {
 End of changes. 5 change blocks. 
5 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/